mirror of
https://github.com/servo/servo.git
synced 2025-06-19 22:59:03 +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.
|
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.
|
Returns True if the file was updated, false otherwise.
|
||||||
"""
|
"""
|
||||||
oldFileContents = ""
|
#XXXjdm This doesn't play well with make right now.
|
||||||
try:
|
# Force the file to always be updated, or else changing CodegenRust.py
|
||||||
oldFile = open(filename, 'rb')
|
# will cause many autogenerated bindings to be regenerated perpetually
|
||||||
oldFileContents = ''.join(oldFile.readlines())
|
# until the result is actually different.
|
||||||
oldFile.close()
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if newContents == oldFileContents:
|
#oldFileContents = ""
|
||||||
return False
|
#try:
|
||||||
|
# oldFile = open(filename, 'rb')
|
||||||
|
# oldFileContents = ''.join(oldFile.readlines())
|
||||||
|
# oldFile.close()
|
||||||
|
#except:
|
||||||
|
# pass
|
||||||
|
|
||||||
|
#if newContents == oldFileContents:
|
||||||
|
# return False
|
||||||
|
|
||||||
f = open(filename, 'wb')
|
f = open(filename, 'wb')
|
||||||
f.write(newContents)
|
f.write(newContents)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue