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,6 +29,12 @@ __version__ = '2015-07-01' | ||
| 29 | # See zc.buildout's changelog if this version is up to date. | 29 | # See zc.buildout's changelog if this version is up to date. |
| 30 | 30 | ||
| 31 | tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') | 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 | usage = '''\ | 39 | usage = '''\ |
| 34 | [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] | 40 | [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] |
| @@ -64,10 +70,13 @@ parser.add_option("--allow-site-packages", | @@ -64,10 +70,13 @@ parser.add_option("--allow-site-packages", | ||
| 64 | action="store_true", default=False, | 70 | action="store_true", default=False, |
| 65 | help=("Let bootstrap.py use existing site packages")) | 71 | help=("Let bootstrap.py use existing site packages")) |
| 66 | parser.add_option("--buildout-version", | 72 | parser.add_option("--buildout-version", |
| 73 | + default='2.5.3', | ||
| 67 | help="Use a specific zc.buildout version") | 74 | help="Use a specific zc.buildout version") |
| 68 | parser.add_option("--setuptools-version", | 75 | parser.add_option("--setuptools-version", |
| 76 | + default='33.1.1', | ||
| 69 | help="Use a specific setuptools version") | 77 | help="Use a specific setuptools version") |
| 70 | parser.add_option("--setuptools-to-dir", | 78 | parser.add_option("--setuptools-to-dir", |
| 79 | + default=eggsdir, | ||
| 71 | help=("Allow for re-use of existing directory of " | 80 | help=("Allow for re-use of existing directory of " |
| 72 | "setuptools versions")) | 81 | "setuptools versions")) |
| 73 | 82 |
| @@ -98,6 +98,6 @@ robotframework = 3.0.0 | @@ -98,6 +98,6 @@ robotframework = 3.0.0 | ||
| 98 | robotframework-debuglibrary = 0.8 | 98 | robotframework-debuglibrary = 0.8 |
| 99 | robotframework-lint = 0.7 | 99 | robotframework-lint = 0.7 |
| 100 | robotframework-selenium2library = 1.8.0 | 100 | robotframework-selenium2library = 1.8.0 |
| 101 | -setuptools = 18.3.2 | 101 | +setuptools = 33.1.1 |
| 102 | zc.buildout = 2.5.3 | 102 | zc.buildout = 2.5.3 |
| 103 | zc.recipe.egg = 2.0.3 | 103 | zc.recipe.egg = 2.0.3 |
| @@ -6,6 +6,8 @@ Setuptools bootstrapping installer. | @@ -6,6 +6,8 @@ Setuptools bootstrapping installer. | ||
| 6 | Maintained at https://github.com/pypa/setuptools/tree/bootstrap. | 6 | Maintained at https://github.com/pypa/setuptools/tree/bootstrap. |
| 7 | 7 | ||
| 8 | Run this script to install or upgrade setuptools. | 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 | import os | 13 | import os |
| @@ -18,25 +20,22 @@ import subprocess | @@ -18,25 +20,22 @@ import subprocess | ||
| 18 | import platform | 20 | import platform |
| 19 | import textwrap | 21 | import textwrap |
| 20 | import contextlib | 22 | import contextlib |
| 21 | -import json | ||
| 22 | -import codecs | 23 | +import warnings |
| 23 | 24 | ||
| 24 | from distutils import log | 25 | from distutils import log |
| 25 | 26 | ||
| 26 | try: | 27 | try: |
| 27 | from urllib.request import urlopen | 28 | from urllib.request import urlopen |
| 28 | - from urllib.parse import urljoin | ||
| 29 | except ImportError: | 29 | except ImportError: |
| 30 | from urllib2 import urlopen | 30 | from urllib2 import urlopen |
| 31 | - from urlparse import urljoin | ||
| 32 | 31 | ||
| 33 | try: | 32 | try: |
| 34 | from site import USER_SITE | 33 | from site import USER_SITE |
| 35 | except ImportError: | 34 | except ImportError: |
| 36 | USER_SITE = None | 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 | DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/" | 39 | DEFAULT_URL = "https://pypi.io/packages/source/s/setuptools/" |
| 41 | DEFAULT_SAVE_DIR = os.curdir | 40 | DEFAULT_SAVE_DIR = os.curdir |
| 42 | 41 | ||
| @@ -157,7 +156,6 @@ def use_setuptools( | @@ -157,7 +156,6 @@ def use_setuptools( | ||
| 157 | Return None. Raise SystemExit if the requested version | 156 | Return None. Raise SystemExit if the requested version |
| 158 | or later cannot be installed. | 157 | or later cannot be installed. |
| 159 | """ | 158 | """ |
| 160 | - version = _resolve_version(version) | ||
| 161 | to_dir = os.path.abspath(to_dir) | 159 | to_dir = os.path.abspath(to_dir) |
| 162 | 160 | ||
| 163 | # prior to importing, capture the module state for | 161 | # prior to importing, capture the module state for |
| @@ -344,7 +342,6 @@ def download_setuptools( | @@ -344,7 +342,6 @@ def download_setuptools( | ||
| 344 | ``downloader_factory`` should be a function taking no arguments and | 342 | ``downloader_factory`` should be a function taking no arguments and |
| 345 | returning a function for downloading a URL to a target. | 343 | returning a function for downloading a URL to a target. |
| 346 | """ | 344 | """ |
| 347 | - version = _resolve_version(version) | ||
| 348 | # making sure we use the absolute path | 345 | # making sure we use the absolute path |
| 349 | to_dir = os.path.abspath(to_dir) | 346 | to_dir = os.path.abspath(to_dir) |
| 350 | zip_name = "setuptools-%s.zip" % version | 347 | zip_name = "setuptools-%s.zip" % version |
| @@ -357,27 +354,6 @@ def download_setuptools( | @@ -357,27 +354,6 @@ def download_setuptools( | ||
| 357 | return os.path.realpath(saveto) | 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 | def _build_install_args(options): | 357 | def _build_install_args(options): |
| 382 | """ | 358 | """ |
| 383 | Build the arguments to 'python setup.py install' on the setuptools package. | 359 | Build the arguments to 'python setup.py install' on the setuptools package. |
| @@ -433,4 +409,5 @@ def main(): | @@ -433,4 +409,5 @@ def main(): | ||
| 433 | return _install(archive, _build_install_args(options)) | 409 | return _install(archive, _build_install_args(options)) |
| 434 | 410 | ||
| 435 | if __name__ == '__main__': | 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 | sys.exit(main()) | 413 | sys.exit(main()) |
Please
register
or
login
to post a comment