diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-07-31 20:14:35 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-07-31 20:14:35 +0000 |
commit | ee9c3082a896841c09d8e07cfb8a4dcfeccdac2c (patch) | |
tree | 825b08098451a7ea6fed89f5c714b016295cb0b3 /tools/make-dissector-reg.py | |
parent | a2a20ed62abdb61fa0398365aee9ccf1179ea544 (diff) |
Add support for Python 3. Make sure we pass bytes to hashlib.sha1 as
suggested in bug 8995. Call print as a function instead of a builtin as
suggested by 2to3.
svn path=/trunk/; revision=51073
Diffstat (limited to 'tools/make-dissector-reg.py')
-rwxr-xr-x | tools/make-dissector-reg.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/make-dissector-reg.py b/tools/make-dissector-reg.py index 150097204a..9bea5af9a8 100755 --- a/tools/make-dissector-reg.py +++ b/tools/make-dissector-reg.py @@ -285,7 +285,7 @@ gulong register_count(void) # Compare current and new content and update the file if anything has changed. -new_hash = hashlib.sha1(reg_code).hexdigest() +new_hash = hashlib.sha1(bytes(reg_code.encode('utf-8'))).hexdigest() try: fh = open(final_filename, 'rb') @@ -296,12 +296,12 @@ except: try: if new_hash != cur_hash: - print ('Updating ' + final_filename) + print(('Updating ' + final_filename)) fh = open(final_filename, 'w') fh.write(reg_code) fh.close() else: - print(final_filename + ' unchanged.') + print((final_filename + ' unchanged.')) os.utime(final_filename, None) except OSError: sys.exit('Unable to write ' + final_filename + '.\n') |