Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
setuptools
Commits
8427babe
Commit
8427babe
authored
Dec 15, 2015
by
Jason R. Coombs
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ez_setup now loads latest version using metadata
parent
627d4b47
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
2 deletions
+27
-2
ez_setup.py
ez_setup.py
+27
-2
No files found.
ez_setup.py
View file @
8427babe
...
@@ -16,7 +16,8 @@ import subprocess
...
@@ -16,7 +16,8 @@ import subprocess
import
platform
import
platform
import
textwrap
import
textwrap
import
contextlib
import
contextlib
import
warnings
import
json
import
codecs
from
distutils
import
log
from
distutils
import
log
...
@@ -30,7 +31,8 @@ try:
...
@@ -30,7 +31,8 @@ try:
except
ImportError
:
except
ImportError
:
USER_SITE
=
None
USER_SITE
=
None
DEFAULT_VERSION
=
"19.1"
LATEST
=
object
()
DEFAULT_VERSION
=
LATEST
DEFAULT_URL
=
"https://pypi.python.org/packages/source/s/setuptools/"
DEFAULT_URL
=
"https://pypi.python.org/packages/source/s/setuptools/"
DEFAULT_SAVE_DIR
=
os
.
curdir
DEFAULT_SAVE_DIR
=
os
.
curdir
...
@@ -140,6 +142,7 @@ def use_setuptools(
...
@@ -140,6 +142,7 @@ def use_setuptools(
Return None. Raise SystemExit if the requested version
Return None. Raise SystemExit if the requested version
or later cannot be installed.
or later cannot be installed.
"""
"""
version
=
_resolve_version
(
version
)
to_dir
=
os
.
path
.
abspath
(
to_dir
)
to_dir
=
os
.
path
.
abspath
(
to_dir
)
# prior to importing, capture the module state for
# prior to importing, capture the module state for
...
@@ -321,6 +324,7 @@ def download_setuptools(
...
@@ -321,6 +324,7 @@ def download_setuptools(
``downloader_factory`` should be a function taking no arguments and
``downloader_factory`` should be a function taking no arguments and
returning a function for downloading a URL to a target.
returning a function for downloading a URL to a target.
"""
"""
version
=
_resolve_version
(
version
)
# making sure we use the absolute path
# making sure we use the absolute path
to_dir
=
os
.
path
.
abspath
(
to_dir
)
to_dir
=
os
.
path
.
abspath
(
to_dir
)
zip_name
=
"setuptools-%s.zip"
%
version
zip_name
=
"setuptools-%s.zip"
%
version
...
@@ -333,6 +337,27 @@ def download_setuptools(
...
@@ -333,6 +337,27 @@ def download_setuptools(
return
os
.
path
.
realpath
(
saveto
)
return
os
.
path
.
realpath
(
saveto
)
def
_resolve_version
(
version
):
"""
Resolve LATEST version
"""
if
version
is
not
LATEST
:
return
version
with
urlopen
(
'https://pypi.python.org/pypi/setuptools/json'
)
as
resp
:
charset
=
resp
.
info
().
get_content_charset
()
reader
=
codecs
.
getreader
(
charset
)
doc
=
json
.
load
(
reader
(
resp
))
def
by_vals
(
ver_string
):
try
:
return
tuple
(
map
(
int
,
ver_string
.
split
(
'.'
)))
except
Exception
:
return
(
0
,)
return
max
(
doc
[
'releases'
],
key
=
by_vals
)
def
_build_install_args
(
options
):
def
_build_install_args
(
options
):
"""
"""
Build the arguments to 'python setup.py install' on the setuptools package.
Build the arguments to 'python setup.py install' on the setuptools package.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment