--- planet-nightly/planet/__init__.py 2006-05-23 02:01:58.000000000 +0200 +++ planet-dev/planet/__init__.py 2006-05-22 22:38:59.000000000 +0200 @@ -35,6 +35,7 @@ import dbhash import re import xml.sax.saxutils +import filecmp # Version information (for generator headers) @@ -297,7 +298,7 @@ try: log.info("Writing %s", output_file) - output_fd = open(output_file, "w") + output_fd = open("%s.tmp" % output_file, "w") if encoding.lower() in ("utf-8", "utf8"): # UTF-8 output is the default because we use that internally output_fd.write(tp.process(template)) @@ -310,6 +311,10 @@ output = tp.process(template).decode("utf-8") output_fd.write(output.encode(encoding, "replace")) output_fd.close() + if filecmp.cmp("%s.tmp" % output_file, output_file): + os.unlink("%s.tmp" % output_file) + else: + os.rename("%s.tmp" % output_file, output_file) except KeyboardInterrupt: raise except: