Skip to contentSkip to conversation

python3-pycocotools: Downgrade numpy version needed to 1.x

PATCH New Khem Raj 1 participant 2 messages Aug 24, 2024

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/2 python3-pycocotools: Downgrade numpy version needed to 1.x

This is needed for it to build with PEP-517 backend, older backend ignored the version

---
 ...01-downgrade-numpy-version-to-1.26.4.patch | 26 +++++++++++++++++++
 .../python/python3-pycocotools_2.0.8.bb       |  2 ++
 2 files changed, 28 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pycocotools/0001-downgrade-numpy-version-to-1.26.4.patch
meta-python/recipes-devtools/python/python3-pycocotools/0001-downgrade-numpy-version-to-1.26.4.patch new file +26 -0
new file mode 100644
index 0000000000..cd3e462ddf
@@ -0,0 +1,26 @@
+From 7222a8b9b6e05b89116ca14644aa8db79eecd3c6 Mon Sep 17 00:00:00 2001
+From: Khem Raj <[email protected]>
+Date: Sat, 24 Aug 2024 00:19:23 -0700
+Subject: [PATCH] downgrade numpy version to 1.26.4+
+
+We can drop it when OE-core upgrades numpy to 2.x
+
+Upstream-Status: Inappropriate [OE workaround]
+Signed-off-by: Khem Raj <[email protected]>
+---
+ pyproject.toml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pyproject.toml b/pyproject.toml
+index 1bfbd91..cbee520 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -1,7 +1,7 @@
+ [build-system]
+ requires = [
+     "cython>=0.27.3",
+-    "numpy>=2.0.0rc1",
++    "numpy>=1.26.4",
+     "setuptools>=43.0.0",
+     "wheel",
+ ]
meta-python/recipes-devtools/python/python3-pycocotools_2.0.8.bb +2 -0
index 47c750104e..7226f0fb81 100644
@@ -5,6 +5,8 @@ LIC_FILES_CHKSUM = "file://pycocotools/coco.py;beginline=45;endline=45;md5=12cb5
 
 inherit pypi python_setuptools_build_meta
 
+SRC_URI += "file://0001-downgrade-numpy-version-to-1.26.4.patch"
+
 SRC_URI[sha256sum] = "8f2bcedb786ba26c367a3680f9c4eb5b2ad9dccb2b34eaeb205e0a021e1dfb8d"
 
 DEPENDS = "python3-cython-native python3-numpy-native virtual/crypt"
author
#1 lore raw

PATCH 2/2 python3-pycocotools: Remove absolute paths from comments

_mask.c is generated by cython and encodes sourcepaths into comments which are absolute. Edit them out.

Fixes buildpaths QA errors

---
 .../recipes-devtools/python/python3-pycocotools_2.0.8.bb      | 4 ++++
 1 file changed, 4 insertions(+)
meta-python/recipes-devtools/python/python3-pycocotools_2.0.8.bb +4 -0
index 7226f0fb81..4d4251316c 100644
@@ -11,3 +11,7 @@ SRC_URI[sha256sum] = "8f2bcedb786ba26c367a3680f9c4eb5b2ad9dccb2b34eaeb205e0a021e
 
 DEPENDS = "python3-cython-native python3-numpy-native virtual/crypt"
 RDEPENDS:${PN} = "python3-matplotlib python3-pillow python3-profile"
+
+do_compile:append() {
+    sed -i -e "/BEGIN: Cython Metadata/,/END: Cython Metadata/d" ${B}/pycocotools/_mask.c
+}