summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/freeze.py
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/freeze/freeze.py')
-rwxr-xr-xTools/freeze/freeze.py17
1 files changed, 3 insertions, 14 deletions
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index e0c6c2c..15ddbe6 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -439,25 +439,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 +467,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!