[py] overwrite harfbuzz.cc only when there is a needed change

This commit is contained in:
Ebrahim Byagowi 2020-07-03 15:14:10 +04:30
parent 82c6ddb986
commit 1853f84abc
1 changed files with 8 additions and 4 deletions

View File

@ -12,7 +12,11 @@ if len (sys.argv) < 3:
output_file = sys.argv[1]
source_paths = sys.argv[2:]
with open (output_file, "wb") as f:
f.write ("".join ('#include "{}"\n'.format (x)
for x in source_paths
if x.endswith (".cc")).encode ())
result = "".join ('#include "{}"\n'.format (x) for x in source_paths if x.endswith (".cc")).encode ()
with open (output_file, "rb") as f:
current = f.read()
if result != current:
with open (output_file, "wb") as f:
f.write (result)