[Python-checkins] python/dist/src/Tools/freeze bkfile.py, 1.2,
1.3 checkextensions.py, 1.5, 1.6 checkextensions_win32.py, 1.8,
1.9 freeze.py, 1.46, 1.47 makeconfig.py, 1.6,
1.7 makefreeze.py, 1.15, 1.16 makemakefile.py, 1.7,
1.8 parsesetup.py, 1.4, 1.5
tim_one at users.sourceforge.net
tim_one at users.sourceforge.net
Sun Jul 18 08:02:08 CEST 2004
Update of /cvsroot/python/python/dist/src/Tools/freeze
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29862/freeze
Modified Files:
bkfile.py checkextensions.py checkextensions_win32.py
freeze.py makeconfig.py makefreeze.py makemakefile.py
parsesetup.py
Log Message:
Whitespace normalization, via reindent.py.
Index: bkfile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/bkfile.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** bkfile.py 28 Apr 2000 13:31:52 -0000 1.2
--- bkfile.py 18 Jul 2004 06:02:03 -0000 1.3
***************
*** 2,47 ****
class _BkFile:
! def __init__(self, file, mode, bufsize):
! import os
! self.__filename = file
! self.__backup = file + '~'
! try:
! os.unlink(self.__backup)
! except os.error:
! pass
! try:
! os.rename(file, self.__backup)
! except os.error:
! self.__backup = None
! self.__file = _orig_open(file, mode, bufsize)
! self.closed = self.__file.closed
! self.fileno = self.__file.fileno
! self.flush = self.__file.flush
! self.isatty = self.__file.isatty
! self.mode = self.__file.mode
! self.name = self.__file.name
! self.read = self.__file.read
! self.readinto = self.__file.readinto
! 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
! self.writelines = self.__file.writelines
! def close(self):
! self.__file.close()
! if self.__backup is None:
! return
! import filecmp
! if filecmp.cmp(self.__backup, self.__filename, shallow = 0):
! import os
! os.unlink(self.__filename)
! os.rename(self.__backup, self.__filename)
def open(file, mode = 'r', bufsize = -1):
! if 'w' not in mode:
! return _orig_open(file, mode, bufsize)
! return _BkFile(file, mode, bufsize)
--- 2,47 ----
class _BkFile:
! def __init__(self, file, mode, bufsize):
! import os
! self.__filename = file
! self.__backup = file + '~'
! try:
! os.unlink(self.__backup)
! except os.error:
! pass
! try:
! os.rename(file, self.__backup)
! except os.error:
! self.__backup = None
! self.__file = _orig_open(file, mode, bufsize)
! self.closed = self.__file.closed
! self.fileno = self.__file.fileno
! self.flush = self.__file.flush
! self.isatty = self.__file.isatty
! self.mode = self.__file.mode
! self.name = self.__file.name
! self.read = self.__file.read
! self.readinto = self.__file.readinto
! 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
! self.writelines = self.__file.writelines
! def close(self):
! self.__file.close()
! if self.__backup is None:
! return
! import filecmp
! if filecmp.cmp(self.__backup, self.__filename, shallow = 0):
! import os
! os.unlink(self.__filename)
! os.rename(self.__backup, self.__filename)
def open(file, mode = 'r', bufsize = -1):
! if 'w' not in mode:
! return _orig_open(file, mode, bufsize)
! return _BkFile(file, mode, bufsize)
Index: checkextensions.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/checkextensions.py,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** checkextensions.py 11 Sep 2002 20:36:00 -0000 1.5
--- checkextensions.py 18 Jul 2004 06:02:03 -0000 1.6
***************
*** 7,57 ****
def checkextensions(unknown, extensions):
! files = []
! modules = []
! edict = {}
! for e in extensions:
! setup = os.path.join(e, 'Setup')
! liba = os.path.join(e, 'lib.a')
! if not os.path.isfile(liba):
! liba = None
! edict[e] = parsesetup.getsetupinfo(setup), liba
! for mod in unknown:
! for e in extensions:
! (mods, vars), liba = edict[e]
! if not mods.has_key(mod):
! continue
! modules.append(mod)
! if liba:
! # If we find a lib.a, use it, ignore the
! # .o files, and use *all* libraries for
! # *all* modules in the Setup file
! if liba in files:
! break
! files.append(liba)
! for m in mods.keys():
! files = files + select(e, mods, vars,
! m, 1)
! break
! files = files + select(e, mods, vars, mod, 0)
! break
! return files, modules
def select(e, mods, vars, mod, skipofiles):
! files = []
! for w in mods[mod]:
! w = treatword(w)
! if not w:
! continue
! w = expandvars(w, vars)
! for w in w.split():
! if skipofiles and w[-2:] == '.o':
! continue
! # Assume $var expands to absolute pathname
! if w[0] not in ('-', '$') and w[-2:] in ('.o', '.a'):
! w = os.path.join(e, w)
! if w[:2] in ('-L', '-R') and w[2:3] != '$':
! w = w[:2] + os.path.join(e, w[2:])
! files.append(w)
! return files
cc_flags = ['-I', '-D', '-U']
--- 7,57 ----
def checkextensions(unknown, extensions):
! files = []
! modules = []
! edict = {}
! for e in extensions:
! setup = os.path.join(e, 'Setup')
! liba = os.path.join(e, 'lib.a')
! if not os.path.isfile(liba):
! liba = None
! edict[e] = parsesetup.getsetupinfo(setup), liba
! for mod in unknown:
! for e in extensions:
! (mods, vars), liba = edict[e]
! if not mods.has_key(mod):
! continue
! modules.append(mod)
! if liba:
! # If we find a lib.a, use it, ignore the
! # .o files, and use *all* libraries for
! # *all* modules in the Setup file
! if liba in files:
! break
! files.append(liba)
! for m in mods.keys():
! files = files + select(e, mods, vars,
! m, 1)
! break
! files = files + select(e, mods, vars, mod, 0)
! break
! return files, modules
def select(e, mods, vars, mod, skipofiles):
! files = []
! for w in mods[mod]:
! w = treatword(w)
! if not w:
! continue
! w = expandvars(w, vars)
! for w in w.split():
! if skipofiles and w[-2:] == '.o':
! continue
! # Assume $var expands to absolute pathname
! if w[0] not in ('-', '$') and w[-2:] in ('.o', '.a'):
! w = os.path.join(e, w)
! if w[:2] in ('-L', '-R') and w[2:3] != '$':
! w = w[:2] + os.path.join(e, w[2:])
! files.append(w)
! return files
cc_flags = ['-I', '-D', '-U']
***************
*** 59,90 ****
def treatword(w):
! if w[:2] in cc_flags:
! return None
! if w[:1] == '-':
! return w # Assume loader flag
! head, tail = os.path.split(w)
! base, ext = os.path.splitext(tail)
! if ext in cc_exts:
! tail = base + '.o'
! w = os.path.join(head, tail)
! return w
def expandvars(str, vars):
! i = 0
! while i < len(str):
! i = k = str.find('$', i)
! if i < 0:
! break
! i = i+1
! var = str[i:i+1]
! i = i+1
! if var == '(':
! j = str.find(')', i)
! if j < 0:
! break
! var = str[i:j]
! i = j+1
! if vars.has_key(var):
! str = str[:k] + vars[var] + str[i:]
! i = k
! return str
--- 59,90 ----
def treatword(w):
! if w[:2] in cc_flags:
! return None
! if w[:1] == '-':
! return w # Assume loader flag
! head, tail = os.path.split(w)
! base, ext = os.path.splitext(tail)
! if ext in cc_exts:
! tail = base + '.o'
! w = os.path.join(head, tail)
! return w
def expandvars(str, vars):
! i = 0
! while i < len(str):
! i = k = str.find('$', i)
! if i < 0:
! break
! i = i+1
! var = str[i:i+1]
! i = i+1
! if var == '(':
! j = str.find(')', i)
! if j < 0:
! break
! var = str[i:j]
! i = j+1
! if vars.has_key(var):
! str = str[:k] + vars[var] + str[i:]
! i = k
! return str
Index: checkextensions_win32.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/checkextensions_win32.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** checkextensions_win32.py 20 Sep 2003 11:05:01 -0000 1.8
--- checkextensions_win32.py 18 Jul 2004 06:02:03 -0000 1.9
***************
*** 25,164 ****
import os, sys
try:
! import win32api
except ImportError:
! win32api = None # User has already been warned
class CExtension:
! """An abstraction of an extension implemented in C/C++
! """
! def __init__(self, name, sourceFiles):
! self.name = name
! # A list of strings defining additional compiler options.
! self.sourceFiles = sourceFiles
! # A list of special compiler options to be applied to
! # all source modules in this extension.
! self.compilerOptions = []
! # A list of .lib files the final .EXE will need.
! self.linkerLibs = []
! def GetSourceFiles(self):
! return self.sourceFiles
! def AddCompilerOption(self, option):
! self.compilerOptions.append(option)
! def GetCompilerOptions(self):
! return self.compilerOptions
! def AddLinkerLib(self, lib):
! self.linkerLibs.append(lib)
! def GetLinkerLibs(self):
! return self.linkerLibs
def checkextensions(unknown, extra_inis, prefix):
! # Create a table of frozen extensions
! defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini")
! if not os.path.isfile(defaultMapName):
! sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found\n" % defaultMapName)
! else:
! # must go on end, so other inis can override.
! extra_inis.append(defaultMapName)
! ret = []
! for mod in unknown:
! for ini in extra_inis:
! # print "Looking for", mod, "in", win32api.GetFullPathName(ini),"...",
! defn = get_extension_defn( mod, ini, prefix )
! if defn is not None:
! # print "Yay - found it!"
! ret.append( defn )
! break
! # print "Nope!"
! else: # For not broken!
! sys.stderr.write("No definition of module %s in any specified map file.\n" % (mod))
!
! return ret
def get_extension_defn(moduleName, mapFileName, prefix):
! if win32api is None: return None
! os.environ['PYTHONPREFIX'] = prefix
! dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
! if dsp=="":
! return None
! # We allow environment variables in the file name
! dsp = win32api.ExpandEnvironmentStrings(dsp)
! # If the path to the .DSP file is not absolute, assume it is relative
! # to the description file.
! if not os.path.isabs(dsp):
! dsp = os.path.join( os.path.split(mapFileName)[0], dsp)
! # Parse it to extract the source files.
! sourceFiles = parse_dsp(dsp)
! if sourceFiles is None:
! return None
! module = CExtension(moduleName, sourceFiles)
! # Put the path to the DSP into the environment so entries can reference it.
! os.environ['dsp_path'] = os.path.split(dsp)[0]
! os.environ['ini_path'] = os.path.split(mapFileName)[0]
! cl_options = win32api.GetProfileVal(moduleName, "cl", "", mapFileName)
! if cl_options:
! module.AddCompilerOption(win32api.ExpandEnvironmentStrings(cl_options))
! exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName)
! exclude = exclude.split()
! if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName):
! module.AddCompilerOption('/D UNICODE /D _UNICODE')
! libs = win32api.GetProfileVal(moduleName, "libs", "", mapFileName).split()
! for lib in libs:
! module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib))
! for exc in exclude:
! if exc in module.sourceFiles:
! modules.sourceFiles.remove(exc)
! return module
# Given an MSVC DSP file, locate C source files it uses
# returns a list of source files.
def parse_dsp(dsp):
! # print "Processing", dsp
! # For now, only support
! ret = []
! dsp_path, dsp_name = os.path.split(dsp)
! try:
! lines = open(dsp, "r").readlines()
! except IOError, msg:
! sys.stderr.write("%s: %s\n" % (dsp, msg))
! return None
! for line in lines:
! fields = line.strip().split("=", 2)
! if fields[0]=="SOURCE":
! if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c']:
! ret.append( win32api.GetFullPathName(os.path.join(dsp_path, fields[1] ) ) )
! return ret
def write_extension_table(fname, modules):
! fp = open(fname, "w")
! try:
! fp.write (ext_src_header)
! # Write fn protos
! for module in modules:
! # bit of a hack for .pyd's as part of packages.
! name = module.name.split('.')[-1]
! fp.write('extern void init%s(void);\n' % (name) )
! # Write the table
! fp.write (ext_tab_header)
! for module in modules:
! name = module.name.split('.')[-1]
! fp.write('\t{"%s", init%s},\n' % (name, name) )
! fp.write (ext_tab_footer)
! fp.write(ext_src_footer)
! finally:
! fp.close()
--- 25,164 ----
import os, sys
try:
! import win32api
except ImportError:
! win32api = None # User has already been warned
class CExtension:
! """An abstraction of an extension implemented in C/C++
! """
! def __init__(self, name, sourceFiles):
! self.name = name
! # A list of strings defining additional compiler options.
! self.sourceFiles = sourceFiles
! # A list of special compiler options to be applied to
! # all source modules in this extension.
! self.compilerOptions = []
! # A list of .lib files the final .EXE will need.
! self.linkerLibs = []
! def GetSourceFiles(self):
! return self.sourceFiles
! def AddCompilerOption(self, option):
! self.compilerOptions.append(option)
! def GetCompilerOptions(self):
! return self.compilerOptions
! def AddLinkerLib(self, lib):
! self.linkerLibs.append(lib)
! def GetLinkerLibs(self):
! return self.linkerLibs
def checkextensions(unknown, extra_inis, prefix):
! # Create a table of frozen extensions
! defaultMapName = os.path.join( os.path.split(sys.argv[0])[0], "extensions_win32.ini")
! if not os.path.isfile(defaultMapName):
! sys.stderr.write("WARNING: %s can not be found - standard extensions may not be found\n" % defaultMapName)
! else:
! # must go on end, so other inis can override.
! extra_inis.append(defaultMapName)
! ret = []
! for mod in unknown:
! for ini in extra_inis:
! # print "Looking for", mod, "in", win32api.GetFullPathName(ini),"...",
! defn = get_extension_defn( mod, ini, prefix )
! if defn is not None:
! # print "Yay - found it!"
! ret.append( defn )
! break
! # print "Nope!"
! else: # For not broken!
! sys.stderr.write("No definition of module %s in any specified map file.\n" % (mod))
!
! return ret
def get_extension_defn(moduleName, mapFileName, prefix):
! if win32api is None: return None
! os.environ['PYTHONPREFIX'] = prefix
! dsp = win32api.GetProfileVal(moduleName, "dsp", "", mapFileName)
! if dsp=="":
! return None
! # We allow environment variables in the file name
! dsp = win32api.ExpandEnvironmentStrings(dsp)
! # If the path to the .DSP file is not absolute, assume it is relative
! # to the description file.
! if not os.path.isabs(dsp):
! dsp = os.path.join( os.path.split(mapFileName)[0], dsp)
! # Parse it to extract the source files.
! sourceFiles = parse_dsp(dsp)
! if sourceFiles is None:
! return None
! module = CExtension(moduleName, sourceFiles)
! # Put the path to the DSP into the environment so entries can reference it.
! os.environ['dsp_path'] = os.path.split(dsp)[0]
! os.environ['ini_path'] = os.path.split(mapFileName)[0]
! cl_options = win32api.GetProfileVal(moduleName, "cl", "", mapFileName)
! if cl_options:
! module.AddCompilerOption(win32api.ExpandEnvironmentStrings(cl_options))
! exclude = win32api.GetProfileVal(moduleName, "exclude", "", mapFileName)
! exclude = exclude.split()
! if win32api.GetProfileVal(moduleName, "Unicode", 0, mapFileName):
! module.AddCompilerOption('/D UNICODE /D _UNICODE')
! libs = win32api.GetProfileVal(moduleName, "libs", "", mapFileName).split()
! for lib in libs:
! module.AddLinkerLib(win32api.ExpandEnvironmentStrings(lib))
! for exc in exclude:
! if exc in module.sourceFiles:
! modules.sourceFiles.remove(exc)
! return module
# Given an MSVC DSP file, locate C source files it uses
# returns a list of source files.
def parse_dsp(dsp):
! # print "Processing", dsp
! # For now, only support
! ret = []
! dsp_path, dsp_name = os.path.split(dsp)
! try:
! lines = open(dsp, "r").readlines()
! except IOError, msg:
! sys.stderr.write("%s: %s\n" % (dsp, msg))
! return None
! for line in lines:
! fields = line.strip().split("=", 2)
! if fields[0]=="SOURCE":
! if os.path.splitext(fields[1])[1].lower() in ['.cpp', '.c']:
! ret.append( win32api.GetFullPathName(os.path.join(dsp_path, fields[1] ) ) )
! return ret
def write_extension_table(fname, modules):
! fp = open(fname, "w")
! try:
! fp.write (ext_src_header)
! # Write fn protos
! for module in modules:
! # bit of a hack for .pyd's as part of packages.
! name = module.name.split('.')[-1]
! fp.write('extern void init%s(void);\n' % (name) )
! # Write the table
! fp.write (ext_tab_header)
! for module in modules:
! name = module.name.split('.')[-1]
! fp.write('\t{"%s", init%s},\n' % (name, name) )
! fp.write (ext_tab_footer)
! fp.write(ext_src_footer)
! finally:
! fp.close()
***************
*** 183,190 ****
int PyInitFrozenExtensions()
{
! return PyImport_ExtendInittab(extensions);
}
"""
-
-
--- 183,188 ----
int PyInitFrozenExtensions()
{
! return PyImport_ExtendInittab(extensions);
}
"""
Index: freeze.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/freeze.py,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** freeze.py 8 May 2004 17:59:43 -0000 1.46
--- freeze.py 18 Jul 2004 06:02:04 -0000 1.47
***************
*** 58,64 ****
params (note - quoting args in this file is NOT supported)
! -s subsystem: Specify the subsystem (For Windows only.);
'console' (default), 'windows', 'service' or 'com_dll'
!
-w: Toggle Windows (NT or 95) behavior.
(For debugging only -- on a win32 platform, win32 behavior
--- 58,64 ----
params (note - quoting args in this file is NOT supported)
! -s subsystem: Specify the subsystem (For Windows only.);
'console' (default), 'windows', 'service' or 'com_dll'
!
-w: Toggle Windows (NT or 95) behavior.
(For debugging only -- on a win32 platform, win32 behavior
***************
*** 66,70 ****
-r prefix=f: Replace path prefix.
! Replace prefix with f in the source path references
contained in the resulting binary.
--- 66,70 ----
-r prefix=f: Replace path prefix.
! Replace prefix with f in the source path references
contained in the resulting binary.
***************
*** 336,340 ****
except ValueError, why:
usage(why)
!
# Actual work starts here...
--- 336,340 ----
except ValueError, why:
usage(why)
!
# Actual work starts here...
***************
*** 344,348 ****
path[0] = dir
mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths)
!
if win and subsystem=='service':
# If a Windows service, then add the "built-in" module.
--- 344,348 ----
path[0] = dir
mf = modulefinder.ModuleFinder(path, debug, exclude, replace_paths)
!
if win and subsystem=='service':
# If a Windows service, then add the "built-in" module.
***************
*** 412,416 ****
# Do the windows thang...
import checkextensions_win32
! # Get a list of CExtension instances, each describing a module
# (including its source files)
frozen_extensions = checkextensions_win32.checkextensions(
--- 412,416 ----
# Do the windows thang...
import checkextensions_win32
! # Get a list of CExtension instances, each describing a module
# (including its source files)
frozen_extensions = checkextensions_win32.checkextensions(
Index: makeconfig.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makeconfig.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** makeconfig.py 4 Apr 2002 16:15:41 -0000 1.6
--- makeconfig.py 18 Jul 2004 06:02:04 -0000 1.7
***************
*** 7,37 ****
def makeconfig(infp, outfp, modules, with_ifdef=0):
! m1 = re.compile('-- ADDMODULE MARKER 1 --')
! m2 = re.compile('-- ADDMODULE MARKER 2 --')
! while 1:
! line = infp.readline()
! if not line: break
! outfp.write(line)
! if m1 and m1.search(line):
! m1 = None
! for mod in modules:
! if mod in never:
! continue
! if with_ifdef:
! outfp.write("#ifndef init%s\n"%mod)
! outfp.write('extern void init%s(void);\n' % mod)
! if with_ifdef:
! outfp.write("#endif\n")
! elif m2 and m2.search(line):
! m2 = None
! for mod in modules:
! if mod in never:
! continue
! outfp.write('\t{"%s", init%s},\n' %
! (mod, mod))
! if m1:
! sys.stderr.write('MARKER 1 never found\n')
! elif m2:
! sys.stderr.write('MARKER 2 never found\n')
--- 7,37 ----
def makeconfig(infp, outfp, modules, with_ifdef=0):
! m1 = re.compile('-- ADDMODULE MARKER 1 --')
! m2 = re.compile('-- ADDMODULE MARKER 2 --')
! while 1:
! line = infp.readline()
! if not line: break
! outfp.write(line)
! if m1 and m1.search(line):
! m1 = None
! for mod in modules:
! if mod in never:
! continue
! if with_ifdef:
! outfp.write("#ifndef init%s\n"%mod)
! outfp.write('extern void init%s(void);\n' % mod)
! if with_ifdef:
! outfp.write("#endif\n")
! elif m2 and m2.search(line):
! m2 = None
! for mod in modules:
! if mod in never:
! continue
! outfp.write('\t{"%s", init%s},\n' %
! (mod, mod))
! if m1:
! sys.stderr.write('MARKER 1 never found\n')
! elif m2:
! sys.stderr.write('MARKER 2 never found\n')
***************
*** 39,61 ****
def test():
! import sys
! if not sys.argv[3:]:
! print 'usage: python makeconfig.py config.c.in outputfile',
! print 'modulename ...'
! sys.exit(2)
! if sys.argv[1] == '-':
! infp = sys.stdin
! else:
! infp = open(sys.argv[1])
! if sys.argv[2] == '-':
! outfp = sys.stdout
! else:
! outfp = open(sys.argv[2], 'w')
! makeconfig(infp, outfp, sys.argv[3:])
! if outfp != sys.stdout:
! outfp.close()
! if infp != sys.stdin:
! infp.close()
if __name__ == '__main__':
! test()
--- 39,61 ----
def test():
! import sys
! if not sys.argv[3:]:
! print 'usage: python makeconfig.py config.c.in outputfile',
! print 'modulename ...'
! sys.exit(2)
! if sys.argv[1] == '-':
! infp = sys.stdin
! else:
! infp = open(sys.argv[1])
! if sys.argv[2] == '-':
! outfp = sys.stdout
! else:
! outfp = open(sys.argv[2], 'w')
! makeconfig(infp, outfp, sys.argv[3:])
! if outfp != sys.stdout:
! outfp.close()
! if infp != sys.stdin:
! infp.close()
if __name__ == '__main__':
! test()
Index: makefreeze.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makefreeze.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** makefreeze.py 12 Feb 2004 17:35:30 -0000 1.15
--- makefreeze.py 18 Jul 2004 06:02:04 -0000 1.16
***************
*** 20,24 ****
main(int argc, char **argv)
{
! extern int Py_FrozenMain(int, char **);
""" + ((not __debug__ and """
Py_OptimizeFlag++;
--- 20,24 ----
main(int argc, char **argv)
{
! extern int Py_FrozenMain(int, char **);
""" + ((not __debug__ and """
Py_OptimizeFlag++;
Index: makemakefile.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/makemakefile.py,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** makemakefile.py 11 Sep 2002 20:36:00 -0000 1.7
--- makemakefile.py 18 Jul 2004 06:02:04 -0000 1.8
***************
*** 24,28 ****
outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))
! outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" %
(' '.join(files), target))
--- 24,28 ----
outfp.write("\n%s: %s\n" % (target, ' '.join(deps)))
! outfp.write("\t$(LINKCC) $(LDFLAGS) $(LINKFORSHARED) %s -o %s $(LDLAST)\n" %
(' '.join(files), target))
Index: parsesetup.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Tools/freeze/parsesetup.py,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** parsesetup.py 11 Sep 2002 20:36:00 -0000 1.4
--- parsesetup.py 18 Jul 2004 06:02:04 -0000 1.5
***************
*** 11,40 ****
def getmakevars(filename):
! variables = {}
! fp = open(filename)
! pendingline = ""
! try:
! while 1:
! line = fp.readline()
! if pendingline:
! line = pendingline + line
! pendingline = ""
! if not line:
! break
! if line.endswith('\\\n'):
! pendingline = line[:-2]
! matchobj = makevardef.match(line)
! if not matchobj:
! continue
! (name, value) = matchobj.group(1, 2)
! # Strip trailing comment
! i = value.find('#')
! if i >= 0:
! value = value[:i]
! value = value.strip()
! variables[name] = value
! finally:
! fp.close()
! return variables
--- 11,40 ----
def getmakevars(filename):
! variables = {}
! fp = open(filename)
! pendingline = ""
! try:
! while 1:
! line = fp.readline()
! if pendingline:
! line = pendingline + line
! pendingline = ""
! if not line:
! break
! if line.endswith('\\\n'):
! pendingline = line[:-2]
! matchobj = makevardef.match(line)
! if not matchobj:
! continue
! (name, value) = matchobj.group(1, 2)
! # Strip trailing comment
! i = value.find('#')
! if i >= 0:
! value = value[:i]
! value = value.strip()
! variables[name] = value
! finally:
! fp.close()
! return variables
***************
*** 47,80 ****
def getsetupinfo(filename):
! modules = {}
! variables = {}
! fp = open(filename)
! pendingline = ""
! try:
! while 1:
! line = fp.readline()
! if pendingline:
! line = pendingline + line
! pendingline = ""
! if not line:
! break
! # Strip comments
! i = line.find('#')
! if i >= 0:
! line = line[:i]
! if line.endswith('\\\n'):
! pendingline = line[:-2]
! continue
! matchobj = setupvardef.match(line)
! if matchobj:
! (name, value) = matchobj.group(1, 2)
! variables[name] = value.strip()
! else:
! words = line.split()
! if words:
! modules[words[0]] = words[1:]
! finally:
! fp.close()
! return modules, variables
--- 47,80 ----
def getsetupinfo(filename):
! modules = {}
! variables = {}
! fp = open(filename)
! pendingline = ""
! try:
! while 1:
! line = fp.readline()
! if pendingline:
! line = pendingline + line
! pendingline = ""
! if not line:
! break
! # Strip comments
! i = line.find('#')
! if i >= 0:
! line = line[:i]
! if line.endswith('\\\n'):
! pendingline = line[:-2]
! continue
! matchobj = setupvardef.match(line)
! if matchobj:
! (name, value) = matchobj.group(1, 2)
! variables[name] = value.strip()
! else:
! words = line.split()
! if words:
! modules[words[0]] = words[1:]
! finally:
! fp.close()
! return modules, variables
***************
*** 82,112 ****
def test():
! import sys
! import os
! if not sys.argv[1:]:
! 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
! v = getmakevars(arg)
! prdict(v)
! elif base[:5] == 'Setup':
! 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")'
def prdict(d):
! keys = d.keys()
! keys.sort()
! for key in keys:
! value = d[key]
! print "%-15s" % key, str(value)
if __name__ == '__main__':
! test()
--- 82,112 ----
def test():
! import sys
! import os
! if not sys.argv[1:]:
! 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
! v = getmakevars(arg)
! prdict(v)
! elif base[:5] == 'Setup':
! 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")'
def prdict(d):
! keys = d.keys()
! keys.sort()
! for key in keys:
! value = d[key]
! print "%-15s" % key, str(value)
if __name__ == '__main__':
! test()
More information about the Python-checkins
mailing list