Skip to content

Commit 4b7a743

Browse files
committed
fix: Fix build in Python 3
Since Python 3 does not have a separate "unicode" type, we create an alias to the "str" type for compatibility with Python 2. We do a type check against "str" or "unicode" when parsing JSON to locate a node binary in get_node_binary. Closes #3102 Change-Id: Ib01fda64865052eed64e35b7856a8c392a319144
1 parent 9a03712 commit 4b7a743

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

build/shakaBuildHelpers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@
3232
import sys
3333
import time
3434

35+
# Python 3 no longer has a separate unicode type. For type-checking done in
36+
# get_node_binary, create an alias to the str type.
37+
if sys.version_info[0] == 3:
38+
unicode = str
39+
3540

3641
def _node_modules_last_update_path():
3742
return os.path.join(get_source_base(), 'node_modules', '.last_update')

0 commit comments

Comments
 (0)