Skip to content

Commit

Permalink
Merge #1560
Browse files Browse the repository at this point in the history
1560: Fix wrong `EXT_SUFFIX` when cross compiling musllinux wheels for Python 3.11 r=messense a=messense

Fixes #1559 

Co-authored-by: messense <[email protected]>
  • Loading branch information
bors[bot] and messense authored Apr 5, 2023
2 parents ff8805e + 14a5222 commit 0bb815b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 16 deletions.
1 change: 1 addition & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Bump MSRV to 1.64.0 in [#1528](https://github.com/PyO3/maturin/pull/1528)
* Add wildcards support to publish/upload commands on Windows in [#1534](https://github.com/PyO3/maturin/pull/1534)
* Add support for configuring macOS deployment target version in `pyproject.toml` in [#1536](https://github.com/PyO3/maturin/pull/1536)
* Fix wrong `EXT_SUFFIX` when cross compiling musllinux wheels for Python 3.11 in [#1560](https://github.com/PyO3/maturin/pull/1560)

## [0.14.16] - 2023-03-26

Expand Down
13 changes: 4 additions & 9 deletions src/build_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1149,15 +1149,10 @@ fn find_interpreter_in_sysconfig(
let ver_minor = ver_minor.parse::<usize>().with_context(|| {
format!("Invalid python interpreter minor version '{ver_minor}', expect a digit")
})?;
let sysconfig = InterpreterConfig::lookup(
target.target_os(),
target.target_arch(),
python_impl,
(ver_major, ver_minor),
)
.with_context(|| {
format!("Failed to find a {python_impl} {ver_major}.{ver_minor} interpreter")
})?;
let sysconfig = InterpreterConfig::lookup(target, python_impl, (ver_major, ver_minor))
.with_context(|| {
format!("Failed to find a {python_impl} {ver_major}.{ver_minor} interpreter")
})?;
debug!(
"Found {} {}.{} in bundled sysconfig",
sysconfig.interpreter_kind, sysconfig.major, sysconfig.minor,
Expand Down
26 changes: 19 additions & 7 deletions src/python_interpreter/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,16 +75,28 @@ pub struct InterpreterConfig {
impl InterpreterConfig {
/// Lookup a wellknown sysconfig for a given Python interpreter
pub fn lookup(
os: Os,
arch: Arch,
target: &Target,
python_impl: InterpreterKind,
python_version: (usize, usize),
) -> Option<&'static Self> {
) -> Option<Self> {
let (major, minor) = python_version;
if let Some(os_sysconfigs) = WELLKNOWN_SYSCONFIG.get(&os) {
if let Some(sysconfigs) = os_sysconfigs.get(&arch) {
return sysconfigs.iter().find(|s| {
s.interpreter_kind == python_impl && s.major == major && s.minor == minor
if let Some(os_sysconfigs) = WELLKNOWN_SYSCONFIG.get(&target.target_os()) {
if let Some(sysconfigs) = os_sysconfigs.get(&target.target_arch()) {
return sysconfigs.iter().find_map(|s| {
if s.interpreter_kind == python_impl && s.major == major && s.minor == minor {
if python_version >= (3, 11) && target.is_musl_target() {
// See https://github.com/pypa/auditwheel/issues/349
let mut musl_config = s.clone();
musl_config.ext_suffix = s
.ext_suffix
.replace("-gnu", &format!("-{}", target.target_env()));
Some(musl_config)
} else {
Some(s.clone())
}
} else {
None
}
});
}
}
Expand Down

0 comments on commit 0bb815b

Please sign in to comment.