Message ID | 20220304152827.31576-1-jsbronder@cold-front.org |
---|---|
State | New |
Headers | show |
Series | [meta-python] python3-crc32c: set target platform via setup.cfg | expand |
On Fri, Mar 4, 2022 at 7:28 AM Justin Bronder <jsbronder@cold-front.org> wrote: > > 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 > > Signed-off-by: Justin Bronder <jsbronder@cold-front.org> > --- > ...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 > > diff --git a/meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch b/meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch > deleted file mode 100644 > index b534c05e9a..0000000000 > --- a/meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch > +++ /dev/null > @@ -1,34 +0,0 @@ > -From 855428feb14c44762ea21a18b05638e3e6266ab5 Mon Sep 17 00:00:00 2001 > -From: Khem Raj <raj.khem@gmail.com> > -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 <raj.khem@gmail.com> > ---- > - 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) > diff --git a/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb b/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb > index 78e14e1d2f..4f6a3aba99 100644 > --- a/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb > +++ b/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb > @@ -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 > +} I think this is better since it avoid maintaining a patch, I will take this one if this passes the CI > > RDEPENDS:${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: openembedded-devel+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [raj.khem@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- >
diff --git a/meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch b/meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch deleted file mode 100644 index b534c05e9a..0000000000 --- a/meta-python/recipes-devtools/python/python3-crc32c/0001-setup.py-Fix-determining-target-platform.patch +++ /dev/null @@ -1,34 +0,0 @@ -From 855428feb14c44762ea21a18b05638e3e6266ab5 Mon Sep 17 00:00:00 2001 -From: Khem Raj <raj.khem@gmail.com> -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 <raj.khem@gmail.com> ---- - 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) diff --git a/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb b/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb index 78e14e1d2f..4f6a3aba99 100644 --- a/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb +++ b/meta-python/recipes-devtools/python/python3-crc32c_2.2.post0.bb @@ -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"
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 Signed-off-by: Justin Bronder <jsbronder@cold-front.org> --- ...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