From 57c566f8b64cde500709666dc6edec05cb11761a Mon Sep 17 00:00:00 2001 From: Maurits van Rees Date: Tue, 18 Jul 2017 20:38:27 +0200 Subject: [PATCH] Update bootstrap/buildout/setuptools/travis. The previous job failed with a version conflict. --- .travis.yml | 4 ++-- bootstrap-buildout.py | 51 ++++++++++++++++++++++++++++++------------- buildout.cfg | 6 ++--- 3 files changed, 41 insertions(+), 20 deletions(-) diff --git a/.travis.yml b/.travis.yml index 75aa03e..39ac2e6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,8 +13,8 @@ before_install: - echo "download-cache = $HOME/buildout-cache/downloads" >> $HOME/.buildout/default.cfg - echo "eggs-directory = $HOME/buildout-cache/eggs" >> $HOME/.buildout/default.cfg install: - - python bootstrap-buildout.py -c travis.cfg - - bin/buildout -Nc travis.cfg + - python bootstrap-buildout.py -c travis.cfg --buildout-version=2.5.3 --setuptools-version=33.1.1 + - bin/buildout -nc travis.cfg before_script: - export DISPLAY=:99.0 - sh -e /etc/init.d/xvfb start diff --git a/bootstrap-buildout.py b/bootstrap-buildout.py index a629566..a459921 100644 --- a/bootstrap-buildout.py +++ b/bootstrap-buildout.py @@ -25,7 +25,10 @@ from optparse import OptionParser -tmpeggs = tempfile.mkdtemp() +__version__ = '2015-07-01' +# See zc.buildout's changelog if this version is up to date. + +tmpeggs = tempfile.mkdtemp(prefix='bootstrap-') usage = '''\ [DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] @@ -40,8 +43,9 @@ ''' parser = OptionParser(usage=usage) -parser.add_option("-v", "--version", help="use a specific zc.buildout version") - +parser.add_option("--version", + action="store_true", default=False, + help=("Return bootstrap.py version.")) parser.add_option("-t", "--accept-buildout-test-releases", dest='accept_buildout_test_releases', action="store_true", default=False, @@ -59,25 +63,33 @@ parser.add_option("--allow-site-packages", action="store_true", default=False, help=("Let bootstrap.py use existing site packages")) +parser.add_option("--buildout-version", + help="Use a specific zc.buildout version") parser.add_option("--setuptools-version", - help="use a specific setuptools version") - + help="Use a specific setuptools version") +parser.add_option("--setuptools-to-dir", + help=("Allow for re-use of existing directory of " + "setuptools versions")) options, args = parser.parse_args() +if options.version: + print("bootstrap.py version %s" % __version__) + sys.exit(0) + ###################################################################### # load/install setuptools try: - if options.allow_site_packages: - import setuptools - import pkg_resources from urllib.request import urlopen except ImportError: from urllib2 import urlopen ez = {} -exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez) +if os.path.exists('ez_setup.py'): + exec(open('ez_setup.py').read(), ez) +else: + 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 @@ -88,12 +100,19 @@ # 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] + # Strip all site-packages directories from sys.path that + # are not sys.prefix; this is because on Windows + # sys.prefix is a site-package directory. + if sitepackage_path != sys.prefix: + 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 +if options.setuptools_to_dir is not None: + setup_args['to_dir'] = options.setuptools_to_dir ez['use_setuptools'](**setup_args) import setuptools @@ -110,7 +129,12 @@ ws = pkg_resources.working_set +setuptools_path = ws.find( + pkg_resources.Requirement.parse('setuptools')).location + +# Fix sys.path here as easy_install.pth added before PYTHONPATH cmd = [sys.executable, '-c', + 'import sys; sys.path[0:0] = [%r]; ' % setuptools_path + 'from setuptools.command.easy_install import main; main()', '-mZqNxd', tmpeggs] @@ -123,11 +147,8 @@ if find_links: cmd.extend(['-f', find_links]) -setuptools_path = ws.find( - pkg_resources.Requirement.parse('setuptools')).location - requirement = 'zc.buildout' -version = options.version +version = options.buildout_version if version is None and not options.accept_buildout_test_releases: # Figure out the most recent final version of zc.buildout. import setuptools.package_index @@ -167,7 +188,7 @@ def _final_version(parsed_version): cmd.append(requirement) import subprocess -if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0: +if subprocess.call(cmd) != 0: raise Exception( "Failed to execute command:\n%s" % repr(cmd)[1:-1]) diff --git a/buildout.cfg b/buildout.cfg index e359ff1..a6ce302 100644 --- a/buildout.cfg +++ b/buildout.cfg @@ -65,9 +65,9 @@ eggs = i18ndude # Don't use a released version of collective.calltoaction collective.calltoaction = -setuptools = 18.1 -zc.buildout = 2.4.1 -zc.recipe.egg = 2.0.2 +setuptools = 33.1.1 +zc.buildout = 2.5.3 +zc.recipe.egg = 2.0.3 flake8 = 2.5.4 i18ndude = 3.4.0