-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Always use system python3
on MacOS
#95441
Conversation
I no longer have r+ privileges. r? @Mark-Simulacrum (but I'm happy to own this review and let you just be a rubber stamp if that's what you prefer) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Walther Can you confirm that this fixes cargo +beta build --bins && cargo +beta run check
for you?
.or_else(|| cmd_finder.maybe_have("python")) | ||
.or_else(|| cmd_finder.maybe_have("python3")) | ||
.or_else(|| cmd_finder.maybe_have("python2")); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this also matches what src/tools/x
does :)
Lines 28 to 43 in 05d2221
for dir in env::split_paths(&val) { | |
if dir.join(PYTHON).exists() { | |
return PYTHON; | |
} | |
python2 |= dir.join(PYTHON2).exists(); | |
python3 |= dir.join(PYTHON3).exists(); | |
} | |
if python3 { | |
PYTHON3 | |
} else if python2 { | |
PYTHON2 | |
} else { | |
PYTHON | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I chose a slightly different order, I went with letting whatever the system deems the "One True python
" would be safer to go with first. Seems that one goes python3
-> python2
-> python
, happy to mimic that order.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, your logic matches what it does: #95443
src/bootstrap/lib.rs
Outdated
// (namely not Homebrew-installed python) | ||
Path::new("/usr/bin/python3") | ||
} else { | ||
self.config.python.as_ref().unwrap() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, one comment - this unwrap
will fail if no python at all is installed. So it would be nice to give a more helpful error message, something like
self.config.python.as_ref().unwrap() | |
self.config.python.as_ref().expect("python is required for running LLDB or rustdoc tests") |
(I think right now we'll require it unconditionally for anything that uses compiletest, but we can fix that later.)
1442b21
to
f58acb3
Compare
f58acb3
to
03c5f0d
Compare
Can confirm, on commit This was on macOS Monterey 12.3 - I don't have a mac with an older OS installed so I cannot double-check that it works on the older ones. I think |
If the older OS's don't have python3, they would have failed even before this change. No one has complained so far, so I think it's fine not to worry about it. |
@rustbot label +S-waiting-on-review @AlecGoncharow I'm not actually part of the rust org - can you run |
@bors r+ rollup |
📌 Commit 03c5f0d has been approved by |
} else { | ||
cmd.arg("--lldb-python").arg(builder.python()); | ||
} | ||
cmd.arg("--lldb-python").arg(builder.python()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't need to be part of this PR, but it would be nice eventually to just have --python
and remove the --lldb-python
/ --docck-python
args from compiletest.
…rk-Simulacrum Always use system `python3` on MacOS This PR includes 2 changes: 1. Always use the system Python found at `/usr/bin/python3` on MacOS 2. Removes the hard requirement on having `python` in your system path if you didn't specify alternatives. The proposed change will instead attempt to find and use in order: `python` -> `python3` -> `python2`. This change isn't strictly necessary but without any change to this check, the original issue inspiring this change will still exist. Fixes rust-lang#95204 r? `@jyn514`
…rk-Simulacrum Always use system `python3` on MacOS This PR includes 2 changes: 1. Always use the system Python found at `/usr/bin/python3` on MacOS 2. Removes the hard requirement on having `python` in your system path if you didn't specify alternatives. The proposed change will instead attempt to find and use in order: `python` -> `python3` -> `python2`. This change isn't strictly necessary but without any change to this check, the original issue inspiring this change will still exist. Fixes rust-lang#95204 r? ``@jyn514``
Rollup of 4 pull requests Successful merges: - rust-lang#95441 (Always use system `python3` on MacOS) - rust-lang#95954 (Fix broken link in coverage tools docs) - rust-lang#95984 (Fix spelling in docs for `can_not_overflow`) - rust-lang#95989 (diagnostics: regression test for spurrious "help: store this in the heap") Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This PR includes 2 changes:
/usr/bin/python3
on MacOSpython
in your system path if you didn't specify alternatives. The proposed change will instead attempt to find and use in order:python
->python3
->python2
. This change isn't strictly necessary but without any change to this check, the original issue inspiring this change will still exist.Fixes #95204
r? @jyn514