diff --git a/src/build_options.rs b/src/build_options.rs index c3f851fad..3571bd543 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -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; } @@ -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