New version, with contributions from Sjoerd Mullender and Mark Hammond.
Sjoerd writes:
This version of freeze creates one file per Python module, instead of
one humongous file for all Python modules.
bkfile: new module to used to write files with backups. No new file
is produced if the new contents is identical to the old.
New option "-x excluded-module" for modulefinder test program.
New option "-i filename" for freeze main program to include a list of
options in place of the -i option.
diff --git a/Tools/freeze/modulefinder.py b/Tools/freeze/modulefinder.py
index 4c54ebd..4985d52 100644
--- a/Tools/freeze/modulefinder.py
+++ b/Tools/freeze/modulefinder.py
@@ -359,14 +359,16 @@
keys = self.badmodules.keys()
keys.sort()
for key in keys:
- print "?", key
+ # ... but not if they were explicitely excluded.
+ if key not in self.excludes:
+ print "?", key
def test():
# Parse command line
import getopt
try:
- opts, args = getopt.getopt(sys.argv[1:], "dmp:q")
+ opts, args = getopt.getopt(sys.argv[1:], "dmp:qx:")
except getopt.error, msg:
print msg
return
@@ -375,6 +377,7 @@
debug = 1
domods = 0
addpath = []
+ exclude = []
for o, a in opts:
if o == '-d':
debug = debug + 1
@@ -384,6 +387,8 @@
addpath = addpath + string.split(a, os.pathsep)
if o == '-q':
debug = 0
+ if o == '-x':
+ exclude.append(a)
# Provide default arguments
if not args:
@@ -401,7 +406,7 @@
print " ", `item`
# Create the module finder and turn its crank
- mf = ModuleFinder(path, debug)
+ mf = ModuleFinder(path, debug, exclude)
for arg in args[1:]:
if arg == '-m':
domods = 1