Skip to contentSkip to conversation

python3-legacy-cgi: introduce recipe

PATCH In review Awais Belal 2 participants 3 messages Mar 12, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 python3-legacy-cgi: introduce recipe

With the cgi module being dropped in python3.13 a stop gap solution for modules relying on cgi is to use the legacy-cgi module. Introduce the recipe so it could be leveraged in the upcoming changes.

---
 ...py-fixup-interpreter-according-to-OE.patch | 28 +++++++++++++++++++
 .../python/python3-legacy-cgi_2.6.2.bb        | 22 +++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-legacy-cgi_2.6.2.bb
meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch new file +28 -0
new file mode 100644
index 0000000000..0af8ef4842
@@ -0,0 +1,28 @@
+From eaa9964cd6d22564fa5f1270d194eb65ebaef57c Mon Sep 17 00:00:00 2001
+From: Your Name <[email protected]>
+Date: Wed, 12 Mar 2025 17:44:39 +0000
+Subject: [PATCH] cgi.py: fixup interpreter according to OE
+
+The underlying distribution is required to update the interpreter
+by design. This can be referenced from the notice that is found
+on top of the same file being patched here.
+
+Upstream-Status: Inappropriate [OE specific]
+Signed-off-by: Awais Belal <[email protected]>
+---
+ cgi.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cgi.py b/cgi.py
+index 22897a1..f86db84 100755
+--- a/cgi.py
++++ b/cgi.py
+@@ -1,4 +1,4 @@
+-#! /usr/local/bin/python
++#!/usr/bin/env python
+ 
+ # NOTE: the above "/usr/local/bin/python" is NOT a mistake.  It is
+ # intentionally NOT "/usr/bin/env python".  On many systems
+-- 
+2.43.0
+
meta-python/recipes-devtools/python/python3-legacy-cgi_2.6.2.bb new file +22 -0
new file mode 100644
index 0000000000..2b2840ae14
@@ -0,0 +1,22 @@
+SUMMARY = "Fork of the standard library cgi and cgitb modules, being deprecated in PEP-594"
+HOMEPAGE = "https://github.com/jackrosenthal/legacy-cgi"
+LICENSE = "PSF-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4b8801e752a2c70ac41a5f9aa243f766"
+
+PYPI_PACKAGE = "legacy_cgi"
+
+inherit python_poetry_core pypi
+
+SRC_URI += "\
+    file://0001-cgi.py-fixup-interpreter-according-to-OE.patch \
+"
+
+DEPENDS += "\
+    ${PYTHON_PN}-setuptools-scm-native \
+"
+
+#RDEPENDS:${PN} = "python3-core"
+
+BBCLASSEXTEND = "native nativesdk"
+
+SRC_URI[sha256sum] = "9952471ceb304043b104c22d00b4f333cac27a6abe446d8a528fc437cf13c85f"
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 python3-cheetah: fixup native RDEPENDS

cheetah-native is used while building mongodb and a build failure for mongodb identifies that the current version of cheetah templates requires the cgi module. The following is seen

Quoted 7 lines

| from Cheetah.Template import Template
| File "/srv/pokybuild/yocto-worker/meta-oe/build/build/tmp/work/core2-64-poky-linux/mongodb/4.4.29/recipe-sysroot-native/usr/lib/python3.13/site-packages/Cheetah/Template.py", line 24, in <module>

| import cgi # Used by .webInput() if the template is a CGI script.
| ^^^^^^^^^^
| ModuleNotFoundError: No module named 'cgi'

This is fixed by utilizing the legacy-cgi module.

---
 .../recipes-devtools/python/python3-cheetah_3.2.6.post1.bb      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
meta-python/recipes-devtools/python/python3-cheetah_3.2.6.post1.bb +1 -1
index 6cba6b3adf..e7b404cd8f 100644
@@ -9,7 +9,7 @@ UPSTREAM_CHECK_PYPI_PACKAGE = "${PYPI_PACKAGE}"
 inherit pypi setuptools3
 
 RDEPENDS:${PN} = "python3-pickle python3-pprint"
-RDEPENDS:${PN}:class-native = ""
+RDEPENDS:${PN}:class-native = "python3-legacy-cgi-native"
 
 BBCLASSEXTEND = "native nativesdk"
 
Signature · 1 line
2.34.1
#2 lore raw
In reply to Awais Belal
Quoted 20 lines · Awais Belal via lists.openembedded.org

With the cgi module being dropped in python3.13 a stop gap solution for modules relying on cgi is to use the legacy-cgi module. Introduce the recipe so it could be leveraged in the upcoming changes.

---
 ...py-fixup-interpreter-according-to-OE.patch | 28 +++++++++++++++++++
 .../python/python3-legacy-cgi_2.6.2.bb        | 22 +++++++++++++++
 2 files changed, 50 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch
 create mode 100644 meta-python/recipes-devtools/python/python3-legacy-cgi_2.6.2.bb
meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch new file +0 -0
new file mode 100644
index 0000000000..0af8ef4842

meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch line 10

Quoted 10 lines
meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch new file +10 -0
@@ -0,0 +1,28 @@
+From eaa9964cd6d22564fa5f1270d194eb65ebaef57c Mon Sep 17 00:00:00 2001
+From: Your Name <[email protected]>
+Date: Wed, 12 Mar 2025 17:44:39 +0000
+Subject: [PATCH] cgi.py: fixup interpreter according to OE
+
+The underlying distribution is required to update the interpreter
+by design. This can be referenced from the notice that is found
+on top of the same file being patched here.
+
+Upstream-Status: Inappropriate [OE specific]

I think you could try sending this patch upstream, it should make things better for the legacy-cgi project.

Quoted 58 lines
meta-python/recipes-devtools/python/python3-legacy-cgi/0001-cgi.py-fixup-interpreter-according-to-OE.patch new file +18 -0
+Signed-off-by: Awais Belal <[email protected]>
+---
+ cgi.py | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/cgi.py b/cgi.py
+index 22897a1..f86db84 100755
+--- a/cgi.py
++++ b/cgi.py
+@@ -1,4 +1,4 @@
+-#! /usr/local/bin/python
++#!/usr/bin/env python
+
+ # NOTE: the above "/usr/local/bin/python" is NOT a mistake.  It is
+ # intentionally NOT "/usr/bin/env python".  On many systems
+--
+2.43.0
+
meta-python/recipes-devtools/python/python3-legacy-cgi_2.6.2.bb new file +22 -1
new file mode 100644
index 0000000000..2b2840ae14
@@ -0,0 +1,22 @@
+SUMMARY = "Fork of the standard library cgi and cgitb modules, being deprecated in PEP-594"
+HOMEPAGE = "https://github.com/jackrosenthal/legacy-cgi"
+LICENSE = "PSF-2.0"
+LIC_FILES_CHKSUM = "file://LICENSE;md5=4b8801e752a2c70ac41a5f9aa243f766"
+
+PYPI_PACKAGE = "legacy_cgi"
+
+inherit python_poetry_core pypi
+
+SRC_URI += "\
+    file://0001-cgi.py-fixup-interpreter-according-to-OE.patch \
+"
+
+DEPENDS += "\
+    ${PYTHON_PN}-setuptools-scm-native \
+"
+
+#RDEPENDS:${PN} = "python3-core"
+
+BBCLASSEXTEND = "native nativesdk"
+
+SRC_URI[sha256sum] = "9952471ceb304043b104c22d00b4f333cac27a6abe446d8a528fc437cf13c85f"
--

2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#115938): https://lists.openembedded.org/g/openembedded-devel/message/115938
Mute This Topic: https://lists.openembedded.org/mt/111665521/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-