mirror of
https://github.com/servo/servo.git
synced 2025-06-19 14:48:59 +01:00
Avoid endlessly regenerating bindings after modifying CodegenRust.py.
This commit is contained in:
parent
34a35054e9
commit
e1c406f594
1 changed files with 14 additions and 9 deletions
|
@ -24,16 +24,21 @@ def replaceFileIfChanged(filename, newContents):
|
|||
Read a copy of the old file, so that we don't touch it if it hasn't changed.
|
||||
Returns True if the file was updated, false otherwise.
|
||||
"""
|
||||
oldFileContents = ""
|
||||
try:
|
||||
oldFile = open(filename, 'rb')
|
||||
oldFileContents = ''.join(oldFile.readlines())
|
||||
oldFile.close()
|
||||
except:
|
||||
pass
|
||||
#XXXjdm This doesn't play well with make right now.
|
||||
# Force the file to always be updated, or else changing CodegenRust.py
|
||||
# will cause many autogenerated bindings to be regenerated perpetually
|
||||
# until the result is actually different.
|
||||
|
||||
if newContents == oldFileContents:
|
||||
return False
|
||||
#oldFileContents = ""
|
||||
#try:
|
||||
# oldFile = open(filename, 'rb')
|
||||
# oldFileContents = ''.join(oldFile.readlines())
|
||||
# oldFile.close()
|
||||
#except:
|
||||
# pass
|
||||
|
||||
#if newContents == oldFileContents:
|
||||
# return False
|
||||
|
||||
f = open(filename, 'wb')
|
||||
f.write(newContents)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue