backup Makefile too

This commit is contained in:
Guido van Rossum 1995-04-05 10:58:39 +00:00
parent 9a707e8c76
commit 6d67b607b2

View file

@ -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!