diff options
author | Tres Seaver <tseaver@palladion.com> | 2014-12-20 16:55:40 -0500 |
---|---|---|
committer | Tres Seaver <tseaver@palladion.com> | 2014-12-20 16:55:40 -0500 |
commit | 11e1961295b6a1c58961665f318f1c60f832d6a4 (patch) | |
tree | 59c70117323bfdc8f4fa1b2be974f9ed22585ef5 | |
parent | 5afb944800d0b1218578030ca0deed157b42601f (diff) | |
download | zope-i18n-11e1961295b6a1c58961665f318f1c60f832d6a4.tar.gz |
Update to latest bootstrap.
-rw-r--r-- | bootstrap.py | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/bootstrap.py b/bootstrap.py index ed57894..a629566 100644 --- a/bootstrap.py +++ b/bootstrap.py @@ -35,7 +35,7 @@ Bootstraps a buildout-based project. Simply run this script in a directory containing a buildout.cfg, using the Python that you want bin/buildout to use. -Note that by using --find-links to point to local resources, you can keep +Note that by using --find-links to point to local resources, you can keep this script from going over the network. ''' @@ -59,6 +59,8 @@ parser.add_option("-f", "--find-links", parser.add_option("--allow-site-packages", action="store_true", default=False, help=("Let bootstrap.py use existing site packages")) +parser.add_option("--setuptools-version", + help="use a specific setuptools version") options, args = parser.parse_args() @@ -79,16 +81,20 @@ exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) if not options.allow_site_packages: # ez_setup imports site, which adds site packages - # this will remove them from the path to ensure that incompatible versions + # this will remove them from the path to ensure that incompatible versions # of setuptools are not in the path import site - # inside a virtualenv, there is no 'getsitepackages'. + # inside a virtualenv, there is no 'getsitepackages'. # We can't remove these reliably if hasattr(site, 'getsitepackages'): for sitepackage_path in site.getsitepackages(): sys.path[:] = [x for x in sys.path if sitepackage_path not in x] setup_args = dict(to_dir=tmpeggs, download_delay=0) + +if options.setuptools_version is not None: + setup_args['version'] = options.setuptools_version + ez['use_setuptools'](**setup_args) import setuptools import pkg_resources @@ -128,10 +134,15 @@ if version is None and not options.accept_buildout_test_releases: _final_parts = '*final-', '*final' def _final_version(parsed_version): - for part in parsed_version: - if (part[:1] == '*') and (part not in _final_parts): - return False - return True + try: + return not parsed_version.is_prerelease + except AttributeError: + # Older setuptools + for part in parsed_version: + if (part[:1] == '*') and (part not in _final_parts): + return False + return True + index = setuptools.package_index.PackageIndex( search_path=[setuptools_path]) if find_links: |