From c27553adfa030cf9c5bb218cc7391f4836d017b9 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Thu, 6 Jun 2024 12:37:24 -0700 Subject: [PATCH 1/2] Override wheel tag with _PYTHON_HOST_PLATFORM --- src/build_context.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/build_context.rs b/src/build_context.rs index 9e84a3604..3cb0b1b86 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -519,6 +519,10 @@ impl BuildContext { /// Returns the platform part of the tag for the wheel name pub fn get_platform_tag(&self, platform_tags: &[PlatformTag]) -> Result { + if let Some(host_platform) = env::var("_PYTHON_HOST_PLATFORM").ok() { + return Ok(host_platform.replace(['.', '-'], "_")); + } + let target = &self.target; let tag = match (&target.target_os(), &target.target_arch()) { // Windows From 2ee0337e92f9872d259b19f008ac5c9ad24bdcb8 Mon Sep 17 00:00:00 2001 From: Feodor Fitsner Date: Wed, 26 Jun 2024 09:42:08 -0700 Subject: [PATCH 2/2] Fix linting --- src/build_context.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/build_context.rs b/src/build_context.rs index 3cb0b1b86..91faf4f0d 100644 --- a/src/build_context.rs +++ b/src/build_context.rs @@ -519,7 +519,7 @@ impl BuildContext { /// Returns the platform part of the tag for the wheel name pub fn get_platform_tag(&self, platform_tags: &[PlatformTag]) -> Result { - if let Some(host_platform) = env::var("_PYTHON_HOST_PLATFORM").ok() { + if let Ok(host_platform) = env::var("_PYTHON_HOST_PLATFORM") { return Ok(host_platform.replace(['.', '-'], "_")); }