diff options
Diffstat (limited to 'meta/recipes-devtools/python/python3-maturin/0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch')
| -rw-r--r-- | meta/recipes-devtools/python/python3-maturin/0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-maturin/0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch b/meta/recipes-devtools/python/python3-maturin/0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch new file mode 100644 index 0000000000..b4a7f69492 --- /dev/null +++ b/meta/recipes-devtools/python/python3-maturin/0003-Extract-extension-ABI-name-resolvation-code-as-helpe.patch | |||
| @@ -0,0 +1,98 @@ | |||
| 1 | From fa64426f3a98a0455721c23ec86bd2240708b45e Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Vesa=20J=C3=A4=C3=A4skel=C3=A4inen?= | ||
| 3 | <vesa.jaaskelainen@vaisala.com> | ||
| 4 | Date: Sun, 1 Sep 2024 15:55:07 +0300 | ||
| 5 | Subject: [PATCH 3/5] Extract extension ABI name resolvation code as helper | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | This commit introduces helper InterpreterConfig.get_python_target_env() | ||
| 11 | that can be used to determine the extension ABI python uses in | ||
| 12 | `ext_suffix` for this architecture. | ||
| 13 | |||
| 14 | Upstream-Status: Backport [https://github.com/PyO3/maturin/commit/fa64426f3a98a0455721c23ec86bd2240708b45e] | ||
| 15 | |||
| 16 | Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com> | ||
| 17 | --- | ||
| 18 | src/python_interpreter/config.rs | 19 ++----------------- | ||
| 19 | src/target.rs | 20 ++++++++++++++++++++ | ||
| 20 | 2 files changed, 22 insertions(+), 17 deletions(-) | ||
| 21 | |||
| 22 | diff --git a/src/python_interpreter/config.rs b/src/python_interpreter/config.rs | ||
| 23 | index 5736aedc..938e9955 100644 | ||
| 24 | --- a/src/python_interpreter/config.rs | ||
| 25 | +++ b/src/python_interpreter/config.rs | ||
| 26 | @@ -48,17 +48,7 @@ impl InterpreterConfig { | ||
| 27 | return None; | ||
| 28 | } | ||
| 29 | let python_ext_arch = target.get_python_ext_arch(python_impl); | ||
| 30 | - // See https://github.com/pypa/auditwheel/issues/349 | ||
| 31 | - let target_env = match python_impl { | ||
| 32 | - CPython => { | ||
| 33 | - if python_version >= (3, 11) { | ||
| 34 | - target.target_env().to_string() | ||
| 35 | - } else { | ||
| 36 | - target.target_env().to_string().replace("musl", "gnu") | ||
| 37 | - } | ||
| 38 | - } | ||
| 39 | - PyPy | GraalPy => "gnu".to_string(), | ||
| 40 | - }; | ||
| 41 | + let target_env = target.get_python_target_env(python_impl, python_version); | ||
| 42 | match (target.target_os(), python_impl) { | ||
| 43 | (Os::Linux, CPython) => { | ||
| 44 | let abiflags = if python_version < (3, 8) { | ||
| 45 | @@ -294,12 +284,7 @@ impl InterpreterConfig { | ||
| 46 | }; | ||
| 47 | let file_ext = if target.is_windows() { "pyd" } else { "so" }; | ||
| 48 | let ext_suffix = if target.is_linux() || target.is_macos() { | ||
| 49 | - // See https://github.com/pypa/auditwheel/issues/349 | ||
| 50 | - let target_env = if (major, minor) >= (3, 11) { | ||
| 51 | - target.target_env().to_string() | ||
| 52 | - } else { | ||
| 53 | - target.target_env().to_string().replace("musl", "gnu") | ||
| 54 | - }; | ||
| 55 | + let target_env = target.get_python_target_env(interpreter_kind, (major, minor)); | ||
| 56 | match interpreter_kind { | ||
| 57 | InterpreterKind::CPython => ext_suffix.unwrap_or_else(|| { | ||
| 58 | // Eg: .cpython-38-x86_64-linux-gnu.so | ||
| 59 | diff --git a/src/target.rs b/src/target.rs | ||
| 60 | index 84bae559..ad8ebaba 100644 | ||
| 61 | --- a/src/target.rs | ||
| 62 | +++ b/src/target.rs | ||
| 63 | @@ -1,5 +1,6 @@ | ||
| 64 | use crate::cross_compile::is_cross_compiling; | ||
| 65 | use crate::python_interpreter::InterpreterKind; | ||
| 66 | +use crate::python_interpreter::InterpreterKind::{CPython, GraalPy, PyPy}; | ||
| 67 | use crate::PlatformTag; | ||
| 68 | use anyhow::{anyhow, bail, format_err, Result}; | ||
| 69 | use platform_info::*; | ||
| 70 | @@ -384,6 +385,25 @@ impl Target { | ||
| 71 | } | ||
| 72 | } | ||
| 73 | |||
| 74 | + /// Returns the environment python uses in `ext_suffix` for this architecture. | ||
| 75 | + pub fn get_python_target_env( | ||
| 76 | + &self, | ||
| 77 | + python_impl: InterpreterKind, | ||
| 78 | + python_version: (usize, usize), | ||
| 79 | + ) -> String { | ||
| 80 | + match python_impl { | ||
| 81 | + CPython => { | ||
| 82 | + // For musl handling see https://github.com/pypa/auditwheel/issues/349 | ||
| 83 | + if python_version >= (3, 11) { | ||
| 84 | + self.target_env().to_string() | ||
| 85 | + } else { | ||
| 86 | + self.target_env().to_string().replace("musl", "gnu") | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + PyPy | GraalPy => "gnu".to_string(), | ||
| 90 | + } | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | /// Returns the name python uses in `sys.platform` for this os | ||
| 94 | pub fn get_python_os(&self) -> &str { | ||
| 95 | match self.os { | ||
| 96 | -- | ||
| 97 | 2.34.1 | ||
| 98 | |||
