diff options
author | João Valverde <joao.valverde@tecnico.ulisboa.pt> | 2017-11-26 08:28:36 +0000 |
---|---|---|
committer | João Valverde <j@v6e.pt> | 2017-11-27 07:56:51 +0000 |
commit | 944a3c3a582864ca7cbe2bbb1af7291089ecda9c (patch) | |
tree | b1436fe9eea066de0224cabd024dffe25172fd1d /tools/make-plugin-reg.py | |
parent | d8658716277bbb2378819d25997ce0646b72c9c2 (diff) |
make-plugin-reg: Update modification time to plugin.c
Let the build system handle the dependencies. Make sure to update the file
even if nothing has changed to avoid re-running the script every time.
Change-Id: I2229c13578a6278a04152825c98d8b889081dcb7
Reviewed-on: https://code.wireshark.org/review/24597
Petri-Dish: João Valverde <j@v6e.pt>
Tested-by: Petri Dish Buildbot
Reviewed-by: João Valverde <j@v6e.pt>
Diffstat (limited to 'tools/make-plugin-reg.py')
-rwxr-xr-x | tools/make-plugin-reg.py | 28 |
1 files changed, 3 insertions, 25 deletions
diff --git a/tools/make-plugin-reg.py b/tools/make-plugin-reg.py index de95cb1082..84053d3834 100755 --- a/tools/make-plugin-reg.py +++ b/tools/make-plugin-reg.py @@ -7,8 +7,6 @@ import os import sys import re -import hashlib -from stat import * # # The first argument is the directory in which the source files live. @@ -72,7 +70,6 @@ patterns = [ # Grep for filename in filenames: file = open(filename) - cur_mtime = os.fstat(file.fileno())[ST_MTIME] # Read the whole file into memory contents = file.read() for action in patterns: @@ -157,30 +154,11 @@ register_wtap_module(void) reg_code += " {extern void %s (void); %s ();}\n" % (symbol, symbol) reg_code += "}" -# Compare current and new content and update the file if anything has changed. - -try: # Python >= 2.6, >= 3.0 - reg_code_bytes = bytes(reg_code.encode('utf-8')) -except: - reg_code_bytes = reg_code - -new_hash = hashlib.sha1(reg_code_bytes).hexdigest() - try: - fh = open(final_filename, 'rb') - cur_hash = hashlib.sha1(fh.read()).hexdigest() + print(('Updating ' + final_filename)) + fh = open(final_filename, 'w') + fh.write(reg_code) fh.close() -except: - cur_hash = '' - -try: - if new_hash != cur_hash: - print(('Updating ' + final_filename)) - fh = open(final_filename, 'w') - fh.write(reg_code) - fh.close() - else: - print((final_filename + ' unchanged.')) except OSError: sys.exit('Unable to write ' + final_filename + '.\n') |