diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-10-09 10:05:50 +0200 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-10-13 20:28:08 +0200 |
commit | 66b953207d6f0e9c98155af97147a731b2e461bd (patch) | |
tree | 3e0bc55ff28abc187be7b7985fe58dbea54da521 /tools/gyp/pylib/gyp/input.py | |
parent | 7de5a557103dd689bd9a757720eca72459d86e66 (diff) | |
download | android-node-v8-66b953207d6f0e9c98155af97147a731b2e461bd.tar.gz android-node-v8-66b953207d6f0e9c98155af97147a731b2e461bd.tar.bz2 android-node-v8-66b953207d6f0e9c98155af97147a731b2e461bd.zip |
tools: port Python 3 compat patches from node-gyp to gyp
Refs: https://github.com/nodejs/node-gyp/pull/1820
Refs: https://github.com/nodejs/node-gyp/pull/1843
PR-URL: https://github.com/nodejs/node/pull/29897
Reviewed-By: Christian Clauss <cclauss@me.com>
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Diffstat (limited to 'tools/gyp/pylib/gyp/input.py')
-rw-r--r-- | tools/gyp/pylib/gyp/input.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/gyp/pylib/gyp/input.py b/tools/gyp/pylib/gyp/input.py index 5d4a03020a..8ea869a267 100644 --- a/tools/gyp/pylib/gyp/input.py +++ b/tools/gyp/pylib/gyp/input.py @@ -942,8 +942,12 @@ def ExpandVariables(input, phase, variables, build_file): else: replacement = variables[contents] + if isinstance(replacement, bytes) and not isinstance(replacement, str): + replacement = replacement.decode("utf-8") # done on Python 3 only if type(replacement) is list: for item in replacement: + if isinstance(item, bytes) and not isinstance(item, str): + item = item.decode("utf-8") # done on Python 3 only if not contents[-1] == '/' and type(item) not in (str, int): raise GypError('Variable ' + contents + ' must expand to a string or list of strings; ' + |