diff options
| author | Yuki Okushi <jtitor@2k36.org> | 2023-04-28 10:52:02 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-28 10:52:02 +0900 |
| commit | 00b9ce5a2ad81db72e77a0bdc63530f130cde482 (patch) | |
| tree | b7ff768e3c31a52007b33ff973860c55f56950c5 | |
| parent | 75be5580715d2d045302e05d62530ab240f14afe (diff) | |
| parent | cffc10b2c82f97e45121710af7ddf617e177b5e7 (diff) | |
| download | rust-00b9ce5a2ad81db72e77a0bdc63530f130cde482.tar.gz rust-00b9ce5a2ad81db72e77a0bdc63530f130cde482.zip | |
Rollup merge of #110909 - john-h-k:build/no-rustc-version-darwin, r=jyn514
Skip `rustc` version detection on macOS Fixes #104723
| -rw-r--r-- | src/bootstrap/bootstrap.py | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py index 680a8da6adf..9c6c917ac4a 100644 --- a/src/bootstrap/bootstrap.py +++ b/src/bootstrap/bootstrap.py @@ -209,19 +209,25 @@ def default_build_triple(verbose): # install, use their preference. This fixes most issues with Windows builds # being detected as GNU instead of MSVC. default_encoding = sys.getdefaultencoding() - try: - version = subprocess.check_output(["rustc", "--version", "--verbose"], - stderr=subprocess.DEVNULL) - version = version.decode(default_encoding) - host = next(x for x in version.split('\n') if x.startswith("host: ")) - triple = host.split("host: ")[1] - if verbose: - print("detected default triple {} from pre-installed rustc".format(triple)) - return triple - except Exception as e: + + if sys.platform == 'darwin': if verbose: - print("pre-installed rustc not detected: {}".format(e)) + print("not using rustc detection as it is unreliable on macOS") print("falling back to auto-detect") + else: + try: + version = subprocess.check_output(["rustc", "--version", "--verbose"], + stderr=subprocess.DEVNULL) + version = version.decode(default_encoding) + host = next(x for x in version.split('\n') if x.startswith("host: ")) + triple = host.split("host: ")[1] + if verbose: + print("detected default triple {} from pre-installed rustc".format(triple)) + return triple + except Exception as e: + if verbose: + print("pre-installed rustc not detected: {}".format(e)) + print("falling back to auto-detect") required = sys.platform != 'win32' ostype = require(["uname", "-s"], exit=required) |
