Commit 49bc0c654eadf4c54472440c976749525765abe1
Merge pull request #782 from selurvedu/buildout-2
Fix the build process; remove chromedriver package dependency (master branch)
Showing
5 changed files
with
17 additions
and
35 deletions
| ... | ... | @@ -29,6 +29,12 @@ __version__ = '2015-07-01' |
| 29 | 29 | # See zc.buildout's changelog if this version is up to date. |
| 30 | 30 | |
| 31 | 31 | tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') |
| 32 | +eggsdir = os.path.join(os.path.dirname(__file__), 'eggs') | |
| 33 | +try: | |
| 34 | + os.mkdir(eggsdir) | |
| 35 | +except OSError as e: | |
| 36 | + if e.errno != 17: | |
| 37 | + raise | |
| 32 | 38 | |
| 33 | 39 | usage = '''\ |
| 34 | 40 | [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] |
| ... | ... | @@ -64,10 +70,13 @@ parser.add_option("--allow-site-packages", |
| 64 | 70 | action="store_true", default=False, |
| 65 | 71 | help=("Let bootstrap.py use existing site packages")) |
| 66 | 72 | parser.add_option("--buildout-version", |
| 73 | + default='2.5.3', | |
| 67 | 74 | help="Use a specific zc.buildout version") |
| 68 | 75 | parser.add_option("--setuptools-version", |
| 76 | + default='33.1.1', | |
| 69 | 77 | help="Use a specific setuptools version") |
| 70 | 78 | parser.add_option("--setuptools-to-dir", |
| 79 | + default=eggsdir, | |
| 71 | 80 | help=("Allow for re-use of existing directory of " |
| 72 | 81 | "setuptools versions")) |
| 73 | 82 | ... | ... |
| ... | ... | @@ -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