Skip to content

Commit

Permalink
Unrolled build for rust-lang#136975
Browse files Browse the repository at this point in the history
Rollup merge of rust-lang#136975 - jyn514:macos-x, r=Mark-Simulacrum

Look for `python3` first on MacOS, not `py`

`py` is not installed by default *and* trying to run it results in a popup asking if you want to install it. `python3` is installed by default.

This hopefully should not be too disruptive to people on Windows, since they should be going through `x.ps1` instead anyway. Just in case, I've added a check for Cygwin and Msys (i'm not sure how else you'd get a bash shell on windows).

I've tested this on macOS, WSL, "git bash" (which appears to be MSYS), and MSVC with `bash -c ./x` (which runs in WSL, but differently than interactive bash 🙃). I haven't tested Cygwin, which is unsupported anyway, but the code tries to make it work.
  • Loading branch information
rust-timer authored Mar 5, 2025
2 parents 4559163 + 1cac5fa commit 4ebb19f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion x
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@ xpy=$(dirname "$(realpath "$0")")/x.py

# On Windows, `py -3` sometimes works. We need to try it first because `python3`
# sometimes tries to launch the app store on Windows.
for SEARCH_PYTHON in py python3 python python2; do
# On MacOS, `py` tries to install "Developer command line tools". Try `python3` first.
# NOTE: running `bash -c ./x` from Windows doesn't set OSTYPE.
case ${OSTYPE:-} in
cygwin*|msys*) SEARCH="py python3 python python2";;
*) SEARCH="python3 python py python2";;
esac
for SEARCH_PYTHON in $SEARCH; do
if python=$(command -v $SEARCH_PYTHON) && [ -x "$python" ]; then
if [ $SEARCH_PYTHON = py ]; then
extra_arg="-3"
Expand Down

0 comments on commit 4ebb19f

Please sign in to comment.