summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3-maturin/0001-Extract-extension-architecture-name-resolvation-code.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python3-maturin/0001-Extract-extension-architecture-name-resolvation-code.patch')
-rw-r--r--meta/recipes-devtools/python/python3-maturin/0001-Extract-extension-architecture-name-resolvation-code.patch107
1 files changed, 107 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-maturin/0001-Extract-extension-architecture-name-resolvation-code.patch b/meta/recipes-devtools/python/python3-maturin/0001-Extract-extension-architecture-name-resolvation-code.patch
new file mode 100644
index 0000000000..f75d5a1ba8
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-maturin/0001-Extract-extension-architecture-name-resolvation-code.patch
@@ -0,0 +1,107 @@
1From 42a97ee7100ad158d4b1ba6133ea13cc864a567f Mon Sep 17 00:00:00 2001
2From: =?UTF-8?q?Vesa=20J=C3=A4=C3=A4skel=C3=A4inen?=
3 <vesa.jaaskelainen@vaisala.com>
4Date: Sun, 1 Sep 2024 09:23:10 +0300
5Subject: [PATCH 1/5] Extract extension architecture name resolvation code as
6 helper
7MIME-Version: 1.0
8Content-Type: text/plain; charset=UTF-8
9Content-Transfer-Encoding: 8bit
10
11This commit introduces helper InterpreterConfig.get_python_ext_arch() that
12can be used to determine the extension architecture name python uses in
13`ext_suffix` for this architecture.
14
15Upstream-Status: Backport [https://github.com/PyO3/maturin/commit/42a97ee7100ad158d4b1ba6133ea13cc864a567f]
16
17Signed-off-by: Vesa Jääskeläinen <vesa.jaaskelainen@vaisala.com>
18---
19 src/python_interpreter/config.rs | 18 ++++++------------
20 src/target.rs | 16 ++++++++++++++++
21 2 files changed, 22 insertions(+), 12 deletions(-)
22
23diff --git a/src/python_interpreter/config.rs b/src/python_interpreter/config.rs
24index 912f9218..d76606f2 100644
25--- a/src/python_interpreter/config.rs
26+++ b/src/python_interpreter/config.rs
27@@ -47,15 +47,7 @@ impl InterpreterConfig {
28 // Python 2 is not supported
29 return None;
30 }
31- let python_arch = if matches!(target.target_arch(), Arch::Armv6L | Arch::Armv7L) {
32- "arm"
33- } else if matches!(target.target_arch(), Arch::Powerpc64Le) && python_impl == PyPy {
34- "ppc_64"
35- } else if matches!(target.target_arch(), Arch::X86) && python_impl == PyPy {
36- "x86"
37- } else {
38- target.get_python_arch()
39- };
40+ let python_ext_arch = target.get_python_ext_arch(python_impl);
41 // See https://github.com/pypa/auditwheel/issues/349
42 let target_env = match python_impl {
43 CPython => {
44@@ -77,7 +69,7 @@ impl InterpreterConfig {
45 let ldversion = format!("{}{}{}", major, minor, abiflags);
46 let ext_suffix = format!(
47 ".cpython-{}-{}-linux-{}.so",
48- ldversion, python_arch, target_env
49+ ldversion, python_ext_arch, target_env
50 );
51 Some(Self {
52 major,
53@@ -90,7 +82,8 @@ impl InterpreterConfig {
54 }
55 (Os::Linux, PyPy) => {
56 let abi_tag = format!("pypy{}{}-{}", major, minor, PYPY_ABI_TAG);
57- let ext_suffix = format!(".{}-{}-linux-{}.so", abi_tag, python_arch, target_env);
58+ let ext_suffix =
59+ format!(".{}-{}-linux-{}.so", abi_tag, python_ext_arch, target_env);
60 Some(Self {
61 major,
62 minor,
63@@ -204,7 +197,8 @@ impl InterpreterConfig {
64 }
65 (Os::Emscripten, CPython) => {
66 let ldversion = format!("{}{}", major, minor);
67- let ext_suffix = format!(".cpython-{}-{}-emscripten.so", ldversion, python_arch);
68+ let ext_suffix =
69+ format!(".cpython-{}-{}-emscripten.so", ldversion, python_ext_arch);
70 Some(Self {
71 major,
72 minor,
73diff --git a/src/target.rs b/src/target.rs
74index dc7df0cf..84bae559 100644
75--- a/src/target.rs
76+++ b/src/target.rs
77@@ -1,4 +1,5 @@
78 use crate::cross_compile::is_cross_compiling;
79+use crate::python_interpreter::InterpreterKind;
80 use crate::PlatformTag;
81 use anyhow::{anyhow, bail, format_err, Result};
82 use platform_info::*;
83@@ -368,6 +369,21 @@ impl Target {
84 }
85 }
86
87+ /// Returns the extension architecture name python uses in `ext_suffix` for this architecture.
88+ pub fn get_python_ext_arch(&self, python_impl: InterpreterKind) -> &str {
89+ if matches!(self.target_arch(), Arch::Armv6L | Arch::Armv7L) {
90+ "arm"
91+ } else if matches!(self.target_arch(), Arch::Powerpc64Le)
92+ && python_impl == InterpreterKind::PyPy
93+ {
94+ "ppc_64"
95+ } else if matches!(self.target_arch(), Arch::X86) && python_impl == InterpreterKind::PyPy {
96+ "x86"
97+ } else {
98+ self.get_python_arch()
99+ }
100+ }
101+
102 /// Returns the name python uses in `sys.platform` for this os
103 pub fn get_python_os(&self) -> &str {
104 match self.os {
105--
1062.34.1
107