From 7ad01c1f5c5b31943241776d4182074b30416631 Mon Sep 17 00:00:00 2001 From: messense Date: Fri, 1 Sep 2023 20:30:08 +0800 Subject: [PATCH 1/2] Only parse `ARCHFLAGS` when `--target` isn't specified --- src/build_options.rs | 42 ++++++++++++++++++++---------------------- 1 file changed, 20 insertions(+), 22 deletions(-) diff --git a/src/build_options.rs b/src/build_options.rs index c3f851fad..a7c30eae2 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; } From ce0bd6862e122da7eddea761459324c2fa673d2a Mon Sep 17 00:00:00 2001 From: messense Date: Fri, 1 Sep 2023 20:30:45 +0800 Subject: [PATCH 2/2] Use `python.exe` by default in `build` command on Windows --- src/build_options.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/build_options.rs b/src/build_options.rs index a7c30eae2..3571bd543 100644 --- a/src/build_options.rs +++ b/src/build_options.rs @@ -551,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