Skip to content
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 @@ -2,6 +2,7 @@

## Unreleased

* When building `abi3` wheels on non-Windows platforms that aren't cross-compiling, the `sysconfigdata` of the interpreter used to run maturin will now be used, rather than a dummy interpreter.
* Allow iOS cross-platform virtual environments, such as those used by cibuildwheel, to imply an iOS target.
* Fix iOS wheel naming to be compliant with PEP 730.
* Fix generated WHEEL Tag metadata to be spec compliant.
Expand Down
108 changes: 56 additions & 52 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -473,60 +473,64 @@ impl BuildOptions {
}
Ok(found_interpreters)
}
} else {
eprintln!("🐍 Not using a specific python interpreter");
if self.interpreter.is_empty() {
// Fake one to make `BuildContext::build_wheels` happy for abi3 when no cpython/pypy found on host
// The python interpreter config doesn't matter, as it's not used for anything
Ok(vec![PythonInterpreter {
config: InterpreterConfig {
major: *major as usize,
minor: *minor as usize,
interpreter_kind: InterpreterKind::CPython,
abiflags: "".to_string(),
ext_suffix: "".to_string(),
pointer_width: None,
gil_disabled: false,
},
executable: PathBuf::new(),
platform: None,
runnable: false,
implementation_name: "cpython".to_string(),
soabi: None,
}])
} else if target.cross_compiling() {
let mut interps = Vec::with_capacity(found_interpreters.len());
let mut pypys = Vec::new();
for interp in found_interpreters {
if interp.interpreter_kind.is_pypy() {
pypys.push(PathBuf::from(format!(
"pypy{}.{}",
interp.major, interp.minor
)));
} else {
interps.push(interp);
}
}
// cross compiling to PyPy with abi3 feature enabled,
// we cannot use host pypy so switch to bundled sysconfig instead
if !pypys.is_empty() {
interps.extend(find_interpreter_in_sysconfig(
bridge,
&pypys,
target,
requires_python,
)?)
}
if interps.is_empty() {
bail!("Failed to find any python interpreter");
}
Ok(interps)
} else {
if found_interpreters.is_empty() {
bail!("Failed to find any python interpreter");
} else if target.cross_compiling() {
let mut interps = Vec::with_capacity(found_interpreters.len());
let mut pypys = Vec::new();
for interp in found_interpreters {
if interp.interpreter_kind.is_pypy() {
pypys.push(PathBuf::from(format!(
"pypy{}.{}",
interp.major, interp.minor
)));
} else {
interps.push(interp);
}
Ok(found_interpreters)
}
// cross compiling to PyPy with abi3 feature enabled,
// we cannot use host pypy so switch to bundled sysconfig instead
if !pypys.is_empty() {
interps.extend(find_interpreter_in_sysconfig(
bridge,
&pypys,
target,
requires_python,
)?)
}
if interps.is_empty() {
bail!("Failed to find any python interpreter");
}
Ok(interps)
} else if !found_interpreters.is_empty() {
let interpreters_str = found_interpreters
.iter()
.map(ToString::to_string)
.collect::<Vec<String>>()
.join(", ");
eprintln!("🐍 Found {interpreters_str}");

Ok(found_interpreters)
} else if self.interpreter.is_empty() {
eprintln!("🐍 Not using a specific python interpreter");
// Fake one to make `BuildContext::build_wheels` happy for abi3 when no cpython/pypy found on host
// The python interpreter config doesn't matter, as it's not used for anything
Ok(vec![PythonInterpreter {
config: InterpreterConfig {
major: *major as usize,
minor: *minor as usize,
interpreter_kind: InterpreterKind::CPython,
abiflags: "".to_string(),
ext_suffix: "".to_string(),
pointer_width: None,
gil_disabled: false,
},
executable: PathBuf::new(),
platform: None,
runnable: false,
implementation_name: "cpython".to_string(),
soabi: None,
}])
} else {
bail!("Failed to find any python interpreter");
}
}
}
Expand Down
Loading