summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJack Jansen <jack.jansen@cwi.nl>1999-06-04 15:56:33 (GMT)
committerJack Jansen <jack.jansen@cwi.nl>1999-06-04 15:56:33 (GMT)
commitfb278a5e6f498441901f7642324e1d1f7adca9f5 (patch)
tree66cacf06465694a04847d46c2734d8c0edfead87
parentc0d2d51dd2a57b4c26d3abec63860b90e93d34de (diff)
downloadcpython-fb278a5e6f498441901f7642324e1d1f7adca9f5.zip
cpython-fb278a5e6f498441901f7642324e1d1f7adca9f5.tar.gz
cpython-fb278a5e6f498441901f7642324e1d1f7adca9f5.tar.bz2
Added an "optional" directive, that will include a module if it is available
but not complain if it isn't (giving an ImportError when the frozen code is run).
-rw-r--r--Mac/Tools/macfreeze/directives.py5
-rw-r--r--Mac/Tools/macfreeze/macmodulefinder.py4
2 files changed, 6 insertions, 3 deletions
diff --git a/Mac/Tools/macfreeze/directives.py b/Mac/Tools/macfreeze/directives.py
index e233745..16b7879 100644
--- a/Mac/Tools/macfreeze/directives.py
+++ b/Mac/Tools/macfreeze/directives.py
@@ -18,6 +18,7 @@ REPROG=re.compile(DIRECTIVE_RE)
def findfreezedirectives(program):
extra_modules = []
exclude_modules = []
+ optional_modules = []
extra_path = []
progdir, filename = os.path.split(program)
fp = open(program)
@@ -30,10 +31,12 @@ def findfreezedirectives(program):
extra_modules.append(argument)
elif directive == 'exclude':
exclude_modules.append(argument)
+ elif directive == 'optional':
+ optional_modules.append(argument)
elif directive == 'path':
argument = os.path.join(progdir, argument)
extra_path.append(argument)
else:
print '** Unknown directive', line
- return extra_modules, exclude_modules, extra_path
+ return extra_modules, exclude_modules, optional_modules, extra_path
diff --git a/Mac/Tools/macfreeze/macmodulefinder.py b/Mac/Tools/macfreeze/macmodulefinder.py
index 0af0425..b19c86d 100644
--- a/Mac/Tools/macfreeze/macmodulefinder.py
+++ b/Mac/Tools/macfreeze/macmodulefinder.py
@@ -57,7 +57,7 @@ def process(program, modules=[], module_files = [], debug=0):
#
# search the main source for directives
#
- extra_modules, exclude_modules, extra_path = \
+ extra_modules, exclude_modules, optional_modules, extra_path = \
directives.findfreezedirectives(program)
for m in extra_modules:
if os.sep in m:
@@ -84,7 +84,7 @@ def process(program, modules=[], module_files = [], debug=0):
#
# Tell the user about missing modules
#
- maymiss = exclude_modules + MAC_MAYMISS_MODULES
+ maymiss = exclude_modules + optional_modules + MAC_MAYMISS_MODULES
for m in modfinder.badmodules.keys():
if not m in maymiss:
if debug > 0: