diff options
author | nyamatongwe <devnull@localhost> | 2003-09-21 01:45:26 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2003-09-21 01:45:26 +0000 |
commit | 960baac1675313085e59b89dd59913e291f0fea6 (patch) | |
tree | b4552c09dff781ba53cc0e878c63c949fb818f72 | |
parent | a637a4182cc559a6de906ad17eb23e86fbdf2a87 (diff) | |
download | scintilla-mirror-960baac1675313085e59b89dd59913e291f0fea6.tar.gz |
Avoid file rewrite when contents unchanged.
-rw-r--r-- | include/HFacer.py | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/include/HFacer.py b/include/HFacer.py index eb5c6973b..a26aab842 100644 --- a/include/HFacer.py +++ b/include/HFacer.py @@ -1,4 +1,4 @@ -# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface +# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface # definition file. # The header files are copied to a temporary file apart from the section between a //++Autogenerated # comment and a //--Autogenerated comment which is generated by the printHFile and printLexHFile @@ -45,15 +45,24 @@ def CopyWithInsertion(input, output, genfn, definition): copying = 1 output.write(line) +def contents(filename): + f = file(filename) + t = f.read() + f.close() + return t + def Regenerate(filename, genfn, definition): + inText = contents(filename) tempname = "HFacer.tmp" out = open(tempname,"w") hfile = open(filename) CopyWithInsertion(hfile, out, genfn, definition) out.close() hfile.close() - os.unlink(filename) - os.rename(tempname, filename) + outText = contents(tempname) + if inText != outText: + os.unlink(filename) + os.rename(tempname, filename) f = Face.Face() f.ReadFromFile("Scintilla.iface") |