[Checkins] SVN: zc.buildout/branches/gary-support-system-python/ hopefully fix a bootstrap issue (thanks Sidnei!) and put in some rudimentary tests.

Gary Poster gary.poster at canonical.com
Tue Jul 7 20:31:22 EDT 2009


Log message for revision 101721:
  hopefully fix a bootstrap issue (thanks Sidnei!) and put in some rudimentary tests.

Changed:
  U   zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py
  U   zc.buildout/branches/gary-support-system-python/src/zc/buildout/bootstrap.txt

-=-
Modified: zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py	2009-07-07 18:58:56 UTC (rev 101720)
+++ zc.buildout/branches/gary-support-system-python/bootstrap/bootstrap.py	2009-07-08 00:31:22 UTC (rev 101721)
@@ -82,6 +82,11 @@
         configuration[name] = 'file://%s' % (
             urllib.pathname2url(os.path.abspath(os.path.expanduser(val))),)
 
+if (configuration['--download-base'] and
+    not configuration['--download-base'].endswith('/')):
+    # download base needs a trailing slash to make the world happy
+    configuration['--download-base'] += '/'
+
 if not configuration['--eggs']:
     configuration['--eggs'] = tmpeggs = tempfile.mkdtemp()
 else:
@@ -98,8 +103,7 @@
     exec urllib2.urlopen(configuration['--ez_setup-source']).read() in ez
     setuptools_args = dict(to_dir=configuration['--eggs'], download_delay=0)
     if configuration['--download-base']:
-        setuptools_args['download_base'] = (
-            configuration['--download-base'] + '/')
+        setuptools_args['download_base'] = configuration['--download-base']
     ez['use_setuptools'](**setuptools_args)
 
     import pkg_resources
@@ -117,8 +121,13 @@
        '-c',
        quote('from setuptools.command.easy_install import main; main()'),
        '-mqNxd',
-       quote(configuration['--eggs']),
-       'zc.buildout' + configuration['--version']]
+       quote(configuration['--eggs'])]
+
+if configuration['--download-base']:
+    cmd.extend(['-f', quote(configuration['--download-base'])])
+
+cmd.append('zc.buildout' + configuration['--version'])
+
 ws = pkg_resources.working_set
 env = dict(
     os.environ,

Modified: zc.buildout/branches/gary-support-system-python/src/zc/buildout/bootstrap.txt
===================================================================
--- zc.buildout/branches/gary-support-system-python/src/zc/buildout/bootstrap.txt	2009-07-07 18:58:56 UTC (rev 101720)
+++ zc.buildout/branches/gary-support-system-python/src/zc/buildout/bootstrap.txt	2009-07-08 00:31:22 UTC (rev 101721)
@@ -120,4 +120,67 @@
         zc.buildout.buildout.main()
     <BLANKLINE>
 
+You can specify a location of ez_setup.py, so you can rely on a local or remote
+location.  We'll write our own ez_setup.py that we will also use to test some
+other bootstrap options.
 
+    >>> write('ez_setup.py', '''\
+    ... def use_setuptools(**kwargs):
+    ...     import sys, pprint
+    ...     pprint.pprint(kwargs)
+    ...     sys.exit()
+    ... ''')
+    >>> print system(
+    ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
+    ...     'bootstrap.py --ez_setup-source=./ez_setup.py')
+    ... # doctest: +ELLIPSIS
+    {'download_delay': 0,
+     'to_dir': '...'}
+    <BLANKLINE>
+
+You can also pass a download-cache, and a place in which eggs should be stored
+(they are normally stored in a temporary directory).
+
+    >>> print system(
+    ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
+    ...     'bootstrap.py --ez_setup-source=./ez_setup.py '+
+    ...     '--download-base=./download-cache --eggs=eggs')
+    ... # doctest: +ELLIPSIS
+    {'download_base': '/sample/download-cache/',
+     'download_delay': 0,
+     'to_dir': '/sample/eggs'}
+    <BLANKLINE>
+
+Here's the entire help text.
+
+    >>> print system(
+    ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
+    ...     'bootstrap.py --help')
+    ... # doctest: +ELLIPSIS
+    Bootstrap a buildout-based project
+    <BLANKLINE>
+    Simply run this script in a directory containing a buildout.cfg.
+    The script accepts buildout command-line options, so you can
+    use the -c option to specify an alternate configuration file.
+    <BLANKLINE>
+    ...
+    <BLANKLINE>
+    Options: 
+      --version=ZC_BUILDOUT_VERSION
+                Specify a version number of the zc.buildout to use
+      --ez_setup-source=URL_OR_FILE
+                Specify a URL or file location for the ez_setup file.
+                Defaults to
+                %(--ez_setup-source)s
+      --download-base=URL_OR_DIRECTORY
+                Specify a URL or directory for downloading setuptools and
+                zc.buildout.  Defaults to PyPI.
+      --eggs=DIRECTORY
+                Specify a directory for storing eggs.  Defaults to a temporary
+                directory that is deleted when the bootstrap script completes.
+    <BLANKLINE>
+    By using --ez_setup-source and --download-base to point to local resources,
+    you can keep bootstrap from going over the network.
+    <BLANKLINE>
+    <BLANKLINE>
+



More information about the Checkins mailing list