Skip to content

Commit

Permalink
Handle scons 3 returning str for Value objects
Browse files Browse the repository at this point in the history
Some scons-3 variants return str (Unicode) while
others return bytes for a Value node's get_contents()
method. Handle both cases.
  • Loading branch information
benmwebb committed Jan 21, 2020
1 parent 0f8cd67 commit b04af84
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion python/saliweb/build/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@

if sys.version_info[0] >= 3:
def _get_value_contents(value_node):
return value_node.get_contents().decode('utf-8')
contents = value_node.get_contents()
if isinstance(contents, bytes):
return contents.decode('utf-8')
else:
return contents
else:
def _get_value_contents(value_node):
return value_node.get_contents()
Expand Down

0 comments on commit b04af84

Please sign in to comment.