* [PATCH] python3-dtc: port to Python 3.10
@ 2021-11-11 13:57 Ross Burton
2021-11-11 14:46 ` [meta-virtualization] " Bruce Ashfield
0 siblings, 1 reply; 2+ messages in thread
From: Ross Burton @ 2021-11-11 13:57 UTC (permalink / raw)
To: meta-virtualization
Signed-off-by: Ross Burton <ross.burton@arm.com>
---
recipes-kernel/dtc/files/ssize.patch | 35 +++++++++++++++++++++++++
recipes-kernel/dtc/python3-dtc_1.6.1.bb | 3 ++-
2 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 recipes-kernel/dtc/files/ssize.patch
diff --git a/recipes-kernel/dtc/files/ssize.patch b/recipes-kernel/dtc/files/ssize.patch
new file mode 100644
index 0000000..3156896
--- /dev/null
+++ b/recipes-kernel/dtc/files/ssize.patch
@@ -0,0 +1,35 @@
+Python 3.10 has made it mandatory that the 'string+length` formats use ssize_t
+instead of int, so define the magic symbol and upcast the ints from the libfdt
+API to ssize_t.
+
+Upstream-Status: Pending
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+
+diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
+index 51ee801..075ef70 100644
+--- a/pylibfdt/libfdt.i
++++ b/pylibfdt/libfdt.i
+@@ -1044,9 +1044,9 @@ typedef uint32_t fdt32_t;
+ $result = Py_None;
+ else
+ %#if PY_VERSION_HEX >= 0x03000000
+- $result = Py_BuildValue("y#", $1, *arg4);
++ $result = Py_BuildValue("y#", $1, (Py_ssize_t)*arg4);
+ %#else
+- $result = Py_BuildValue("s#", $1, *arg4);
++ $result = Py_BuildValue("s#", $1, (Py_ssize_t)*arg4);
+ %#endif
+ }
+
+diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py
+index ef40f15..88ff7d1 100755
+--- a/pylibfdt/setup.py
++++ b/pylibfdt/setup.py
+@@ -42,6 +42,7 @@ def get_version():
+ libfdt_module = Extension(
+ '_libfdt',
+ sources=[os.path.join(srcdir, 'libfdt.i')],
++ define_macros=[('PY_SSIZE_T_CLEAN', None)],
+ include_dirs=[os.path.join(srcdir, '../libfdt')],
+ libraries=['fdt'],
+ library_dirs=[os.path.join(top_builddir, 'libfdt')],
diff --git a/recipes-kernel/dtc/python3-dtc_1.6.1.bb b/recipes-kernel/dtc/python3-dtc_1.6.1.bb
index 293c8d3..d7d45a4 100644
--- a/recipes-kernel/dtc/python3-dtc_1.6.1.bb
+++ b/recipes-kernel/dtc/python3-dtc_1.6.1.bb
@@ -6,7 +6,8 @@ LICENSE = "GPLv2 | BSD-2-Clause"
DEPENDS = "flex-native bison-native swig-native libyaml dtc"
-SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master"
+SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master \
+ file://ssize.patch"
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [meta-virtualization] [PATCH] python3-dtc: port to Python 3.10
2021-11-11 13:57 [PATCH] python3-dtc: port to Python 3.10 Ross Burton
@ 2021-11-11 14:46 ` Bruce Ashfield
0 siblings, 0 replies; 2+ messages in thread
From: Bruce Ashfield @ 2021-11-11 14:46 UTC (permalink / raw)
To: Ross Burton; +Cc: meta-virtualization
My xen-image-minimal build worked with this change, so I've grabbed it and
pushed it to master.
Bruce
On Thu, Nov 11, 2021 at 8:57 AM Ross Burton <ross@burtonini.com> wrote:
>
> Signed-off-by: Ross Burton <ross.burton@arm.com>
> ---
> recipes-kernel/dtc/files/ssize.patch | 35 +++++++++++++++++++++++++
> recipes-kernel/dtc/python3-dtc_1.6.1.bb | 3 ++-
> 2 files changed, 37 insertions(+), 1 deletion(-)
> create mode 100644 recipes-kernel/dtc/files/ssize.patch
>
> diff --git a/recipes-kernel/dtc/files/ssize.patch b/recipes-kernel/dtc/files/ssize.patch
> new file mode 100644
> index 0000000..3156896
> --- /dev/null
> +++ b/recipes-kernel/dtc/files/ssize.patch
> @@ -0,0 +1,35 @@
> +Python 3.10 has made it mandatory that the 'string+length` formats use ssize_t
> +instead of int, so define the magic symbol and upcast the ints from the libfdt
> +API to ssize_t.
> +
> +Upstream-Status: Pending
> +Signed-off-by: Ross Burton <ross.burton@arm.com>
> +
> +diff --git a/pylibfdt/libfdt.i b/pylibfdt/libfdt.i
> +index 51ee801..075ef70 100644
> +--- a/pylibfdt/libfdt.i
> ++++ b/pylibfdt/libfdt.i
> +@@ -1044,9 +1044,9 @@ typedef uint32_t fdt32_t;
> + $result = Py_None;
> + else
> + %#if PY_VERSION_HEX >= 0x03000000
> +- $result = Py_BuildValue("y#", $1, *arg4);
> ++ $result = Py_BuildValue("y#", $1, (Py_ssize_t)*arg4);
> + %#else
> +- $result = Py_BuildValue("s#", $1, *arg4);
> ++ $result = Py_BuildValue("s#", $1, (Py_ssize_t)*arg4);
> + %#endif
> + }
> +
> +diff --git a/pylibfdt/setup.py b/pylibfdt/setup.py
> +index ef40f15..88ff7d1 100755
> +--- a/pylibfdt/setup.py
> ++++ b/pylibfdt/setup.py
> +@@ -42,6 +42,7 @@ def get_version():
> + libfdt_module = Extension(
> + '_libfdt',
> + sources=[os.path.join(srcdir, 'libfdt.i')],
> ++ define_macros=[('PY_SSIZE_T_CLEAN', None)],
> + include_dirs=[os.path.join(srcdir, '../libfdt')],
> + libraries=['fdt'],
> + library_dirs=[os.path.join(top_builddir, 'libfdt')],
> diff --git a/recipes-kernel/dtc/python3-dtc_1.6.1.bb b/recipes-kernel/dtc/python3-dtc_1.6.1.bb
> index 293c8d3..d7d45a4 100644
> --- a/recipes-kernel/dtc/python3-dtc_1.6.1.bb
> +++ b/recipes-kernel/dtc/python3-dtc_1.6.1.bb
> @@ -6,7 +6,8 @@ LICENSE = "GPLv2 | BSD-2-Clause"
>
> DEPENDS = "flex-native bison-native swig-native libyaml dtc"
>
> -SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master"
> +SRC_URI = "git://git.kernel.org/pub/scm/utils/dtc/dtc.git;branch=master \
> + file://ssize.patch"
>
> UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>\d+(\.\d+)+)"
>
> --
> 2.25.1
>
>
>
>
--
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-11-11 14:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-11 13:57 [PATCH] python3-dtc: port to Python 3.10 Ross Burton
2021-11-11 14:46 ` [meta-virtualization] " Bruce Ashfield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).