提交 c6f1db6f 编写于 作者: J Jonathan Turner 提交者: GitHub

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
...@@ -269,6 +269,7 @@ class RustBuild: ...@@ -269,6 +269,7 @@ class RustBuild:
sys.exit(ret) sys.exit(ret)
def build_triple(self): def build_triple(self):
default_encoding = sys.getdefaultencoding()
config = self.get_toml('build') config = self.get_toml('build')
if config: if config:
return config return config
...@@ -276,8 +277,8 @@ class RustBuild: ...@@ -276,8 +277,8 @@ class RustBuild:
if config: if config:
return config return config
try: try:
ostype = subprocess.check_output(['uname', '-s']).strip() ostype = subprocess.check_output(['uname', '-s']).strip().decode(default_encoding)
cputype = subprocess.check_output(['uname', '-m']).strip() cputype = subprocess.check_output(['uname', '-m']).strip().decode(default_encoding)
except (subprocess.CalledProcessError, WindowsError): except (subprocess.CalledProcessError, WindowsError):
if sys.platform == 'win32': if sys.platform == 'win32':
return 'x86_64-pc-windows-msvc' return 'x86_64-pc-windows-msvc'
...@@ -289,7 +290,8 @@ class RustBuild: ...@@ -289,7 +290,8 @@ class RustBuild:
# Darwin's `uname -s` lies and always returns i386. We have to use # Darwin's `uname -s` lies and always returns i386. We have to use
# sysctl instead. # sysctl instead.
if ostype == 'Darwin' and cputype == 'i686': 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: if ': 1' in sysctl:
cputype = 'x86_64' cputype = 'x86_64'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册