diff options
author | Gerald Combs <gerald@wireshark.org> | 2013-07-31 23:32:45 +0000 |
---|---|---|
committer | Gerald Combs <gerald@wireshark.org> | 2013-07-31 23:32:45 +0000 |
commit | 4111941a755fa68df67a88efe57c9db2fde9adf5 (patch) | |
tree | f7e75004e543633f72ca966be6d8acd344e3f5f8 /tools/make-dissector-reg.py | |
parent | 3d975361a24e52c0ec01e3a72aa8927f0121b2eb (diff) |
Fix compatibility with older versions of Python. Tested with 2.5, 2.6,
and 3.3.
svn path=/trunk/; revision=51079
Diffstat (limited to 'tools/make-dissector-reg.py')
-rwxr-xr-x | tools/make-dissector-reg.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/make-dissector-reg.py b/tools/make-dissector-reg.py index 9bea5af9a8..521352fe81 100755 --- a/tools/make-dissector-reg.py +++ b/tools/make-dissector-reg.py @@ -285,7 +285,12 @@ gulong register_count(void) # Compare current and new content and update the file if anything has changed. -new_hash = hashlib.sha1(bytes(reg_code.encode('utf-8'))).hexdigest() +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') |