xcb-proto: backport fix for python gcd function
PATCH 1/1 xcb-proto: backport fix for python gcd function
From: Richard Leitner <[email protected]>
This backports the fix [1] for the following build error for nativesdk on Fedora 33 which is caused by the removal of fractions.gcd() in favor of math.gcd() in python 3.9 [2]:
ImportError: cannot import name 'gcd' from 'fractions' (/usr/lib64/python3.9/fractions.py)
[1] https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/commit/426ae35bee1fa0fdb8b5120b1dcd20cee6e34512
[2] https://bugs.python.org/issue39350
--- ...1-xcbgen-use-math-gcd-for-python-3-5.patch | 40 +++++++++++++++++++ .../xorg-proto/xcb-proto_1.13.bb | 3 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-graphics/xorg-proto/xcb-proto/0001-xcbgen-use-math-gcd-for-python-3-5.patch
meta/recipes-graphics/xorg-proto/xcb-proto/0001-xcbgen-use-math-gcd-for-python-3-5.patch new file +40 -0
@@ -0,0 +1,40 @@ +From 426ae35bee1fa0fdb8b5120b1dcd20cee6e34512 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <[email protected]> +Date: Mon, 1 Jun 2020 12:24:16 +0200 +Subject: [PATCH] xcbgen: Use math.gcd() for Python >= 3.5. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +fractions.gcd() has been deprecated since Python 3.5, and +was finally dropped in Python 3.9. It is recommended to +use math.gcd() instead. + +Signed-off-by: Björn Esser <[email protected]> +Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/commit/426ae35bee1fa0fdb8b5120b1dcd20cee6e34512] +Signed-off-by: Richard Leitner <[email protected]> +--- + xcbgen/align.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/xcbgen/align.py b/xcbgen/align.py +index d4c12ee..5c4f517 100644 +--- a/xcbgen/align.py ++++ b/xcbgen/align.py +@@ -2,7 +2,12 @@ + This module contains helper classes for alignment arithmetic and checks + ''' + +-from fractions import gcd ++from sys import version_info ++ ++if version_info[:2] >= (3, 5): ++ from math import gcd ++else: ++ from fractions import gcd + + class Alignment(object): + +-- +GitLab +
meta/recipes-graphics/xorg-proto/xcb-proto_1.13.bb +2 -1
@@ -11,7 +11,8 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=d763b081cb10c223435b01e00dc0aba7 \ file://src/dri2.xml;beginline=2;endline=28;md5=f8763b13ff432e8597e0d610cf598e65" -SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.bz2" +SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.bz2 \ + file://0001-xcbgen-use-math-gcd-for-python-3-5.patch" SRC_URI[md5sum] = "abe9aa4886138150bbc04ae4f29b90e3" SRC_URI[sha256sum] = "7b98721e669be80284e9bbfeab02d2d0d54cd11172b72271e47a2fe875e2bde1"
Signature · 1 line
2.28.0
Hi Steve,
friendly reminder for this patch as the initial fix was merged to master a few days ago as commit 1476d40d3e (xcb-proto: update to 1.14.1, 2020-10-28).
Is backporting the patch fine for dunfell or should xcb-proto be updated?
Thanks!
regards;rl
Quoted 81 lines · Richard Leitner
From: Richard Leitner <[email protected]>
This backports the fix [1] for the following build error for nativesdk on Fedora 33 which is caused by the removal of
fractions.gcd()in favor ofmath.gcd()in python 3.9 [2]:ImportError: cannot import name 'gcd' from 'fractions' (
/usr/lib64/python3.9/fractions.py)[1] https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/commit/426ae35bee1fa0fdb8b5120b1dcd20cee6e34512
[2] https://bugs.python.org/issue39350Signed-off-by Richard Leitner <[email protected]>--- ...1-xcbgen-use-math-gcd-for-python-3-5.patch | 40 +++++++++++++++++++ .../xorg-proto/xcb-proto_1.13.bb | 3 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-graphics/xorg-proto/xcb-proto/0001-xcbgen-use-math-gcd-for-python-3-5.patchmeta/recipes-graphics/xorg-proto/xcb-proto/0001-xcbgen-use-math-gcd-for-python-3-5.patch new file +40
-0@@ -0,0 +1,40 @@ +From 426ae35bee1fa0fdb8b5120b1dcd20cee6e34512 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <[email protected]> +Date: Mon, 1 Jun 2020 12:24:16 +0200 +Subject: [PATCH] xcbgen: Use math.gcd() for Python >= 3.5. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +fractions.gcd() has been deprecated since Python 3.5, and +was finally dropped in Python 3.9. It is recommended to +use math.gcd() instead. + +Signed-off-by: Björn Esser <[email protected]> +Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/commit/426ae35bee1fa0fdb8b5120b1dcd20cee6e34512] +Signed-off-by: Richard Leitner <[email protected]> +--- + xcbgen/align.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/xcbgen/align.py b/xcbgen/align.py +index d4c12ee..5c4f517 100644 +--- a/xcbgen/align.py ++++ b/xcbgen/align.py +@@ -2,7 +2,12 @@ + This module contains helper classes for alignment arithmetic and checks + ''' + +-from fractions import gcd ++from sys import version_info ++ ++if version_info[:2] >= (3, 5): ++ from math import gcd ++else: ++ from fractions import gcd + + class Alignment(object): + +-- +GitLab +meta/recipes-graphics/xorg-proto/xcb-proto_1.13.bb +2
-1@@ -11,7 +11,8 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=d763b081cb10c223435b01e00dc0aba7 \ file://src/dri2.xml;beginline=2;endline=28;md5=f8763b13ff432e8597e0d610cf598e65" -SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.bz2" +SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.bz2 \ + file://0001-xcbgen-use-math-gcd-for-python-3-5.patch" SRC_URI[md5sum] = "abe9aa4886138150bbc04ae4f29b90e3" SRC_URI[sha256sum] = "7b98721e669be80284e9bbfeab02d2d0d54cd11172b72271e47a2fe875e2bde1"Signature · 1 line
2.28.0
Hi Richard,
This patch is in the set I am currently testing on the autobuilder, so if all goes well it should be merged to dunfell soon.
Steve
Quoted 94 lines · Richard Leitner
Hi Steve,
friendly reminder for this patch as the initial fix was merged to master a few days ago as commit1476d40d3e(xcb-proto: update to 1.14.1, 2020-10-28).Is backporting the patch fine for dunfell or should xcb-proto be updated?
Thanks!
regards;rl
Quoted 81 lines · Richard Leitner
From: Richard Leitner <[email protected]>
This backports the fix [1] for the following build error for nativesdk on Fedora 33 which is caused by the removal of
fractions.gcd()in favor ofmath.gcd()in python 3.9 [2]:ImportError: cannot import name 'gcd' from 'fractions' (
/usr/lib64/python3.9/fractions.py)[1] https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/commit/426ae35bee1fa0fdb8b5120b1dcd20cee6e34512
[2] https://bugs.python.org/issue39350Signed-off-by Richard Leitner <[email protected]>--- ...1-xcbgen-use-math-gcd-for-python-3-5.patch | 40 +++++++++++++++++++ .../xorg-proto/xcb-proto_1.13.bb | 3 +- 2 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 meta/recipes-graphics/xorg-proto/xcb-proto/0001-xcbgen-use-math-gcd-for-python-3-5.patchmeta/recipes-graphics/xorg-proto/xcb-proto/0001-xcbgen-use-math-gcd-for-python-3-5.patch new file +40
-0@@ -0,0 +1,40 @@ +From 426ae35bee1fa0fdb8b5120b1dcd20cee6e34512 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= <[email protected]> +Date: Mon, 1 Jun 2020 12:24:16 +0200 +Subject: [PATCH] xcbgen: Use math.gcd() for Python >= 3.5. +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +fractions.gcd() has been deprecated since Python 3.5, and +was finally dropped in Python 3.9. It is recommended to +use math.gcd() instead. + +Signed-off-by: Björn Esser <[email protected]> +Upstream-Status: Backport [https://gitlab.freedesktop.org/xorg/proto/xcbproto/-/commit/426ae35bee1fa0fdb8b5120b1dcd20cee6e34512] +Signed-off-by: Richard Leitner <[email protected]> +--- + xcbgen/align.py | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/xcbgen/align.py b/xcbgen/align.py +index d4c12ee..5c4f517 100644 +--- a/xcbgen/align.py ++++ b/xcbgen/align.py +@@ -2,7 +2,12 @@ + This module contains helper classes for alignment arithmetic and checks + ''' + +-from fractions import gcd ++from sys import version_info ++ ++if version_info[:2] >= (3, 5): ++ from math import gcd ++else: ++ from fractions import gcd + + class Alignment(object): + +-- +GitLab +meta/recipes-graphics/xorg-proto/xcb-proto_1.13.bb +2
-2@@ -11,7 +11,8 @@ LICENSE = "MIT" LIC_FILES_CHKSUM = "file://COPYING;md5=d763b081cb10c223435b01e00dc0aba7 \ file://src/dri2.xml;beginline=2;endline=28;md5=f8763b13ff432e8597e0d610cf598e65" -SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.bz2" +SRC_URI = "http://xcb.freedesktop.org/dist/${BP}.tar.bz2 \ + file://0001-xcbgen-use-math-gcd-for-python-3-5.patch" SRC_URI[md5sum] = "abe9aa4886138150bbc04ae4f29b90e3" SRC_URI[sha256sum] = "7b98721e669be80284e9bbfeab02d2d0d54cd11172b72271e47a2fe875e2bde1" --2.28.0