Merge ~ahasenack/ubuntu/+source/python-fysom:jammy-fix-py310-collections-import into ubuntu/+source/python-fysom:ubuntu/devel

Proposed by Andreas Hasenack
Status: Merged
Merged at revision: 805ceba9e9361d3fecaff62235deac7583a72178
Proposed branch: ~ahasenack/ubuntu/+source/python-fysom:jammy-fix-py310-collections-import
Merge into: ubuntu/+source/python-fysom:ubuntu/devel
Diff against target: 95 lines (+65/-1)
4 files modified
debian/changelog (+7/-0)
debian/control (+2/-1)
debian/patches/import_abc_from_collections_abc.patch (+55/-0)
debian/patches/series (+1/-0)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior (community) Approve
Canonical Server Pending
Review via email: mp+415043@code.launchpad.net

Description of the change

Fix collections import in python 3.10

PPA: https://launchpad.net/~ahasenack/+archive/ubuntu/py310-collections (just amd64 for speed)

To test, run the dep8 test manually after installing the new package:

$ python3 debian/tests/import3
green

Submitted to debian via a bug report and salsa PR.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

I'll take a look at this one.

Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thanks for the MP, Andreas. Aside from the Applied-Upstream suggestion (which is the same comment I've made on the salsa MR), everything LGTM. Package builds & tests fine locally. +1

review: Approve
Revision history for this message
Andreas Hasenack (ahasenack) :
Revision history for this message
Andreas Hasenack (ahasenack) :

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/debian/changelog b/debian/changelog
2index 7911bd3..668b0b7 100644
3--- a/debian/changelog
4+++ b/debian/changelog
5@@ -1,3 +1,10 @@
6+python-fysom (2.1.5-3ubuntu1) jammy; urgency=medium
7+
8+ * d/p/import_abc_from_collections_abc.patch: Fix collections import
9+ for Python 3.10+ (LP: #1959907)
10+
11+ -- Andreas Hasenack <andreas@canonical.com> Thu, 03 Feb 2022 14:34:40 -0300
12+
13 python-fysom (2.1.5-3) unstable; urgency=medium
14
15 [ Marcin Kulisz ]
16diff --git a/debian/control b/debian/control
17index 589f74b..8f7c1db 100644
18--- a/debian/control
19+++ b/debian/control
20@@ -1,5 +1,6 @@
21 Source: python-fysom
22-Maintainer: Marcin Kulisz <debian@kulisz.net>
23+Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
24+XSBC-Original-Maintainer: Marcin Kulisz <debian@kulisz.net>
25 Section: python
26 Priority: optional
27 Build-Depends: debhelper-compat (= 12),
28diff --git a/debian/patches/import_abc_from_collections_abc.patch b/debian/patches/import_abc_from_collections_abc.patch
29new file mode 100644
30index 0000000..4e3e461
31--- /dev/null
32+++ b/debian/patches/import_abc_from_collections_abc.patch
33@@ -0,0 +1,55 @@
34+From 1ed6950d2b683a9a2a2ab35dfd0ea79dc2963dc3 Mon Sep 17 00:00:00 2001
35+From: Karthikeyan Singaravelan <tir.karthi@gmail.com>
36+Date: Thu, 9 Apr 2020 14:32:14 +0000
37+Subject: [PATCH] Import ABC from collections.abc instead of collections for
38+ Python 3 compatibility.
39+
40+---
41+ src/main/python/fysom/__init__.py | 10 +++++++---
42+ 1 file changed, 7 insertions(+), 3 deletions(-)
43+
44+Origin: upstream, https://github.com/mriehl/fysom/commit/1ed6950d2b683a9a2a2ab35dfd0ea79dc2963dc3
45+Bug: https://bugs.debian.org/1004913
46+Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/python-fysom/+bug/1959907
47+Last-Update: 2022-02-03
48+Applied-Upstream: 2.1.6
49+diff --git a/src/main/python/fysom/__init__.py b/src/main/python/fysom/__init__.py
50+index 6458bbb..179512f 100644
51+--- a/fysom/__init__.py
52++++ b/fysom/__init__.py
53+@@ -27,12 +27,16 @@
54+ # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55+ #
56+
57+-import collections
58+ import functools
59+ import weakref
60+ import types
61+ import sys
62+
63++try:
64++ from collections.abc import Mapping
65++except ImportError:
66++ from collections import Mapping
67++
68+ __author__ = 'Mansour Behabadi'
69+ __copyright__ = 'Copyright 2011, Mansour Behabadi and Jake Gordon'
70+ __credits__ = ['Mansour Behabadi', 'Jake Gordon']
71+@@ -159,7 +163,7 @@ def __init__(self, cfg={}, initial=None, events=None, callbacks=None,
72+ # convert 3-tuples in the event specification to dicts
73+ events_dicts = []
74+ for e in cfg["events"]:
75+- if isinstance(e, collections.Mapping):
76++ if isinstance(e, Mapping):
77+ events_dicts.append(e)
78+ elif hasattr(e, "__iter__"):
79+ name, src, dst = list(e)[:3]
80+@@ -520,7 +524,7 @@ def is_very_angry(self, event):
81+ # convert 3-tuples in the event specification to dicts
82+ events_dicts = []
83+ for e in cfg["events"]:
84+- if isinstance(e, collections.Mapping):
85++ if isinstance(e, Mapping):
86+ events_dicts.append(e)
87+ elif hasattr(e, "__iter__"):
88+ name, src, dst = list(e)[:3]
89diff --git a/debian/patches/series b/debian/patches/series
90new file mode 100644
91index 0000000..f4b8e53
92--- /dev/null
93+++ b/debian/patches/series
94@@ -0,0 +1 @@
95+import_abc_from_collections_abc.patch

Subscribers

People subscribed via source and target branches