summaryrefslogtreecommitdiffstats
path: root/meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch')
-rw-r--r--meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch54
1 files changed, 54 insertions, 0 deletions
diff --git a/meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch b/meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch
new file mode 100644
index 0000000000..a87d588b6a
--- /dev/null
+++ b/meta/recipes-devtools/python/python3-pyyaml/0001-Fix-builds-with-Cython-3.patch
@@ -0,0 +1,54 @@
1From 9cc23db56add79357b8f8257fe6fc0d6879d4579 Mon Sep 17 00:00:00 2001
2From: "Andrew J. Hesford" <ajh@sideband.org>
3Date: Fri, 21 Jul 2023 09:50:00 -0400
4Subject: [PATCH] Fix builds with Cython 3
5
6This is a *de minimis* fix for building with Cython 3. Recent Cython<3
7releases provided `Cython.Distutils.build_ext` as an alias to
8`Cython.Distutils.old_build_ext.old_build_ext`; Cython 3 drops this
9alias and instead uses a wholly new `Cython.Distutils.build_ext` that
10does not provide the `cython_sources` function used in `setup.py`.
11
12Explicitly importing `old_build_ext` preserves the existing behavior for
13recent Cython<3 and uses the correct behavior for Cython 3. Should the
14import fail (*e.g.*, because the version of Cython available predates
15the availability of `old_build_ext`), the import falls back to just
16`Cython.Distutils.build_ext`.
17
18Signed-off-by: Andrew J. Hesford <ajh@sideband.org>
19Upstream-Status: Denied [https://github.com/yaml/pyyaml/pull/731]
20Signed-off-by: Alexander Kanavin <alex@linutronix.de>
21---
22 pyproject.toml | 2 +-
23 setup.py | 6 +++++-
24 2 files changed, 6 insertions(+), 2 deletions(-)
25
26diff --git a/pyproject.toml b/pyproject.toml
27index 4bc04c0..2bf5ec8 100644
28--- a/pyproject.toml
29+++ b/pyproject.toml
30@@ -1,3 +1,3 @@
31 [build-system]
32-requires = ["setuptools", "wheel", "Cython<3.0"]
33+requires = ["setuptools", "wheel", "Cython"]
34 build-backend = "setuptools.build_meta"
35diff --git a/setup.py b/setup.py
36index 65b0ea0..4461580 100644
37--- a/setup.py
38+++ b/setup.py
39@@ -82,7 +82,11 @@ if 'sdist' in sys.argv or os.environ.get('PYYAML_FORCE_CYTHON') == '1':
40 with_cython = True
41 try:
42 from Cython.Distutils.extension import Extension as _Extension
43- from Cython.Distutils import build_ext as _build_ext
44+ try:
45+ from Cython.Distutils.old_build_ext import old_build_ext as _build_ext
46+ except ImportError:
47+ from Cython.Distutils import build_ext as _build_ext
48+
49 with_cython = True
50 except ImportError:
51 if with_cython:
52--
532.39.2
54