-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Allow discovery of x86-64 managed Python builds on macOS #13474
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1416,3 +1416,73 @@ fn python_install_cached() { | |
| Caused by: An offline Python installation was requested, but cpython-3.12.10[DATE]-[PLATFORM].tar.gz) is missing in python-cache | ||
| "); | ||
| } | ||
|
|
||
| #[cfg(target_os = "macos")] | ||
| #[test] | ||
| fn python_install_emulated_macos() { | ||
| let context: TestContext = TestContext::new_with_versions(&[]) | ||
| .with_filtered_exe_suffix() | ||
| .with_managed_python_dirs(); | ||
|
|
||
| // Before installation, `uv python list` should not show the x86_64 download | ||
| uv_snapshot!(context.filters(), context.python_list().arg("3.13"), @r" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
| cpython-3.13.3-macos-aarch64-none <download available> | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
|
|
||
| // Install an x86_64 version (assuming an aarch64 host) | ||
| uv_snapshot!(context.filters(), context.python_install().arg("cpython-3.13-macos-x86_64"), @r" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| Installed Python 3.13.3 in [TIME] | ||
| + cpython-3.13.3-macos-x86_64-none | ||
| "); | ||
|
|
||
| // It should be discoverable with `uv python find` | ||
| uv_snapshot!(context.filters(), context.python_find().arg("3.13"), @r" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
| [TEMP_DIR]/managed/cpython-3.13.3-macos-x86_64-none/bin/python3.13 | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
|
|
||
| // And included in `uv python list` | ||
| uv_snapshot!(context.filters(), context.python_list().arg("3.13"), @r" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
| cpython-3.13.3-macos-x86_64-none managed/cpython-3.13.3-macos-x86_64-none/bin/python3.13 | ||
| cpython-3.13.3-macos-aarch64-none <download available> | ||
|
|
||
| ----- stderr ----- | ||
| "); | ||
|
|
||
| uv_snapshot!(context.filters(), context.python_install().arg("cpython-3.13-macos-aarch64"), @r" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
|
|
||
| ----- stderr ----- | ||
| Installed Python 3.13.3 in [TIME] | ||
| + cpython-3.13.3-macos-aarch64-none | ||
| "); | ||
|
|
||
| // Once we've installed the native version, it should be preferred over x86_64 | ||
| uv_snapshot!(context.filters(), context.python_find().arg("3.13"), @r" | ||
| success: true | ||
| exit_code: 0 | ||
| ----- stdout ----- | ||
| [TEMP_DIR]/managed/cpython-3.13.3-macos-x86_64-none/bin/python3.13 | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unfortunately this is wrong. We'll need to change the ordering of the managed distributions per target platform so we prefer the native builds.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this hints at a different design for #13701
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
|
||
| ----- stderr ----- | ||
| "); | ||
| } | ||
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 will note that isn't actually strictly true for macOS: Rosetta2 is not default-installed on Apple Silicon macOS. It is auto-installed the first time you run an intel app... but only if it's a full GUI App. If it's just a random CLI binary it actually won't bother!
So if we want to be fully bullet-proof we would have to check if Rosetta2 is already on the user's system :(
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.
In practice it tends to be fine though. Especially since we're finding these things on their system.
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.
Oh dear goodness. That's... good to know. I will at least add some commentary about that.