Changeset 12455


Ignore:
Timestamp:
12 Jan 2015, 21:11:03 (10 years ago)
Author:
uli
Message:

Update to latest bootstrap.py and dependent package versions.

Location:
main/waeup.ikoba/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/trunk/CHANGES.txt

    r12408 r12455  
    440.2dev (unreleased)
    55===================
     6
     7* Update bootstrap.py and dependent package versions.
    68
    79* Add products, documents and customers modules and tons of components.
  • main/waeup.ikoba/trunk/bootstrap.py

    r11851 r12455  
    3636Python that you want bin/buildout to use.
    3737
    38 Note that by using --find-links to point to local resources, you can keep 
     38Note that by using --find-links to point to local resources, you can keep
    3939this script from going over the network.
    4040'''
     
    5757parser.add_option("-f", "--find-links",
    5858                  help=("Specify a URL to search for buildout releases"))
     59parser.add_option("--allow-site-packages",
     60                  action="store_true", default=False,
     61                  help=("Let bootstrap.py use existing site packages"))
     62parser.add_option("--setuptools-version",
     63                  help="use a specific setuptools version")
    5964
    6065
     
    6267
    6368######################################################################
    64 # load/install distribute
     69# load/install setuptools
    6570
    66 to_reload = False
    6771try:
    68     import pkg_resources
    69     import setuptools
    70     if not hasattr(pkg_resources, '_distribute'):
    71         to_reload = True
    72         raise ImportError
     72    if options.allow_site_packages:
     73        import setuptools
     74        import pkg_resources
     75    from urllib.request import urlopen
    7376except ImportError:
    74     ez = {}
     77    from urllib2 import urlopen
    7578
    76     try:
    77         from urllib.request import urlopen
    78     except ImportError:
    79         from urllib2 import urlopen
     79ez = {}
     80exec(urlopen('https://bootstrap.pypa.io/ez_setup.py').read(), ez)
    8081
    81     exec(urlopen(
    82         'http://downloads.buildout.org/2.1/distribute_setup.py').read(), ez)
    83     setup_args = dict(to_dir=tmpeggs, download_delay=0, no_fake=True)
    84     ez['use_setuptools'](**setup_args)
     82if not options.allow_site_packages:
     83    # ez_setup imports site, which adds site packages
     84    # this will remove them from the path to ensure that incompatible versions
     85    # of setuptools are not in the path
     86    import site
     87    # inside a virtualenv, there is no 'getsitepackages'.
     88    # We can't remove these reliably
     89    if hasattr(site, 'getsitepackages'):
     90        for sitepackage_path in site.getsitepackages():
     91            sys.path[:] = [x for x in sys.path if sitepackage_path not in x]
    8592
    86     if to_reload:
    87         reload(pkg_resources)
    88     import pkg_resources
    89     # This does not (always?) update the default working set.  We will
    90     # do it.
    91     for path in sys.path:
    92         if path not in pkg_resources.working_set.entries:
    93             pkg_resources.working_set.add_entry(path)
     93setup_args = dict(to_dir=tmpeggs, download_delay=0)
     94
     95if options.setuptools_version is not None:
     96    setup_args['version'] = options.setuptools_version
     97
     98ez['use_setuptools'](**setup_args)
     99import setuptools
     100import pkg_resources
     101
     102# This does not (always?) update the default working set.  We will
     103# do it.
     104for path in sys.path:
     105    if path not in pkg_resources.working_set.entries:
     106        pkg_resources.working_set.add_entry(path)
    94107
    95108######################################################################
     
    111124    cmd.extend(['-f', find_links])
    112125
    113 distribute_path = ws.find(
    114     pkg_resources.Requirement.parse('distribute')).location
     126setuptools_path = ws.find(
     127    pkg_resources.Requirement.parse('setuptools')).location
    115128
    116129requirement = 'zc.buildout'
     
    122135
    123136    def _final_version(parsed_version):
    124         for part in parsed_version:
    125             if (part[:1] == '*') and (part not in _final_parts):
    126                 return False
    127         return True
     137        try:
     138            return not parsed_version.is_prerelease
     139        except AttributeError:
     140            # Older setuptools
     141            for part in parsed_version:
     142                if (part[:1] == '*') and (part not in _final_parts):
     143                    return False
     144            return True
     145
    128146    index = setuptools.package_index.PackageIndex(
    129         search_path=[distribute_path])
     147        search_path=[setuptools_path])
    130148    if find_links:
    131149        index.add_find_links((find_links,))
     
    150168
    151169import subprocess
    152 if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=distribute_path)) != 0:
     170if subprocess.call(cmd, env=dict(os.environ, PYTHONPATH=setuptools_path)) != 0:
    153171    raise Exception(
    154         "Failed to execute command:\n%s",
    155         repr(cmd)[1:-1])
     172        "Failed to execute command:\n%s" % repr(cmd)[1:-1])
    156173
    157174######################################################################
  • main/waeup.ikoba/trunk/versions.cfg

    r12182 r12455  
    1919transaction = 1.1.0
    2020z3c.testsetup = 0.6.1
    21 zc.buildout = 2.1.0
     21zc.buildout = 2.2.5
    2222zc.recipe.egg = 2.0.0a3
    2323zc.recipe.testrunner = 2.0.0
Note: See TracChangeset for help on using the changeset viewer.