mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 11:49:12 +00:00 
			
		
		
		
	backup Makefile too
This commit is contained in:
		
							parent
							
								
									9a707e8c76
								
							
						
					
					
						commit
						6d67b607b2
					
				
					 1 changed files with 13 additions and 1 deletions
				
			
		| 
						 | 
					@ -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…
	
	Add table
		Add a link
		
	
		Reference in a new issue