[Checkins] SVN: zc.buildout/branches/python-3-2/src/zc/buildout/test rewrote some print calls to give the same output in Python 2 and 3

Thomas Lotze tl at gocept.com
Thu Apr 7 05:38:57 EDT 2011


Log message for revision 121326:
  rewrote some print calls to give the same output in Python 2 and 3

Changed:
  U   zc.buildout/branches/python-3-2/src/zc/buildout/testing.py
  U   zc.buildout/branches/python-3-2/src/zc/buildout/tests.py

-=-
Modified: zc.buildout/branches/python-3-2/src/zc/buildout/testing.py
===================================================================
--- zc.buildout/branches/python-3-2/src/zc/buildout/testing.py	2011-04-07 09:37:52 UTC (rev 121325)
+++ zc.buildout/branches/python-3-2/src/zc/buildout/testing.py	2011-04-07 09:38:56 UTC (rev 121326)
@@ -81,12 +81,12 @@
 
     for name in sorted(names):
         if os.path.isdir(os.path.join(dir, name)):
-            print('d ', end=' ')
+            code = 'd '
         elif os.path.islink(os.path.join(dir, name)):
-            print('l ', end=' ')
+            code = 'l '
         else:
-            print('- ', end=' ')
-        print(name)
+            code = '- '
+        print('%s %s' % (code, name))
 
 def mkdir(*path):
     os.mkdir(os.path.join(*path))

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-07 09:37:52 UTC (rev 121325)
+++ zc.buildout/branches/python-3-2/src/zc/buildout/tests.py	2011-04-07 09:38:56 UTC (rev 121326)
@@ -1039,7 +1039,7 @@
     >>> write('demo', 'demo.py',
     ... """
     ... def ext(buildout):
-    ...     print('ext', list(buildout))
+    ...     print('ext %s' % list(buildout))
     ... """)
 
     >>> write('demo', 'setup.py',
@@ -2953,9 +2953,9 @@
         )
 
     if dist.extras:
-        print('downloaded', dist.version)
+        print('downloaded %s' % dist.version)
     else:
-        print('had', dist.version)
+        print('had %s' % dist.version)
     sys.path_importer_cache.clear()
 
 def prefer_final():
@@ -3697,7 +3697,7 @@
         tmp, 'eggrecipedemo.py',
         'import eggrecipedemoneeded\n'
         'x=%s\n'
-        'def main(): print(x, eggrecipedemoneeded.y)\n'
+        'def main(): print("%%s %%s" %% (x, eggrecipedemoneeded.y))\n'
         % minor_version)
     write(
         tmp, 'setup.py',
@@ -3815,7 +3815,7 @@
 from distutils.core import setup, Extension
 
 if os.environ.get('test-variable'):
-    print("Have environment test-variable:", os.environ['test-variable'])
+    print("Have environment test-variable: %s" % os.environ['test-variable'])
 
 setup(name = "extdemo", version = "%s", url="http://www.zope.org",
       author="Demo", author_email="demo at demo.com",



More information about the checkins mailing list