Skip to content

Commit

Permalink
Try to support py3 with rustbuild better
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed Sep 15, 2016
1 parent d1acabe commit 3f79310
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/bootstrap/bootstrap.py
Expand Up @@ -269,15 +269,16 @@ def run(self, args, env):
sys.exit(ret)

def build_triple(self):
default_encoding = sys.getdefaultencoding()
config = self.get_toml('build')
if config:
return config
config = self.get_mk('CFG_BUILD')
if config:
return config
try:
ostype = subprocess.check_output(['uname', '-s']).strip()
cputype = subprocess.check_output(['uname', '-m']).strip()
ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
except (subprocess.CalledProcessError, WindowsError):
if sys.platform == 'win32':
return 'x86_64-pc-windows-msvc'
Expand All @@ -289,7 +290,8 @@ def build_triple(self):
# Darwin's `uname -s` lies and always returns i386. We have to use
# sysctl instead.
if ostype == 'Darwin' and cputype == 'i686':
sysctl = subprocess.check_output(['sysctl', 'hw.optional.x86_64'])
args = ['sysctl', 'hw.optional.x86_64']
sysctl = subprocess.check_output(args).decode(default_encoding)
if ': 1' in sysctl:
cputype = 'x86_64'

Expand Down

0 comments on commit 3f79310

Please sign in to comment.