summaryrefslogtreecommitdiffstats
path: root/Tools/freeze/freeze.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1995-04-05 10:58:39 (GMT)
committerGuido van Rossum <guido@python.org>1995-04-05 10:58:39 (GMT)
commit6d67b607b23e987cf9f3717e6eeeb22eb738a842 (patch)
treef3067a0840deb86cf9e422874dfec6352d26b96b /Tools/freeze/freeze.py
parent9a707e8c76eb8d5f5a673dc76b319c169aced34f (diff)
downloadcpython-6d67b607b23e987cf9f3717e6eeeb22eb738a842.zip
cpython-6d67b607b23e987cf9f3717e6eeeb22eb738a842.tar.gz
cpython-6d67b607b23e987cf9f3717e6eeeb22eb738a842.tar.bz2
backup Makefile too
Diffstat (limited to 'Tools/freeze/freeze.py')
-rwxr-xr-xTools/freeze/freeze.py14
1 files changed, 13 insertions, 1 deletions
diff --git a/Tools/freeze/freeze.py b/Tools/freeze/freeze.py
index e3c2ddd..d4e4b05 100755
--- a/Tools/freeze/freeze.py
+++ b/Tools/freeze/freeze.py
@@ -19,7 +19,7 @@ usage: freeze [-p prefix] [-e extension] ... script [module] ...
-p prefix: This is the prefix used when you ran
'Make inclinstall libainstall' in the Python build directory.
(If you never ran this, freeze won't work.)
- The default is /usr/local.
+ The default is /usr/local.
-e extension: A directory containing additional .o files that
may be used to resolve modules. This directory
@@ -227,11 +227,23 @@ def main():
addfiles + libs + \
['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)']
+ backup = makefile + '~'
+ try:
+ os.rename(makefile, backup)
+ except os.error:
+ backup = None
outfp = open(makefile, 'w')
try:
makemakefile.makemakefile(outfp, somevars, files, target)
finally:
outfp.close()
+ if backup:
+ if not cmp.cmp(backup, makefile):
+ print 'previous Makefile saved as', backup
+ else:
+ sys.stderr.write('%s not changed, not written\n' %
+ makefile)
+ os.rename(backup, makefile)
# Done!