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

Use python.exe by default in build command on Windows #1757

Merged
merged 2 commits into from Sep 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
46 changes: 22 additions & 24 deletions src/build_options.rs
Expand Up @@ -503,29 +503,27 @@ impl BuildOptions {

let mut universal2 = target_triple.as_deref() == Some("universal2-apple-darwin");
// Also try to determine universal2 from ARCHFLAGS environment variable
if let Ok(arch_flags) = env::var("ARCHFLAGS") {
let arches: HashSet<&str> = arch_flags
.split("-arch")
.filter_map(|x| {
let x = x.trim();
if x.is_empty() {
None
} else {
Some(x)
}
})
.collect();
match (arches.contains("x86_64"), arches.contains("arm64")) {
(true, true) => universal2 = true,
(true, false) if target_triple.is_none() => {
target_triple = Some("x86_64-apple-darwin".to_string())
}
(false, true) if target_triple.is_none() => {
target_triple = Some("aarch64-apple-darwin".to_string())
if target_triple.is_none() {
if let Ok(arch_flags) = env::var("ARCHFLAGS") {
let arches: HashSet<&str> = arch_flags
.split("-arch")
.filter_map(|x| {
let x = x.trim();
if x.is_empty() {
None
} else {
Some(x)
}
})
.collect();
match (arches.contains("x86_64"), arches.contains("arm64")) {
(true, true) => universal2 = true,
(true, false) => target_triple = Some("x86_64-apple-darwin".to_string()),
(false, true) => target_triple = Some("aarch64-apple-darwin".to_string()),
(false, false) => {}
}
_ => {}
}
};
};
}
if universal2 {
target_triple = None;
}
Expand Down Expand Up @@ -553,10 +551,10 @@ impl BuildOptions {
if cfg!(test) {
match env::var_os("MATURIN_TEST_PYTHON") {
Some(python) => vec![python.into()],
None => vec![PathBuf::from("python3")],
None => vec![target.get_python()],
}
} else {
vec![PathBuf::from("python3")]
vec![target.get_python()]
}
} else {
// XXX: False positive clippy warning
Expand Down