[Python-3000-checkins] r53716 - in python/branches/p3yk: Python/frozen.c Tools/freeze/bkfile.py Tools/freeze/freeze.py Tools/freeze/hello.py Tools/freeze/makeconfig.py Tools/freeze/makefreeze.py Tools/freeze/parsesetup.py Tools/freeze/winmakemakefile.py

guido.van.rossum python-3000-checkins at python.org
Sat Feb 10 00:27:02 CET 2007


Author: guido.van.rossum
Date: Sat Feb 10 00:27:01 2007
New Revision: 53716

Modified:
   python/branches/p3yk/Python/frozen.c
   python/branches/p3yk/Tools/freeze/bkfile.py
   python/branches/p3yk/Tools/freeze/freeze.py
   python/branches/p3yk/Tools/freeze/hello.py
   python/branches/p3yk/Tools/freeze/makeconfig.py
   python/branches/p3yk/Tools/freeze/makefreeze.py
   python/branches/p3yk/Tools/freeze/parsesetup.py
   python/branches/p3yk/Tools/freeze/winmakemakefile.py
Log:
Fix test_frozen.


Modified: python/branches/p3yk/Python/frozen.c
==============================================================================
--- python/branches/p3yk/Python/frozen.c	(original)
+++ python/branches/p3yk/Python/frozen.c	Sat Feb 10 00:27:01 2007
@@ -12,14 +12,15 @@
    the appropriate bytes from M___main__.c. */
 
 static unsigned char M___hello__[] = {
-        99,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,
-        0,64,0,0,0,115,9,0,0,0,100,0,0,71,72,100,
-        1,0,83,40,2,0,0,0,115,14,0,0,0,72,101,108,
-        108,111,32,119,111,114,108,100,46,46,46,78,40,0,0,0,
-        0,40,0,0,0,0,40,0,0,0,0,40,0,0,0,0,
-        115,8,0,0,0,104,101,108,108,111,46,112,121,115,8,0,
-        0,0,60,109,111,100,117,108,101,62,1,0,0,0,115,0,
-        0,0,0,
+	99,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,
+	0,64,0,0,0,115,14,0,0,0,101,0,0,100,0,0,
+	131,1,0,1,100,1,0,83,40,2,0,0,0,115,14,0,
+	0,0,72,101,108,108,111,32,119,111,114,108,100,46,46,46,
+	78,40,1,0,0,0,116,5,0,0,0,112,114,105,110,116,
+	40,0,0,0,0,40,0,0,0,0,40,0,0,0,0,115,
+	8,0,0,0,104,101,108,108,111,46,112,121,115,8,0,0,
+	0,60,109,111,100,117,108,101,62,1,0,0,0,115,0,0,
+	0,0,
 };
 
 #define SIZE (int)sizeof(M___hello__)

Modified: python/branches/p3yk/Tools/freeze/bkfile.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/bkfile.py	(original)
+++ python/branches/p3yk/Tools/freeze/bkfile.py	Sat Feb 10 00:27:01 2007
@@ -25,7 +25,6 @@
         self.readline = self.__file.readline
         self.readlines = self.__file.readlines
         self.seek = self.__file.seek
-        self.softspace = self.__file.softspace
         self.tell = self.__file.tell
         self.truncate = self.__file.truncate
         self.write = self.__file.write

Modified: python/branches/p3yk/Tools/freeze/freeze.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/freeze.py	(original)
+++ python/branches/p3yk/Tools/freeze/freeze.py	Sat Feb 10 00:27:01 2007
@@ -162,7 +162,7 @@
     # proces option arguments
     for o, a in opts:
         if o == '-h':
-            print __doc__
+            print(__doc__)
             return
         if o == '-d':
             debug = debug + 1
@@ -222,7 +222,7 @@
     if win:
         extensions_c = 'frozen_extensions.c'
     if ishome:
-        print "(Using Python source directory)"
+        print("(Using Python source directory)")
         binlib = exec_prefix
         incldir = os.path.join(prefix, 'Include')
         config_h_dir = exec_prefix
@@ -310,7 +310,7 @@
     if odir and not os.path.isdir(odir):
         try:
             os.mkdir(odir)
-            print "Created output directory", odir
+            print("Created output directory", odir)
         except os.error as msg:
             usage('%s: mkdir failed (%s)' % (odir, str(msg)))
     base = ''
@@ -371,7 +371,7 @@
 
     if debug > 0:
         mf.report()
-        print
+        print()
     dict = mf.modules
 
     if error_if_any_missing:
@@ -479,18 +479,18 @@
     # Done!
 
     if odir:
-        print 'Now run "make" in', odir,
-        print 'to build the target:', base_target
+        print('Now run "make" in', odir, end=' ')
+        print('to build the target:', base_target)
     else:
-        print 'Now run "make" to build the target:', base_target
+        print('Now run "make" to build the target:', base_target)
 
 
 # Print usage message and exit
 
 def usage(msg):
     sys.stdout = sys.stderr
-    print "Error:", msg
-    print "Use ``%s -h'' for help" % sys.argv[0]
+    print("Error:", msg)
+    print("Use ``%s -h'' for help" % sys.argv[0])
     sys.exit(2)
 
 

Modified: python/branches/p3yk/Tools/freeze/hello.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/hello.py	(original)
+++ python/branches/p3yk/Tools/freeze/hello.py	Sat Feb 10 00:27:01 2007
@@ -1 +1 @@
-print 'Hello world...'
+print('Hello world...')

Modified: python/branches/p3yk/Tools/freeze/makeconfig.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/makeconfig.py	(original)
+++ python/branches/p3yk/Tools/freeze/makeconfig.py	Sat Feb 10 00:27:01 2007
@@ -40,8 +40,8 @@
 def test():
     import sys
     if not sys.argv[3:]:
-        print 'usage: python makeconfig.py config.c.in outputfile',
-        print 'modulename ...'
+        print('usage: python makeconfig.py config.c.in outputfile', end=' ')
+        print('modulename ...')
         sys.exit(2)
     if sys.argv[1] == '-':
         infp = sys.stdin

Modified: python/branches/p3yk/Tools/freeze/makefreeze.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/makefreeze.py	(original)
+++ python/branches/p3yk/Tools/freeze/makefreeze.py	Sat Feb 10 00:27:01 2007
@@ -43,7 +43,7 @@
             outfp = bkfile.open(base + file, 'w')
             files.append(file)
             if debug:
-                print "freezing", mod, "..."
+                print("freezing", mod, "...")
             str = marshal.dumps(m.__code__)
             size = len(str)
             if m.__path__:
@@ -53,7 +53,7 @@
             writecode(outfp, mangled, str)
             outfp.close()
     if debug:
-        print "generating table of frozen modules"
+        print("generating table of frozen modules")
     outfp = bkfile.open(base + 'frozen.c', 'w')
     for mod, mangled, size in done:
         outfp.write('extern unsigned char M_%s[];\n' % mangled)

Modified: python/branches/p3yk/Tools/freeze/parsesetup.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/parsesetup.py	(original)
+++ python/branches/p3yk/Tools/freeze/parsesetup.py	Sat Feb 10 00:27:01 2007
@@ -84,29 +84,29 @@
     import sys
     import os
     if not sys.argv[1:]:
-        print 'usage: python parsesetup.py Makefile*|Setup* ...'
+        print('usage: python parsesetup.py Makefile*|Setup* ...')
         sys.exit(2)
     for arg in sys.argv[1:]:
         base = os.path.basename(arg)
         if base[:8] == 'Makefile':
-            print 'Make style parsing:', arg
+            print('Make style parsing:', arg)
             v = getmakevars(arg)
             prdict(v)
         elif base[:5] == 'Setup':
-            print 'Setup style parsing:', arg
+            print('Setup style parsing:', arg)
             m, v = getsetupinfo(arg)
             prdict(m)
             prdict(v)
         else:
-            print arg, 'is neither a Makefile nor a Setup file'
-            print '(name must begin with "Makefile" or "Setup")'
+            print(arg, 'is neither a Makefile nor a Setup file')
+            print('(name must begin with "Makefile" or "Setup")')
 
 def prdict(d):
     keys = d.keys()
     keys.sort()
     for key in keys:
         value = d[key]
-        print "%-15s" % key, str(value)
+        print("%-15s" % key, str(value))
 
 if __name__ == '__main__':
     test()

Modified: python/branches/p3yk/Tools/freeze/winmakemakefile.py
==============================================================================
--- python/branches/p3yk/Tools/freeze/winmakemakefile.py	(original)
+++ python/branches/p3yk/Tools/freeze/winmakemakefile.py	Sat Feb 10 00:27:01 2007
@@ -52,29 +52,29 @@
 
 def realwork(vars, moddefns, target):
     version_suffix = "%r%r" % sys.version_info[:2]
-    print "# Makefile for Microsoft Visual C++ generated by freeze.py script"
-    print
-    print 'target = %s' % target
-    print 'pythonhome = %s' % vars['prefix']
-    print
-    print 'DEBUG=0 # Set to 1 to use the _d versions of Python.'
-    print '!IF $(DEBUG)'
-    print 'debug_suffix=_d'
-    print 'c_debug=/Zi /Od /DDEBUG /D_DEBUG'
-    print 'l_debug=/DEBUG'
-    print 'temp_dir=Build\\Debug'
-    print '!ELSE'
-    print 'debug_suffix='
-    print 'c_debug=/Ox'
-    print 'l_debug='
-    print 'temp_dir=Build\\Release'
-    print '!ENDIF'
-    print
-
-    print '# The following line assumes you have built Python using the standard instructions'
-    print '# Otherwise fix the following line to point to the library.'
-    print 'pythonlib = "$(pythonhome)/pcbuild/python%s$(debug_suffix).lib"' % version_suffix
-    print
+    print("# Makefile for Microsoft Visual C++ generated by freeze.py script")
+    print()
+    print('target = %s' % target)
+    print('pythonhome = %s' % vars['prefix'])
+    print()
+    print('DEBUG=0 # Set to 1 to use the _d versions of Python.')
+    print('!IF $(DEBUG)')
+    print('debug_suffix=_d')
+    print('c_debug=/Zi /Od /DDEBUG /D_DEBUG')
+    print('l_debug=/DEBUG')
+    print('temp_dir=Build\\Debug')
+    print('!ELSE')
+    print('debug_suffix=')
+    print('c_debug=/Ox')
+    print('l_debug=')
+    print('temp_dir=Build\\Release')
+    print('!ENDIF')
+    print()
+
+    print('# The following line assumes you have built Python using the standard instructions')
+    print('# Otherwise fix the following line to point to the library.')
+    print('pythonlib = "$(pythonhome)/pcbuild/python%s$(debug_suffix).lib"' % version_suffix)
+    print()
 
     # We only ever write one "entry point" symbol - either
     # "main" or "WinMain".  Therefore, there is no need to
@@ -88,59 +88,59 @@
         target_ext = ".dll"
 
 
-    print "# As the target uses Python%s.dll, we must use this compiler option!" % version_suffix
-    print "cdl = /MD"
-    print
-    print "all: $(target)$(debug_suffix)%s" % (target_ext)
-    print
-
-    print '$(temp_dir):'
-    print '  if not exist $(temp_dir)\. mkdir $(temp_dir)'
-    print
+    print("# As the target uses Python%s.dll, we must use this compiler option!" % version_suffix)
+    print("cdl = /MD")
+    print()
+    print("all: $(target)$(debug_suffix)%s" % (target_ext))
+    print()
+
+    print('$(temp_dir):')
+    print('  if not exist $(temp_dir)\. mkdir $(temp_dir)')
+    print()
 
     objects = []
     libs = ["shell32.lib", "comdlg32.lib", "wsock32.lib", "user32.lib", "oleaut32.lib"]
     for moddefn in moddefns:
-        print "# Module", moddefn.name
+        print("# Module", moddefn.name)
         for file in moddefn.sourceFiles:
             base = os.path.basename(file)
             base, ext = os.path.splitext(base)
             objects.append(base + ".obj")
-            print '$(temp_dir)\%s.obj: "%s"' % (base, file)
-            print "\t@$(CC) -c -nologo /Fo$* $(cdl) $(c_debug) /D BUILD_FREEZE",
-            print '"-I$(pythonhome)/Include"  "-I$(pythonhome)/PC" \\'
-            print "\t\t$(cflags) $(cdebug) $(cinclude) \\"
+            print('$(temp_dir)\%s.obj: "%s"' % (base, file))
+            print("\t@$(CC) -c -nologo /Fo$* $(cdl) $(c_debug) /D BUILD_FREEZE", end=' ')
+            print('"-I$(pythonhome)/Include"  "-I$(pythonhome)/PC" \\')
+            print("\t\t$(cflags) $(cdebug) $(cinclude) \\")
             extra = moddefn.GetCompilerOptions()
             if extra:
-                print "\t\t%s \\" % (' '.join(extra),)
-            print '\t\t"%s"' % file
-            print
+                print("\t\t%s \\" % (' '.join(extra),))
+            print('\t\t"%s"' % file)
+            print()
 
         # Add .lib files this module needs
         for modlib in moddefn.GetLinkerLibs():
             if modlib not in libs:
                 libs.append(modlib)
 
-    print "ADDN_LINK_FILES=",
-    for addn in vars['addn_link']: print '"%s"' % (addn),
-    print ; print
-
-    print "OBJS=",
-    for obj in objects: print '"$(temp_dir)\%s"' % (obj),
-    print ; print
-
-    print "LIBS=",
-    for lib in libs: print '"%s"' % (lib),
-    print ; print
-
-    print "$(target)$(debug_suffix)%s: $(temp_dir) $(OBJS)" % (target_ext)
-    print "\tlink -out:$(target)$(debug_suffix)%s %s" % (target_ext, target_link_flags),
-    print "\t$(OBJS) \\"
-    print "\t$(LIBS) \\"
-    print "\t$(ADDN_LINK_FILES) \\"
-    print "\t$(pythonlib) $(lcustom) $(l_debug)\\"
-    print "\t$(resources)"
-    print
-    print "clean:"
-    print "\t-rm -f *.obj"
-    print "\t-rm -f $(target).exe"
+    print("ADDN_LINK_FILES=", end=' ')
+    for addn in vars['addn_link']: print('"%s"' % (addn), end=' ')
+    print() ; print()
+
+    print("OBJS=", end=' ')
+    for obj in objects: print('"$(temp_dir)\%s"' % (obj), end=' ')
+    print() ; print()
+
+    print("LIBS=", end=' ')
+    for lib in libs: print('"%s"' % (lib), end=' ')
+    print() ; print()
+
+    print("$(target)$(debug_suffix)%s: $(temp_dir) $(OBJS)" % (target_ext))
+    print("\tlink -out:$(target)$(debug_suffix)%s %s" % (target_ext, target_link_flags), end=' ')
+    print("\t$(OBJS) \\")
+    print("\t$(LIBS) \\")
+    print("\t$(ADDN_LINK_FILES) \\")
+    print("\t$(pythonlib) $(lcustom) $(l_debug)\\")
+    print("\t$(resources)")
+    print()
+    print("clean:")
+    print("\t-rm -f *.obj")
+    print("\t-rm -f $(target).exe")


More information about the Python-3000-checkins mailing list