Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

propagate abiflags to wheel name on Windows #2325

Merged
merged 5 commits into from
Nov 28, 2024
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
9 changes: 6 additions & 3 deletions src/python_interpreter/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ impl InterpreterConfig {
})
}
(Os::Windows, CPython) => {
let abiflags = if python_version < (3, 8) {
"m".to_string()
} else {
abiflags.to_string()
};
let ext_suffix = if python_version < (3, 8) {
".pyd".to_string()
} else {
Expand All @@ -135,8 +140,7 @@ impl InterpreterConfig {
major,
minor,
interpreter_kind: CPython,
// abiflags is always empty on Windows
abiflags: String::new(),
abiflags,
ext_suffix,
pointer_width: Some(target.pointer_width()),
gil_disabled,
Expand All @@ -152,7 +156,6 @@ impl InterpreterConfig {
major,
minor,
interpreter_kind: PyPy,
// abiflags is always empty on Windows
abiflags: String::new(),
ext_suffix,
pointer_width: Some(target.pointer_width()),
Expand Down
40 changes: 21 additions & 19 deletions src/python_interpreter/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub use self::config::InterpreterConfig;
use crate::auditwheel::PlatformTag;
use crate::{BridgeModel, BuildContext, Target};
use anyhow::{bail, format_err, Context, Result};
use anyhow::{bail, ensure, format_err, Context, Result};
use pep440_rs::{Version, VersionSpecifiers};
use regex::Regex;
use serde::Deserialize;
Expand Down Expand Up @@ -427,7 +427,19 @@ fn fun_with_abiflags(
Ok("".to_string())
} else if message.system == "windows" {
if matches!(message.abiflags.as_deref(), Some("") | None) {
Ok("".to_string())
// windows has a few annoying cases, but its abiflags in sysconfig always empty
// python <= 3.7 has "m"
if message.minor <= 7 {
Ok("m".to_string())
} else if message.gil_disabled {
ensure!(
message.minor >= 13,
"gil_disabled is only available in python 3.13+ ಠ_ಠ"
);
Ok("t".to_string())
} else {
Ok("".to_string())
}
} else {
bail!("A python 3 interpreter on Windows does not define abiflags in its sysconfig ಠ_ಠ")
}
Expand Down Expand Up @@ -499,23 +511,13 @@ impl PythonInterpreter {
} else {
match self.interpreter_kind {
InterpreterKind::CPython => {
if target.is_unix() {
format!(
"cp{major}{minor}-cp{major}{minor}{abiflags}-{platform}",
major = self.major,
minor = self.minor,
abiflags = self.abiflags,
platform = platform
)
} else {
// On windows the abiflags are missing, but this seems to work
format!(
"cp{major}{minor}-none-{platform}",
major = self.major,
minor = self.minor,
platform = platform
)
}
format!(
"cp{major}{minor}-cp{major}{minor}{abiflags}-{platform}",
major = self.major,
minor = self.minor,
abiflags = self.abiflags,
platform = platform
)
}
InterpreterKind::PyPy => {
// pypy uses its version as part of the ABI, e.g.
Expand Down
Loading