mirror of https://github.com/python/cpython
backup Makefile too
This commit is contained in:
parent
9a707e8c76
commit
6d67b607b2
|
@ -19,7 +19,7 @@ usage: freeze [-p prefix] [-e extension] ... script [module] ...
|
||||||
-p prefix: This is the prefix used when you ran
|
-p prefix: This is the prefix used when you ran
|
||||||
'Make inclinstall libainstall' in the Python build directory.
|
'Make inclinstall libainstall' in the Python build directory.
|
||||||
(If you never ran this, freeze won't work.)
|
(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
|
-e extension: A directory containing additional .o files that
|
||||||
may be used to resolve modules. This directory
|
may be used to resolve modules. This directory
|
||||||
|
@ -227,11 +227,23 @@ def main():
|
||||||
addfiles + libs + \
|
addfiles + libs + \
|
||||||
['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)']
|
['$(MODLIBS)', '$(LIBS)', '$(SYSLIBS)']
|
||||||
|
|
||||||
|
backup = makefile + '~'
|
||||||
|
try:
|
||||||
|
os.rename(makefile, backup)
|
||||||
|
except os.error:
|
||||||
|
backup = None
|
||||||
outfp = open(makefile, 'w')
|
outfp = open(makefile, 'w')
|
||||||
try:
|
try:
|
||||||
makemakefile.makemakefile(outfp, somevars, files, target)
|
makemakefile.makemakefile(outfp, somevars, files, target)
|
||||||
finally:
|
finally:
|
||||||
outfp.close()
|
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!
|
# Done!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue