[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#976624: python3-xcbgen: not compatible with python 3.9



Package: xcb-proto
Severity: serious
Tags: patch upstream

Hello Maintainer,

Python 3.9 deprecated fractions.gcd in favor of math.gcd, this causes a FTBFS in polybar #975795[0]. I believe this issue can cause FTBFS in other packages and thus I picked the serious severity (same one applied to the polybar bug report caused by this).

I have tried to find the correct place to send patches upstream and gave up along the way when I couldn't find the project on freedesktop's gitlab instance[1] and the homepage pointed to an empty bugzilla (which I assume is not used anymore).

I proposed a solution on salsa[2], which I'm also attaching to this email.

I'm also willing to NMU the fix in case the maintainers don't have available time.

Thanks,

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=975795
[1] https://gitlab.freedesktop.org
[2] https://salsa.debian.org/xorg-team/proto/xcb-proto/-/merge_requests/2

--
Samuel Henrique <samueloph>
From 0cb3fba7b33aae669d47ea5f30a5a2bc5f21e465 Mon Sep 17 00:00:00 2001
From: Samuel Henrique <samueloph@debian.org>
Date: Sat, 5 Dec 2020 20:07:58 +0000
Subject: [PATCH] d/p/python39-compat.patch: Add patch for python 3.9
 compatibility

---
 debian/patches/python39-compat.patch | 21 +++++++++++++++++++++
 debian/patches/series                |  1 +
 2 files changed, 22 insertions(+)
 create mode 100644 debian/patches/python39-compat.patch
 create mode 100644 debian/patches/series

diff --git a/debian/patches/python39-compat.patch b/debian/patches/python39-compat.patch
new file mode 100644
index 0000000..924ed40
--- /dev/null
+++ b/debian/patches/python39-compat.patch
@@ -0,0 +1,21 @@
+Description: Fix import of deprecated fractions.gcd function (for python >= 3.9)
+Author: Samuel Henrique <samueloph@debian.org>
+Index: xcb-proto/xcbgen/align.py
+===================================================================
+--- xcb-proto.orig/xcbgen/align.py
++++ xcb-proto/xcbgen/align.py
+@@ -2,7 +2,13 @@
+ This module contains helper classes for alignment arithmetic and checks
+ '''
+ 
+-from fractions import gcd
++# python >= 3.9 compatibility
++# fractions.gcd is deprecated since python 3.9
++# math.gcd is available since python 3.5
++try:
++    from fractions import gcd
++except ImportError:
++    from math import gcd
+ 
+ class Alignment(object):
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..5703b40
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+python39-compat.patch
-- 
2.29.2


Reply to: