diff options
author | Guido van Rossum <guido@python.org> | 2007-02-09 23:27:01 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2007-02-09 23:27:01 (GMT) |
commit | 96bf7e8a37b0785b6fed2e678e289a6b1873f07f (patch) | |
tree | 1ae1603ee285ff32f0be922dc5722d2225a509ea /Tools | |
parent | 79139b247b0bc0bc1b1a12932140bbd4bc188df7 (diff) | |
download | cpython-96bf7e8a37b0785b6fed2e678e289a6b1873f07f.zip cpython-96bf7e8a37b0785b6fed2e678e289a6b1873f07f.tar.gz cpython-96bf7e8a37b0785b6fed2e678e289a6b1873f07f.tar.bz2 |
Fix test_frozen.
Diffstat (limited to 'Tools')
-rw-r--r-- | Tools/freeze/bkfile.py | 1 | ||||
-rwxr-xr-x | Tools/freeze/freeze.py | 18 | ||||
-rw-r--r-- | Tools/freeze/hello.py | 2 | ||||
-rw-r--r-- | Tools/freeze/makeconfig.py | 4 | ||||
-rw-r--r-- | Tools/freeze/makefreeze.py | 4 | ||||
-rw-r--r-- | Tools/freeze/parsesetup.py | 12 | ||||
-rw-r--r-- | Tools/freeze/winmakemakefile.py | 124 |
7 files changed, 82 insertions, 83 deletions
diff --git a/Tools/freeze/bkfile.py b/Tools/freeze/bkfile.py index 54af2fa..c67a6c4 100644 --- a/Tools/freeze/bkfile.py +++ b/Tools/freeze/bkfile.py @@ -25,7 +25,6 @@ class _BkFile: 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 diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py index 786d53a..93b1abc 100755 --- a/Tools/freeze/freeze.py +++ b/Tools/freeze/freeze.py @@ -162,7 +162,7 @@ def main(): # 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 @@ def main(): 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 @@ def main(): 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 @@ def main(): if debug > 0: mf.report() - print + print() dict = mf.modules if error_if_any_missing: @@ -479,18 +479,18 @@ def main(): # 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) diff --git a/Tools/freeze/hello.py b/Tools/freeze/hello.py index f978acc..d7a3729 100644 --- a/Tools/freeze/hello.py +++ b/Tools/freeze/hello.py @@ -1 +1 @@ -print 'Hello world...' +print('Hello world...') diff --git a/Tools/freeze/makeconfig.py b/Tools/freeze/makeconfig.py index 7cd9b78..0bf8756 100644 --- a/Tools/freeze/makeconfig.py +++ b/Tools/freeze/makeconfig.py @@ -40,8 +40,8 @@ def makeconfig(infp, outfp, modules, with_ifdef=0): 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 diff --git a/Tools/freeze/makefreeze.py b/Tools/freeze/makefreeze.py index 1208b67..e359db9 100644 --- a/Tools/freeze/makefreeze.py +++ b/Tools/freeze/makefreeze.py @@ -43,7 +43,7 @@ def makefreeze(base, dict, debug=0, entry_point=None, fail_import=()): 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 @@ def makefreeze(base, dict, debug=0, entry_point=None, fail_import=()): 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) diff --git a/Tools/freeze/parsesetup.py b/Tools/freeze/parsesetup.py index 856234d..ae0bc43 100644 --- a/Tools/freeze/parsesetup.py +++ b/Tools/freeze/parsesetup.py @@ -84,29 +84,29 @@ def test(): 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() diff --git a/Tools/freeze/winmakemakefile.py b/Tools/freeze/winmakemakefile.py index 8570f3d..e473fed 100644 --- a/Tools/freeze/winmakemakefile.py +++ b/Tools/freeze/winmakemakefile.py @@ -52,29 +52,29 @@ def makemakefile(outfp, vars, files, target): 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 @@ def realwork(vars, moddefns, target): 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("# 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('$(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") |