Skip to content

Commit

Permalink
Merge pull request #1757 from messense/improve-misc
Browse files Browse the repository at this point in the history
Use `python.exe` by default in `build` command on Windows
  • Loading branch information
messense authored Sep 1, 2023
2 parents 1b4db46 + ce0bd68 commit c1d6be9
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions src/build_options.rs
Original file line number Diff line number Diff line change
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

0 comments on commit c1d6be9

Please sign in to comment.