summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/freeze.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/freeze/freeze.py')
-rwxr-xr-xTools/freeze/freeze.py21
1 files changed, 6 insertions, 15 deletions
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index e0c6c2c..c075807 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -366,8 +366,10 @@ def main():
mf.load_file(mod)
# Alias "importlib._bootstrap" to "_frozen_importlib" so that the
- # import machinery can bootstrap.
+ # import machinery can bootstrap. Do the same for
+ # importlib._bootstrap_external.
mf.modules["_frozen_importlib"] = mf.modules["importlib._bootstrap"]
+ mf.modules["_frozen_importlib_external"] = mf.modules["importlib._bootstrap_external"]
# Add the main script as either __main__, or the actual module name.
if python_entry_is_main:
@@ -439,25 +441,17 @@ def main():
frozendllmain_c, os.path.basename(extensions_c)] + files
maindefn = checkextensions_win32.CExtension( '__main__', xtras )
frozen_extensions.append( maindefn )
- outfp = open(makefile, 'w')
- try:
+ with open(makefile, 'w') as outfp:
winmakemakefile.makemakefile(outfp,
locals(),
frozen_extensions,
os.path.basename(target))
- finally:
- outfp.close()
return
# generate config.c and Makefile
builtins.sort()
- infp = open(config_c_in)
- outfp = bkfile.open(config_c, 'w')
- try:
+ with open(config_c_in) as infp, bkfile.open(config_c, 'w') as outfp:
makeconfig.makeconfig(infp, outfp, builtins)
- finally:
- outfp.close()
- infp.close()
cflags = ['$(OPT)']
cppflags = defines + includes
@@ -475,11 +469,8 @@ def main():
files + supp_sources + addfiles + libs + \
['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)']
- outfp = bkfile.open(makefile, 'w')
- try:
+ with bkfile.open(makefile, 'w') as outfp:
makemakefile.makemakefile(outfp, somevars, files, base_target)
- finally:
- outfp.close()
# Done!