python3-crc32c: set target platform via setup.cfg
PATCH 1/1 python3-crc32c: set target platform via setup.cfg
Looks like we're not the first to need to specify the target platform when building this package. According to upstream, we can just update setup.cfg instead of patching setup.py.
https://github.com/ICRAR/crc32c/pull/10
--- ...p.py-Fix-determining-target-platform.patch | 34 ------------------- .../python/python3-crc32c_2.2.post0.bb | 7 ++-- 2 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch
meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch deleted +0 -34
@@ -1,34 +0,0 @@ -From 855428feb14c44762ea21a18b05638e3e6266ab5 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Thu, 3 Mar 2022 23:50:30 -0800 -Subject: [PATCH] setup.py: Fix determining target platform - -Do not poke at the build machine to determine target platform or architecture -pass it from environment instead for cross compiling to work - -Upstream-Status: Inappropriate [OE-Specific] -Signed-off-by: Khem Raj <[email protected]> ---- - setup.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/setup.py -+++ b/setup.py -@@ -20,6 +20,7 @@ - # MA 02111-1307 USA - # - import glob -+import os - import platform - - import distutils.ccompiler -@@ -58,7 +59,8 @@ class _build_ext(build_ext): - - def run(self): - assert(len(self.distribution.ext_modules) == 1) -- platform = self.platform.lower() -+ platform = os.environ.get('PLATFORM', 'True') -+ - is_intel = platform in ['x86_64', 'amd64', 'i386', 'i686'] - is_arm = platform in ['aarch64_be', 'aarch64', 'armv8b', 'armv8l'] - distutils.log.info("platform: %s, is_intel: %d, is_arm: %d", platform, is_intel, is_arm)
meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb +5 -2
@@ -9,11 +9,14 @@ LIC_FILES_CHKSUM = " \ file://crc32c_adler.c;startline=9;endline=24;md5=c60e6e55d0e5d95effa6fad27db0711a \ " -SRC_URI += "file://0001-setup.py-Fix-determining-target-platform.patch" SRC_URI[sha256sum] = "3d058e7a5e37e4985d1a7ad4cb702bca56b490daa658d4851377d13ead8b435e" inherit pypi setuptools3 -export PLATFORM = "${TARGET_ARCH}" +do_compile:prepend() { + if ! grep 'platform =' setup.cfg; then + printf "[build_ext]\nplatform = ${TARGET_ARCH}" >> setup.cfg + fi +} RDEPENDS:${PN} += "python3-core"
Signature · 1 line
2.35.1
Quoted 62 lines · Justin Bronder
Looks like we're not the first to need to specify the target platform when building this package. According to upstream, we can just update setup.cfg instead of patching
setup.py.
https://github.com/ICRAR/crc32c/pull/10Signed-off-by Justin Bronder <[email protected]>--- ...p.py-Fix-determining-target-platform.patch | 34 ------------------- .../python/python3-crc32c_2.2.post0.bb | 7 ++-- 2 files changed, 5 insertions(+), 36 deletions(-) delete mode 100644 meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patchmeta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch deleted +0
-34@@ -1,34 +0,0 @@ -From 855428feb14c44762ea21a18b05638e3e6266ab5 Mon Sep 17 00:00:00 2001 -From: Khem Raj <[email protected]> -Date: Thu, 3 Mar 2022 23:50:30 -0800 -Subject: [PATCH] setup.py: Fix determining target platform - -Do not poke at the build machine to determine target platform or architecture -pass it from environment instead for cross compiling to work - -Upstream-Status: Inappropriate [OE-Specific] -Signed-off-by: Khem Raj <[email protected]> ---- - setup.py | 3 ++- - 1 file changed, 2 insertions(+), 1 deletion(-) - ---- a/setup.py -+++ b/setup.py -@@ -20,6 +20,7 @@ - # MA 02111-1307 USA - # - import glob -+import os - import platform - - import distutils.ccompiler -@@ -58,7 +59,8 @@ class _build_ext(build_ext): - - def run(self): - assert(len(self.distribution.ext_modules) == 1) -- platform = self.platform.lower() -+ platform = os.environ.get('PLATFORM', 'True') -+ - is_intel = platform in ['x86_64', 'amd64', 'i386', 'i686'] - is_arm = platform in ['aarch64_be', 'aarch64', 'armv8b', 'armv8l'] - distutils.log.info("platform: %s, is_intel: %d, is_arm: %d", platform, is_intel, is_arm)meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb +0
-1@@ -9,11 +9,14 @@ LIC_FILES_CHKSUM = " \ file://crc32c_adler.c;startline=9;endline=24;md5=c60e6e55d0e5d95effa6fad27db0711a \ " -SRC_URI += "file://0001-setup.py-Fix-determining-target-platform.patch"
meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb LIC_FILES_CHKSUM = " \ · line 20
Quoted 10 lines
meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb +5
-1SRC_URI[sha256sum] = "3d058e7a5e37e4985d1a7ad4cb702bca56b490daa658d4851377d13ead8b435e" inherit pypi setuptools3 -export PLATFORM = "${TARGET_ARCH}" +do_compile:prepend() { + if ! grep 'platform =' setup.cfg; then + printf "[build_ext]\nplatform = ${TARGET_ARCH}" >> setup.cfg + fi +}
I think this is better since it avoid maintaining a patch, I will take this one if this passes the CI
Quoted 14 lines
meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb +0
-1RDEPENDS:${PN} += "python3-core" --2.35.1
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#95788): https://lists.openembedded.org/g/openembedded-devel/message/95788
Mute This Topic: https://lists.openembedded.org/mt/89551016/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-