[Checkins] SVN: zc.buildout/branches/python-3-2/ checkpoint

Jim Fulton jim at zope.com
Sun Apr 3 09:16:04 EDT 2011


Log message for revision 121211:
  checkpoint

Changed:
  U   zc.buildout/branches/python-3-2/bootstrap/bootstrap.py
  U   zc.buildout/branches/python-3-2/src/zc/buildout/bootstrap.txt
  U   zc.buildout/branches/python-3-2/src/zc/buildout/rmtree.py
  U   zc.buildout/branches/python-3-2/src/zc/buildout/tests.py
  U   zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/README.txt
  U   zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/api.txt

-=-
Modified: zc.buildout/branches/python-3-2/bootstrap/bootstrap.py
===================================================================
--- zc.buildout/branches/python-3-2/bootstrap/bootstrap.py	2011-04-03 13:00:39 UTC (rev 121210)
+++ zc.buildout/branches/python-3-2/bootstrap/bootstrap.py	2011-04-03 13:16:03 UTC (rev 121211)
@@ -105,6 +105,8 @@
 parser = OptionParser(usage=usage)
 parser.add_option("-v", "--version", dest="version",
                           help="use a specific zc.buildout version")
+parser.add_option("--setup-version", dest="setup_version",
+                  help="The version of setuptools or distribute to use.")
 parser.add_option("-d", "--distribute",
                    action="store_true", dest="use_distribute",
                    default= sys.version_info[0] >= 3,
@@ -171,14 +173,19 @@
     setup_args = dict(to_dir=eggs_dir, download_delay=0)
     if options.download_base:
         setup_args['download_base'] = options.download_base
+    if options.setup_version:
+        setup_args['version'] = options.setup_version
     if options.use_distribute:
         setup_args['no_fake'] = True
     ez['use_setuptools'](**setup_args)
     if 'pkg_resources' in sys.modules:
-        if sys.version_info[0] > 3:
-            from imp import reload
+        if sys.version_info[0] >= 3:
+            import imp
+            reload_ = imp.reload
+        else:
+            reload_ = reload
 
-        reload(sys.modules['pkg_resources'])
+        reload_(sys.modules['pkg_resources'])
     import pkg_resources
     # This does not (always?) update the default working set.  We will
     # do it.

Modified: zc.buildout/branches/python-3-2/src/zc/buildout/bootstrap.txt
===================================================================
--- zc.buildout/branches/python-3-2/src/zc/buildout/bootstrap.txt	2011-04-03 13:00:39 UTC (rev 121210)
+++ zc.buildout/branches/python-3-2/src/zc/buildout/bootstrap.txt	2011-04-03 13:16:03 UTC (rev 121211)
@@ -20,9 +20,11 @@
     ... parts =
     ... ''')
     >>> write('bootstrap.py', open(bootstrap_py).read())
+
     >>> print('XX'); run(
-    ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
-    ...     'bootstrap.py'); print('X') # doctest: +ELLIPSIS
+    ...     zc.buildout.easy_install._safe_arg(sys.executable) +
+    ...     ' bootstrap.py'
+    ...     ); print('X') # doctest: +ELLIPSIS
     X...
     Creating directory '/sample/bin'.
     Creating directory '/sample/parts'.
@@ -161,63 +163,25 @@
     No local packages or download links found for zc.buildout==UNKNOWN...
     ...
 
-Now let's try with `1.1.2`, which happens to exist::
+Now let's try with `98.0`, which happens to exist::
 
     >>> print('X'); run(
     ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
-    ...     'bootstrap.py --version 1.1.2'); print('X')
-    ...
-    X
+    ...     'bootstrap.py --version 98.0'); print('X')
+    ...     # doctest: +ELLIPSIS
+    X...
     Generated script '/sample/bin/buildout'.
     <BLANKLINE>
     X
 
-Versions older than 1.5.0 put their egg dependencies in the ``buildout`` script.
-Let's make sure it was generated as we expect::
-
-    >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
-    #...
-    <BLANKLINE>
-    import sys
-    sys.path[0:0] = [
-      '/sample/eggs/setuptools-...egg',
-      '/sample/eggs/zc.buildout-1.1.2...egg',
-      ]
-    <BLANKLINE>
-    import zc.buildout.buildout
-    <BLANKLINE>
-    if __name__ == '__main__':
-        zc.buildout.buildout.main()
-    <BLANKLINE>
-
-Let's try with `1.2.1`::
-
-    >>> print('X'); run(
-    ...     zc.buildout.easy_install._safe_arg(sys.executable)+' '+
-    ...     'bootstrap.py --version 1.2.1'); print('X') # doctest: +ELLIPSIS
+    >>> print(open(buildout_site_py).read()) # doctest: +ELLIPSIS
+    "...
+        buildout_paths = [
+            '/sample/eggs/setuptools-...egg',
+            '/sample/eggs/zc.buildout-98.0-pyN.N.egg'
+            ]
     ...
-    X
-    Generated script '/sample/bin/buildout'.
-    <BLANKLINE>
-    X
 
-Let's make sure the generated ``buildout`` script uses it::
-
-    >>> print(open(buildout_script).read()) # doctest: +ELLIPSIS
-    #...
-    <BLANKLINE>
-    import sys
-    sys.path[0:0] = [
-      '/sample/eggs/setuptools-...egg',
-      '/sample/eggs/zc.buildout-1.2.1...egg',
-      ]
-    <BLANKLINE>
-    import zc.buildout.buildout
-    <BLANKLINE>
-    if __name__ == '__main__':
-        zc.buildout.buildout.main()
-    <BLANKLINE>
-
 ``zc.buildout`` now can also run with `Distribute` with the `--distribute`
 option::
 

Modified: zc.buildout/branches/python-3-2/src/zc/buildout/rmtree.py
===================================================================
--- zc.buildout/branches/python-3-2/src/zc/buildout/rmtree.py	2011-04-03 13:00:39 UTC (rev 121210)
+++ zc.buildout/branches/python-3-2/src/zc/buildout/rmtree.py	2011-04-03 13:16:03 UTC (rev 121211)
@@ -38,7 +38,7 @@
     Now create a file ...
 
     >>> foo = os.path.join (d, 'foo')
-    >>> f = open(foo); _ = f.write('hulu'); f.close()
+    >>> f = open(foo, 'w'); _ = f.write('hulu'); f.close()
 
     and make it unwriteable
 

Modified: zc.buildout/branches/python-3-2/src/zc/buildout/tests.py
===================================================================
--- zc.buildout/branches/python-3-2/src/zc/buildout/tests.py	2011-04-03 13:00:39 UTC (rev 121210)
+++ zc.buildout/branches/python-3-2/src/zc/buildout/tests.py	2011-04-03 13:16:03 UTC (rev 121211)
@@ -2828,13 +2828,13 @@
     >>> src = tmpdir('src')
     >>> write(src, 'wacky_handler.py',
     ... '''
-    ... try: from urllib2 import HTTPHandler, install_opener
+    ... try: from urllib2 import HTTPHandler, install_opener, build_opener
     ... except ImportError:
-    ...    from urllib.request import HTTPHandler, install_opener
+    ...    from urllib.request import HTTPHandler, install_opener, build_opener
     ... class Wacky(HTTPHandler):
-    ...     wacky_open = urllib2.HTTPHandler.http_open
+    ...     wacky_open = HTTPHandler.http_open
     ... def install(buildout=None):
-    ...     install_opener(urllib2.build_opener(Wacky))
+    ...     install_opener(build_opener(Wacky))
     ... ''')
     >>> write(src, 'setup.py',
     ... '''
@@ -3932,8 +3932,10 @@
     easy_install_SetUp(test)
     sample_eggs = test.globs['sample_eggs']
     ws = getWorkingSetWithBuildoutEgg(test)
+    makeNewRelease('distribute', ws, sample_eggs)
     makeNewRelease('zc.buildout', ws, sample_eggs)
     makeNewRelease('zc.buildout', ws, sample_eggs, '100.0b1')
+    makeNewRelease('zc.buildout', ws, sample_eggs, '98.0')
     os.environ['bootstrap-testing-find-links'] = test.globs['link_server']
 
 normalize_bang = (
@@ -4196,6 +4198,7 @@
                 (re.compile('Downloading.*setuptools.*egg\n'), ''),
                 (re.compile('options:'), 'Options:'),
                 (re.compile('usage:'), 'Usage:'),
+                (re.compile('setuptools'), 'distribute'),
                 ]),
             ))
         test_suite.append(doctest.DocFileSuite(

Modified: zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/README.txt
===================================================================
--- zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2011-04-03 13:00:39 UTC (rev 121210)
+++ zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/README.txt	2011-04-03 13:16:03 UTC (rev 121211)
@@ -219,13 +219,13 @@
 We can also run the py-demo script.  Here we'll just print out
 the bits if the path added to reflect the eggs:
 
-    >>> run(join(sample_buildout, 'bin', 'py-demo')
+    >>> print_(system(join(sample_buildout, 'bin', 'py-demo'),
     ... """import os, sys
     ... for p in sys.path:
     ...     if 'demo' in p:
     ...         print(os.path.basename(p))
     ...
-    ... """).replace('>>> ', '').replace('... ', ''),
+    ... """).replace('>>> ', '').replace('... ', ''))
     ... # doctest: +ELLIPSIS +NORMALIZE_WHITESPACE
     demo-0.2-py2.4.egg
     demoneeded-1.2c1-py2.4.egg

Modified: zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/api.txt
===================================================================
--- zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/api.txt	2011-04-03 13:00:39 UTC (rev 121210)
+++ zc.buildout/branches/python-3-2/zc.recipe.egg_/src/zc/recipe/egg/api.txt	2011-04-03 13:16:03 UTC (rev 121211)
@@ -30,7 +30,7 @@
     ...     def install(self):
     ...         extras = self.options['extras'].split()
     ...         requirements, ws = self.egg.working_set(extras)
-    ...         print('Part:' + self.name)
+    ...         print('Part: ' + self.name)
     ...         print('Egg requirements:')
     ...         for r in requirements:
     ...             print(r)



More information about the checkins mailing list