summaryrefslogtreecommitdiff
path: root/build/moz.configure
diff options
context:
space:
mode:
authorJeremy Andrews <athenian200@outlook.com>2022-07-16 11:07:35 -0500
committerJeremy Andrews <athenian200@outlook.com>2022-07-16 11:07:35 -0500
commitef891463857511a7e5293fa623d46e4cefb9d3dc (patch)
tree86336e26d9cdc1b5f7a7dc798ecb8e5648cba50c /build/moz.configure
parentdcb027a7184442e140aad1921a5f26fe9135c1da (diff)
downloaduxp-ef891463857511a7e5293fa623d46e4cefb9d3dc.tar.gz
Issue #1956 - Work around UTF-8 issue when parsing JSON with Python 2 on some Windows environments.
This is a known issue with Python 2 interacting badly with some Windows configurations. Mozilla encountered it as well. Ref: BZ 1362872
Diffstat (limited to 'build/moz.configure')
-rw-r--r--build/moz.configure/toolchain.configure4
1 files changed, 3 insertions, 1 deletions
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index e1df749456..5f03cb2b74 100644
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -386,9 +386,11 @@ def check_compiler(compiler, language, target):
@imports(_from='__builtin__', _import='open')
@imports('json')
@imports('subprocess')
+@imports('sys')
def get_vc_paths(topsrcdir):
def vswhere(args):
- return json.loads(subprocess.check_output([os.path.join(topsrcdir, 'build/win32/vswhere.exe'), '-format', 'json'] + args))
+ encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8'
+ return json.loads(subprocess.check_output([os.path.join(topsrcdir, 'build/win32/vswhere.exe'), '-format', 'json'] + args).decode(encoding, 'replace'))
# Can't pass -requires with -legacy, so query each separately.
# Legacy versions first (VS2015)