Skip to content

Commit

Permalink
Merge pull request #37 from dirk-thomas/hydro-devel
Browse files Browse the repository at this point in the history
python 3 compatibility
  • Loading branch information
dirk-thomas committed Dec 19, 2013
2 parents 861ed49 + 29a7775 commit 9945fa8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
9 changes: 4 additions & 5 deletions src/genmsg/gentools.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@ def compute_md5_text(msg_context, spec):
sub_md5 = compute_md5(msg_context, sub_spec)
buff.write("%s %s\n"%(sub_md5, name))

value = buff.getvalue().strip() # remove trailing new line
return value.encode()
return buff.getvalue().strip() # remove trailing new line

def _compute_hash(msg_context, spec, hash):
"""
Expand All @@ -101,10 +100,10 @@ def _compute_hash(msg_context, spec, hash):
# accumulate the hash
# - root file
if isinstance(spec, MsgSpec):
hash.update(compute_md5_text(msg_context, spec))
hash.update(compute_md5_text(msg_context, spec).encode())
elif isinstance(spec, SrvSpec):
hash.update(compute_md5_text(msg_context, spec.request))
hash.update(compute_md5_text(msg_context, spec.response))
hash.update(compute_md5_text(msg_context, spec.request).encode())
hash.update(compute_md5_text(msg_context, spec.response).encode())
else:
raise Exception("[%s] is not a message or service"%spec)
return hash.hexdigest()
Expand Down
2 changes: 1 addition & 1 deletion test/test_genmsg_msgs.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def sub_test_MsgSpec(types, names, constants, text, full_name, has_header):
assert m.text == text
assert has_header == m.has_header()
assert m.constants == constants
assert zip(types, names) == m.fields()
assert list(zip(types, names)) == m.fields()
assert m == MsgSpec(types, names, constants, text, full_name)
return m

Expand Down

0 comments on commit 9945fa8

Please sign in to comment.