Skip to content
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

Fix python interpreter detection on arm64 Windows #940

Merged
merged 1 commit into from
May 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Add Python 3.11 sysconfigs for Linux, macOS and Windows in [#934](https://github.com/PyO3/maturin/pull/934)
* Add Python 3.11 sysconfig for arm64 Windows in [#936](https://github.com/PyO3/maturin/pull/936)
* Add network proxy support to upload command in [#939](https://github.com/PyO3/maturin/pull/939)
* Fix python interpreter detection on arm64 Windows in [#940](https://github.com/PyO3/maturin/pull/940)

## [0.12.17] - 2022-05-18

Expand Down
10 changes: 6 additions & 4 deletions src/python_interpreter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,27 +98,29 @@ fn find_all_windows(target: &Target, min_python_minor: usize) -> Result<Vec<Stri
// which is used to find the installed interpreters
let execution = Command::new("py").arg("-0").output();
if let Ok(output) = execution {
let expr = Regex::new(r" -(\d).(\d+)-(\d+)(?: .*)?").unwrap();
// x86_64: ' -3.10-64 *'
// arm64: ' -V:3.11-arm64 * Python 3.11 (ARM64)
let expr = Regex::new(r" -(V:)?(\d).(\d+)-(arm)?(\d+)(?: .*)?").unwrap();
let lines = str::from_utf8(&output.stdout).unwrap().lines();
for line in lines {
if let Some(capture) = expr.captures(line) {
let context = "Expected a digit";

let major = capture
.get(1)
.get(2)
.unwrap()
.as_str()
.parse::<usize>()
.context(context)?;
let minor = capture
.get(2)
.get(3)
.unwrap()
.as_str()
.parse::<usize>()
.context(context)?;
if !versions_found.contains(&(major, minor)) {
let pointer_width = capture
.get(3)
.get(5)
.unwrap()
.as_str()
.parse::<usize>()
Expand Down