diff options
author | Eric Engestrom <[email protected]> | 2017-10-25 14:04:35 +0100 |
---|---|---|
committer | Eric Engestrom <[email protected]> | 2017-10-27 13:38:37 +0100 |
commit | 7088622e5fb506b64c906b673a9af0feb9a5ba14 (patch) | |
tree | bcf6b8c47f47e9ebe43a7781e4016c2817127d04 /src/SConscript | |
parent | a41e2e9cf5f865f21e32cac2ed2e25dd21a05119 (diff) |
buildsys: move file regeneration logic to the script itself
Signed-off-by: Eric Engestrom <[email protected]>
Reviewed-by: Jordan Justen <[email protected]>
Reviewed-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/SConscript')
-rw-r--r-- | src/SConscript | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/src/SConscript b/src/SConscript index a277e8b7925..95ea061c4bb 100644 --- a/src/SConscript +++ b/src/SConscript @@ -24,22 +24,12 @@ def write_git_sha1_h_file(filename): to retrieve the git hashid and write the header file. An empty file will be created if anything goes wrong.""" - tempfile = "git_sha1.h.tmp" - with open(tempfile, "w") as f: - args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py' ] - try: - subprocess.Popen(args, stdout=f).wait() - except: - print("Warning: exception in write_git_sha1_h_file()") - return - - if not os.path.exists(filename) or not filecmp.cmp(tempfile, filename): - # The filename does not exist or it's different from the new file, - # so replace old file with new. - if os.path.exists(filename): - os.remove(filename) - os.rename(tempfile, filename) - return + args = [ python_cmd, Dir('#').abspath + '/bin/git_sha1_gen.py', '--output', filename ] + try: + subprocess.call(args) + except: + print("Warning: exception in write_git_sha1_h_file()") + return # Create the git_sha1.h header file |