Skip to content

Commit c6f1db6

Browse files
author
Jonathan Turner
authored
Rollup merge of #36509 - nagisa:rustbuild-py3, r=alexcrichton
Try to support py3 with rustbuild better Annoying to have it fail when you run with `python` only to have to rerun later with `python2`. r? @alexcrichton
2 parents 390e8bd + 3f79310 commit c6f1db6

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/bootstrap/bootstrap.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -269,15 +269,16 @@ def run(self, args, env):
269269
sys.exit(ret)
270270

271271
def build_triple(self):
272+
default_encoding = sys.getdefaultencoding()
272273
config = self.get_toml('build')
273274
if config:
274275
return config
275276
config = self.get_mk('CFG_BUILD')
276277
if config:
277278
return config
278279
try:
279-
ostype = subprocess.check_output(['uname', '-s']).strip()
280-
cputype = subprocess.check_output(['uname', '-m']).strip()
280+
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
281+
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
281282
except (subprocess.CalledProcessError, WindowsError):
282283
if sys.platform == 'win32':
283284
return 'x86_64-pc-windows-msvc'
@@ -289,7 +290,8 @@ def build_triple(self):
289290
# Darwin's `uname -s` lies and always returns i386. We have to use
290291
# sysctl instead.
291292
if ostype == 'Darwin' and cputype == 'i686':
292-
sysctl = subprocess.check_output(['sysctl', 'hw.optional.x86_64'])
293+
args = ['sysctl', 'hw.optional.x86_64']
294+
sysctl = subprocess.check_output(args).decode(default_encoding)
293295
if ': 1' in sysctl:
294296
cputype = 'x86_64'
295297

0 commit comments

Comments
 (0)