Minor cleanups to run_code_generation.

Prints more info when a particular file is not found.

Bug: angleproject:3333
Change-Id: I11ceb0d319023cd1fd23fd25297e5367030342a0
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1550899
Reviewed-by: Yuly Novikov <ynovikov@chromium.org>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill
2019-04-03 15:18:16 -04:00
committed by Commit Bot
parent 84661549f3
commit 13264033c8

View File

@@ -13,7 +13,7 @@ import os
import subprocess
import sys
script_dir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
script_dir = sys.path[0]
root_dir = os.path.abspath(os.path.join(script_dir, '..'))
# auto_script is a standard way for scripts to return their inputs and outputs.
@@ -106,6 +106,7 @@ def any_hash_dirty(name, filenames, new_hashes, old_hashes):
for filename in filenames:
key = name + ":" + filename
if not os.path.isfile(filename):
print('Could not find %s for %s' % (filename, name))
found_dirty_hash = True
else:
new_hashes[key] = md5(filename)
@@ -115,12 +116,13 @@ def any_hash_dirty(name, filenames, new_hashes, old_hashes):
def any_old_hash_missing(new_hashes, old_hashes):
result = False
for name, _ in old_hashes.iteritems():
if name not in new_hashes:
script, file = name.split(':')
print('%s missing from generated hashes.' % file)
return True
return False
print('%s missing from generated hashes for %s.' % (file, script))
result = True
return result
def update_output_hashes(script, outputs, new_hashes):
@@ -134,6 +136,7 @@ def update_output_hashes(script, outputs, new_hashes):
def main():
os.chdir(script_dir)
old_hashes = json.load(open(hash_fname))
new_hashes = {}
any_dirty = False