diff options
-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") |