Skip to contentSkip to conversation

Upgrading Cython to 3.0.0

PATCH Superseded Trevor Gamblin 3 participants 7 messages Aug 21, 2023 – Aug 23, 2023 1 message not in the archive

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover Upgrading Cython to 3.0.0

The Cython 3.0.0 release contains many changes. Since there are a large number of recipes that depend on it, there will potentially be build issues with recipes in meta-python and elsewhere. I performed a world build on poky alone with the python3-cython upgrade and the only recipe to fail was python3-pyyaml, so that has been tweaked to work (via two new patches for the recipe; thanks to Tim Orling for the heads-up).

Trevor Gamblin (2):
python3-cython: upgrade 0.29.36 -> 3.0.0
python3-pyyaml: Make compatible with Cython 3.0.0

 .../recipes-devtools/python/python-cython.inc |  4 +-
 ...hon_0.29.36.bb => python3-cython_3.0.0.bb} |  0
 .../0001-Fix-builds-with-Cython-3.patch       | 47 +++++++++++++++++++
 ...roject.toml-don-t-pin-Cython-version.patch | 26 ++++++++++
 .../python/python3-pyyaml_6.0.1.bb            |  4 ++
 5 files changed, 79 insertions(+), 2 deletions(-)
 rename meta/recipes-devtools/python/{python3-cython_0.29.36.bb => python3-cython_3.0.0.bb} (100%)
 create mode 100644 meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch
 create mode 100644 meta/recipes-devtools/python/python3-pyyaml/0001-pyproject.toml-don-t-pin-Cython-version.patch
Signature · 1 line
2.41.0
#1 lore raw

PATCH 1/2 python3-cython: upgrade 0.29.36 -> 3.0.0

Changelog: https://github.com/cython/cython/blob/master/CHANGES.rst

---
 meta/recipes-devtools/python/python-cython.inc                | 4 ++--
 .../{python3-cython_0.29.36.bb => python3-cython_3.0.0.bb}    | 0
 2 files changed, 2 insertions(+), 2 deletions(-)
 rename meta/recipes-devtools/python/{python3-cython_0.29.36.bb => python3-cython_3.0.0.bb} (100%)
meta/recipes-devtools/python/python-cython.inc +2 -2
index 6aec6b012f..01829b9f33 100644
@@ -5,11 +5,11 @@ It's designed to bridge the gap between the nice, high-level, easy-to-use world
 and the messy, low-level world of C."
 SECTION = "devel/python"
 LICENSE = "Apache-2.0"
-LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=e23fadd6ceef8c618fc1c65191d846fa"
+LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=61c3ee8961575861fa86c7e62bc9f69c"
 PYPI_PACKAGE = "Cython"
 BBCLASSEXTEND = "native nativesdk"
 
-SRC_URI[sha256sum] = "41c0cfd2d754e383c9eeb95effc9aa4ab847d0c9747077ddd7c0dcb68c3bc01f"
+SRC_URI[sha256sum] = "350b18f9673e63101dbbfcf774ee2f57c20ac4636d255741d76ca79016b1bd82"
 UPSTREAM_CHECK_REGEX = "Cython-(?P<pver>.*)\.tar"
 
 inherit pypi
meta/recipes-devtools/python/python3-cython_3.0.0.bb renamed from meta/recipes-devtools/python/python3-cython_0.29.36.bb +0 -0
similarity index 100%
rename from meta/recipes-devtools/python/python3-cython_0.29.36.bb
rename to meta/recipes-devtools/python/python3-cython_3.0.0.bb
Signature · 1 line
2.41.0
#2 lore raw

PATCH 2/2 python3-pyyaml: Make compatible with Cython 3.0.0

In reply to Trevor Gamblin

Backport a fix to avoid failures with get_source_files and build_ext during do_compile when compiling with Cython > 3.0.0.

---
 .../0001-Fix-builds-with-Cython-3.patch       | 47 +++++++++++++++++++
 ...roject.toml-don-t-pin-Cython-version.patch | 26 ++++++++++
 .../python/python3-pyyaml_6.0.1.bb            |  4 ++
 3 files changed, 77 insertions(+)
 create mode 100644 meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch
 create mode 100644 meta/recipes-devtools/python/python3-pyyaml/0001-pyproject.toml-don-t-pin-Cython-version.patch
meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch new file +47 -0
new file mode 100644
index 0000000000..66de7dacb0
@@ -0,0 +1,47 @@
+From 90c32c1f301a5d43177c516bf76b58ee1d07a2fe Mon Sep 17 00:00:00 2001
+From: "Andrew J. Hesford" <[email protected]>
+Date: Fri, 21 Jul 2023 09:50:00 -0400
+Subject: [PATCH] Fix builds with Cython 3
+
+This is a *de minimis* fix for building with Cython 3. Recent Cython<3
+releases provided `Cython.Distutils.build_ext` as an alias to
+`Cython.Distutils.old_build_ext.old_build_ext`; Cython 3 drops this
+alias and instead uses a wholly new `Cython.Distutils.build_ext` that
+does not provide the `cython_sources` function used in `setup.py`.
+
+Explicitly importing `old_build_ext` preserves the existing behavior for
+recent Cython<3 and uses the correct behavior for Cython 3. Should the
+import fail (*e.g.*, because the version of Cython available predates
+the availability of `old_build_ext`), the import falls back to just
+`Cython.Distutils.build_ext`.
+
+Signed-off-by: Andrew J. Hesford <[email protected]>
+
+Upstream-Status: Backport
+(https://github.com/yaml/pyyaml/pull/731/commits/17dc5b6cd96dcfe64fd71789c771ca9b96d260e5)
+
+Signed-off-by: Trevor Gamblin <[email protected]>
+---
+ setup.py | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/setup.py b/setup.py
+index 944e7fa..462b1e9 100644
+--- a/setup.py
++++ b/setup.py
+@@ -82,7 +82,11 @@ if 'sdist' in sys.argv or os.environ.get('PYYAML_FORCE_CYTHON') == '1':
+     with_cython = True
+ try:
+     from Cython.Distutils.extension import Extension as _Extension
+-    from Cython.Distutils import build_ext as _build_ext
++    try:
++        from Cython.Distutils.old_build_ext import old_build_ext as _build_ext
++    except ImportError:
++        from Cython.Distutils import build_ext as _build_ext
++
+     with_cython = True
+ except ImportError:
+     if with_cython:
+-- 
+2.41.0
+
meta/recipes-devtools/python/python3-pyyaml/0001-pyproject.toml-don-t-pin-Cython-version.patch new file +26 -0
new file mode 100644
index 0000000000..3e62d9de39
@@ -0,0 +1,26 @@
+From 322651ce2b9b209d3328a6f7590853c2008e9c10 Mon Sep 17 00:00:00 2001
+From: Trevor Gamblin <[email protected]>
+Date: Mon, 21 Aug 2023 11:26:35 -0400
+Subject: [PATCH] pyproject.toml: don't pin Cython version
+
+Remove the pinned version for Cython so that pyyaml can build.
+
+Upstream-Status: Inappropriate (embedded-specific)
+
+Signed-off-by: Trevor Gamblin <[email protected]>
+---
+ pyproject.toml | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/pyproject.toml b/pyproject.toml
+index 4bc04c0..2bf5ec8 100644
+--- a/pyproject.toml
++++ b/pyproject.toml
+@@ -1,3 +1,3 @@
+ [build-system]
+-requires = ["setuptools", "wheel", "Cython<3.0"]
++requires = ["setuptools", "wheel", "Cython"]
+ build-backend = "setuptools.build_meta"
+-- 
+2.41.0
+
meta/recipes-devtools/python/python3-pyyaml_6.0.1.bb +4 -0
index 4ab8f038f4..4c71993e5c 100644
@@ -7,6 +7,10 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=6d8242660a8371add5fe547adf083079"
 
 PYPI_PACKAGE = "PyYAML"
 
+SRC_URI += "file://0001-pyproject.toml-don-t-pin-Cython-version.patch \
+            file://0001-Fix-builds-with-Cython-3.patch \
+"
+
 inherit pypi python_setuptools_build_meta
 
 SRC_URI[sha256sum] = "bfdf460b1736c775f2ba9f6a92bca30bc2095067b8a9d77876d1fad6cc3b4a43"
Signature · 1 line
2.41.0
#3 lore raw
In reply to Trevor Gamblin

Hello Trevor,

Quoted 6 lines · On Mon, 21 Aug 2023 13:38:38 -0400 "Trevor Gamblin" <[email protected]>…

The Cython 3.0.0 release contains many changes. Since there are a large number of recipes that depend on it, there will potentially be build issues with recipes in meta-python and elsewhere. I performed a world build on poky alone with the python3-cython upgrade and the only recipe to fail was python3-pyyaml, so that has been tweaked to work (via two new patches for the recipe; thanks to Tim Orling for the heads-up).

This series makes python3-cython non-reproducible:

AssertionError: The following deb packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/deb/./core2-64/python3-cython-src_3.0.0-r0_amd64.deb The following ipk packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/ipk/./core2-64/python3-cython-src_3.0.0-r0_core2-64.ipk The following rpm packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/rpm/./core2_64/python3-cython-src-3.0.0-r0.core2_64.rpm

https://autobuilder.yoctoproject.org/typhoon/#/builders/117/builds/3400/steps/12/logs/stdio

Luca

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

#5 lore raw
Quoted 22 lines · On Wed, 23 Aug 2023 09:24:42 +0200 "Luca Ceresoli via lists.openembedded.org"…

Hello Trevor,

Quoted 6 lines · On Mon, 21 Aug 2023 13:38:38 -0400 "Trevor Gamblin" <[email protected]>…

The Cython 3.0.0 release contains many changes. Since there are a large number of recipes that depend on it, there will potentially be build issues with recipes in meta-python and elsewhere. I performed a world build on poky alone with the python3-cython upgrade and the only recipe to fail was python3-pyyaml, so that has been tweaked to work (via two new patches for the recipe; thanks to Tim Orling for the heads-up).

This series makes python3-cython non-reproducible:

AssertionError: The following deb packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/deb/./core2-64/python3-cython-src_3.0.0-r0_amd64.deb The following ipk packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/ipk/./core2-64/python3-cython-src_3.0.0-r0_core2-64.ipk The following rpm packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/rpm/./core2_64/python3-cython-src-3.0.0-r0.core2_64.rpm

Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/117/builds/3400/steps/12/logs/stdio

And just noticed this is also introducing some warnings:

WARNING: python3-cython-3.0.0-r0 do_package_qa: QA Issue: File /usr/src/debug/python3-cython/3.0.0-r0/Cython/Utils.c in package python3-cython-src contains reference to TMPDIR

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/7657/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/7657/steps/11/logs/stdio

Luca

Signature · 3 lines
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw
Quoted 27 lines · Luca Ceresoli
Quoted 22 lines · On Wed, 23 Aug 2023 09:24:42 +0200 "Luca Ceresoli via lists.openembedded.org"…

Hello Trevor,

Quoted 6 lines · On Mon, 21 Aug 2023 13:38:38 -0400 "Trevor Gamblin" <[email protected]>…

The Cython 3.0.0 release contains many changes. Since there are a large number of recipes that depend on it, there will potentially be build issues with recipes in meta-python and elsewhere. I performed a world build on poky alone with the python3-cython upgrade and the only recipe to fail was python3-pyyaml, so that has been tweaked to work (via two new patches for the recipe; thanks to Tim Orling for the heads-up).

This series makes python3-cython non-reproducible:

AssertionError: The following deb packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/deb/./core2-64/python3-cython-src_3.0.0-r0_amd64.deb The following ipk packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/ipk/./core2-64/python3-cython-src_3.0.0-r0_core2-64.ipk The following rpm packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/rpm/./core2_64/python3-cython-src-3.0.0-r0.core2_64.rpm

Quoted 8 lines
Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/117/builds/3400/steps/12/logs/stdio

And just noticed this is also introducing some warnings:

WARNING: python3-cython-3.0.0-r0 do_package_qa: QA Issue: File /usr/src/debug/python3-cython/3.0.0-r0/Cython/Utils.c in package python3-cython-src contains reference to TMPDIR

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/7657/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/7657/steps/11/logs/stdio

there are few meta-python recipes which need attention as well.

https://errors.yoctoproject.org/Errors/Build/170232/

Quoted 7 lines

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

#7 lore raw
Quoted 30 lines · Khem Raj
Quoted 28 lines · Luca Ceresoli
Quoted 21 lines · On Wed, 23 Aug 2023 09:24:42 +0200 "Luca Ceresoli via lists.openembedded.org"…

Hello Trevor,

Quoted 6 lines · On Mon, 21 Aug 2023 13:38:38 -0400 "Trevor Gamblin" <[email protected]>…

The Cython 3.0.0 release contains many changes. Since there are a large number of recipes that depend on it, there will potentially be build issues with recipes in meta-python and elsewhere. I performed a world build on poky alone with the python3-cython upgrade and the only recipe to fail was python3-pyyaml, so that has been tweaked to work (via two new patches for the recipe; thanks to Tim Orling for the heads-up).

This series makes python3-cython non-reproducible:

AssertionError: The following deb packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/deb/./core2-64/python3-cython-src_3.0.0-r0_amd64.deb The following ipk packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/ipk/./core2-64/python3-cython-src_3.0.0-r0_core2-64.ipk The following rpm packages are different and not in exclusion list:
/home/pokybuild/yocto-worker/reproducible/build/build-st/reproducibleB/tmp/deploy/rpm/./core2_64/python3-cython-src-3.0.0-r0.core2_64.rpm

Quoted 1 line

https://autobuilder.yoctoproject.org/typhoon/#/builders/117/builds/3400/steps/12/logs/stdio

And just noticed this is also introducing some warnings:

Quoted 7 lines
Quoted 4 lines

WARNING: python3-cython-3.0.0-r0 do_package_qa: QA Issue: File /usr/src/debug/python3-cython/3.0.0-r0/Cython/Utils.c in package python3-cython-src contains reference to TMPDIR

https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/7657/steps/14/logs/stdio
https://autobuilder.yoctoproject.org/typhoon/#/builders/40/builds/7657/steps/11/logs/stdio

there are few meta-python recipes which need attention as well.

https://errors.yoctoproject.org/Errors/Build/170232/

Hi,

Sorry about that - I had mentioned it to Richard in IRC but not communicated the decision here. I've looked at the meta-python problems but it looks like a few of those issues are going to stay around for a while, so I'll wait on getting the python3-cython upgrade and changes to python3-pyyaml merged into oe-core. Once the recipes that require cython are all patched up for 3.0.0, I'll resend these.

Thanks for doing the testing - I didn't notice the QA issue, so when I revisit it I'll try and fix that too.

Trevor

Quoted 7 lines
Quoted 7 lines

Luca

--
Luca Ceresoli, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com