Bug 1362872 - Use mbcs encoding for vswhere output. r=gps
authorMakoto Kato <m_kato@ga2.so-net.ne.jp>
Mon, 08 May 2017 15:31:44 +0900
changeset 357590 baad8a03819fa6e8f89503826016bb6907dd4740
parent 357589 d20789b15aa721de6ba901db9d37e21274777263
child 357664 7a335120af24874f46eeb9d25a6e8056ab14a954
push id42435
push usergszorc@mozilla.com
push dateWed, 10 May 2017 23:44:35 +0000
treeherderautoland@baad8a03819f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1362872
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1362872 - Use mbcs encoding for vswhere output. r=gps We add vswhere.exe to support VS2017. But the description output of this command is localized, so it causes UnicodeDecodeError. So we should use 'mbcs' encoding for this output on Windows platform. And for minor languages, we should also use replace to avoid decode error. test_toolchain_configure.py calls vc_compiler_path without correct host.kernel, so we should check current python platform. MozReview-Commit-ID: AkryAzrgSzs
build/moz.configure/toolchain.configure
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -408,19 +408,21 @@ def check_compiler(compiler, language, t
         target_endianness=info.endianness,
         flags=flags,
     )
 
 
 @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)
     for install in vswhere(['-legacy', '-version', '[14.0,15.0)']):
         version = Version(install['installationVersion'])
         # Skip anything older than VS2015.
         if version < '14':
             continue