Commit ce433a1c17a0204b71c17849a815b8f5f31ba2d9
1 parent
48dfbf78
Update ez_setup.py
This pulls setuptools 33.1.1 – the last version that works reliably with zc.buildout.
Showing
1 changed file
with
6 additions
and
29 deletions
| ... | ... | @@ -6,6 +6,8 @@ Setuptools bootstrapping installer. |
| 6 | 6 | Maintained at https://github.com/pypa/setuptools/tree/bootstrap. |
| 7 | 7 | |
| 8 | 8 | Run this script to install or upgrade setuptools. |
| 9 | + | |
| 10 | +This method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details. | |
| 9 | 11 | """ |
| 10 | 12 | |
| 11 | 13 | import os |
| ... | ... | @@ -18,25 +20,22 @@ import subprocess |
| 18 | 20 | import platform |
| 19 | 21 | import textwrap |
| 20 | 22 | import contextlib |
| 21 | -import json | |
| 22 | -import codecs | |
| 23 | +import warnings | |
| 23 | 24 | |
| 24 | 25 | from distutils import log |
| 25 | 26 | |
| 26 | 27 | try: |
| 27 | 28 | from urllib.request import urlopen |
| 28 | - from urllib.parse import urljoin | |
| 29 | 29 | except ImportError: |
| 30 | 30 | from urllib2 import urlopen |
| 31 | - from urlparse import urljoin | |
| 32 | 31 | |
| 33 | 32 | try: |
| 34 | 33 | from site import USER_SITE |
| 35 | 34 | except ImportError: |
| 36 | 35 | USER_SITE = None |
| 37 | 36 | |
| 38 | -LATEST = object() | |
| 39 | -DEFAULT_VERSION = "18.3.2" | |
| 37 | +# 33.1.1 is the last version that supports setuptools self upgrade/installation. | |
| 38 | +DEFAULT_VERSION = "33.1.1" | |
| 40 | 39 | DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/" |
| 41 | 40 | DEFAULT_SAVE_DIR = os.curdir |
| 42 | 41 | |
| ... | ... | @@ -157,7 +156,6 @@ def use_setuptools( |
| 157 | 156 | Return None. Raise SystemExit if the requested version |
| 158 | 157 | or later cannot be installed. |
| 159 | 158 | """ |
| 160 | - version = _resolve_version(version) | |
| 161 | 159 | to_dir = os.path.abspath(to_dir) |
| 162 | 160 | |
| 163 | 161 | # prior to importing, capture the module state for |
| ... | ... | @@ -344,7 +342,6 @@ def download_setuptools( |
| 344 | 342 | ``downloader_factory`` should be a function taking no arguments and |
| 345 | 343 | returning a function for downloading a URL to a target. |
| 346 | 344 | """ |
| 347 | - version = _resolve_version(version) | |
| 348 | 345 | # making sure we use the absolute path |
| 349 | 346 | to_dir = os.path.abspath(to_dir) |
| 350 | 347 | zip_name = "setuptools-%s.zip" % version |
| ... | ... | @@ -357,27 +354,6 @@ def download_setuptools( |
| 357 | 354 | return os.path.realpath(saveto) |
| 358 | 355 | |
| 359 | 356 | |
| 360 | -def _resolve_version(version): | |
| 361 | - """ | |
| 362 | - Resolve LATEST version | |
| 363 | - """ | |
| 364 | - if version is not LATEST: | |
| 365 | - return version | |
| 366 | - | |
| 367 | - meta_url = urljoin(DEFAULT_URL, '/pypi/setuptools/json') | |
| 368 | - resp = urlopen(meta_url) | |
| 369 | - with contextlib.closing(resp): | |
| 370 | - try: | |
| 371 | - charset = resp.info().get_content_charset() | |
| 372 | - except Exception: | |
| 373 | - # Python 2 compat; assume UTF-8 | |
| 374 | - charset = 'UTF-8' | |
| 375 | - reader = codecs.getreader(charset) | |
| 376 | - doc = json.load(reader(resp)) | |
| 377 | - | |
| 378 | - return str(doc['info']['version']) | |
| 379 | - | |
| 380 | - | |
| 381 | 357 | def _build_install_args(options): |
| 382 | 358 | """ |
| 383 | 359 | Build the arguments to 'python setup.py install' on the setuptools package. |
| ... | ... | @@ -433,4 +409,5 @@ def main(): |
| 433 | 409 | return _install(archive, _build_install_args(options)) |
| 434 | 410 | |
| 435 | 411 | if __name__ == '__main__': |
| 412 | + warnings.warn("ez_setup.py is deprecated, check https://github.com/pypa/setuptools/issues/581 for more info; use pip to install setuptools") | |
| 436 | 413 | sys.exit(main()) | ... | ... |
Please
register
or
login
to post a comment