Bug#1000204: pyfai: FTBFS if built using python3.10 (collections.MutableSets deprecated)

Lukas Märdian slyon at ubuntu.com
Fri Nov 19 15:58:57 GMT 2021


Package: pyfai
Version: 0.20.0+dfsg1-4
Severity: serious
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)
User: ubuntu-devel at lists.ubuntu.com
Usertags: origin-ubuntu jammy ubuntu-patch
X-Debbugs-Cc: slyon at ubuntu.com

Dear Maintainer,

collections.MutableSet was deprecated a long time ago and removed with python3.10.
https://docs.python.org/3/whatsnew/3.10.html#removed
https://bugs.python.org/issue37324

Using the old class name leads to autopkgtest failures such as this one:

```
======================================================================
ERROR: test_import_all_modules (pyFAI.test.test_bug_regression.TestBugRegression)
Try to import every single module in the package
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/test/test_bug_regression.py", line 286, in test_import_all_modules
    raise err
  File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/test/test_bug_regression.py", line 271, in test_import_all_modules
    load_source(fqn, path)
  File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/test/test_bug_regression.py", line 78, in load_source
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/utils/orderedset.py", line 30, in <module>
    class OrderedSet(collections.MutableSet):
AttributeError: module 'collections' has no attribute 'MutableSet'
```

In Ubuntu, the attached patch was applied to achieve the following:


  * Fix FTBFS with python3.10, due to deprecated collections.MutableSets

Forwarded upstream: https://github.com/silx-kit/pyFAI/pull/1588


Thanks for considering the patch.

Cheers,
   Lukas

-- System Information:
Debian Release: 11.0
  APT prefers impish-updates
  APT policy: (500, 'impish-updates'), (500, 'impish-security'), (500, 'impish'), (100, 'impish-backports')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.13.0-20-generic (SMP w/4 CPU threads)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_WARN, TAINT_OOT_MODULE
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8), LANGUAGE=de_DE:en_GB:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled
-------------- next part --------------
diff -Nru pyfai-0.20.0+dfsg1/debian/patches/python3.10-compat.patch pyfai-0.20.0+dfsg1/debian/patches/python3.10-compat.patch
--- pyfai-0.20.0+dfsg1/debian/patches/python3.10-compat.patch	1970-01-01 01:00:00.000000000 +0100
+++ pyfai-0.20.0+dfsg1/debian/patches/python3.10-compat.patch	2021-11-19 16:51:28.000000000 +0100
@@ -0,0 +1,40 @@
+Description: Fix collections.MutableSets compat with python3.10
+ collections.MutableSet was deprecated a long time ago and removed with python3.10.
+ https://docs.python.org/3/whatsnew/3.10.html#removed
+ https://bugs.python.org/issue37324
+ 
+ Using the old class name leads to test failures such as this one:
+ ======================================================================
+ ERROR: test_import_all_modules (pyFAI.test.test_bug_regression.TestBugRegression)
+ Try to import every single module in the package
+ ----------------------------------------------------------------------
+ Traceback (most recent call last):
+   File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/test/test_bug_regression.py", line 286, in test_import_all_modules
+     raise err
+   File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/test/test_bug_regression.py", line 271, in test_import_all_modules
+     load_source(fqn, path)
+   File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/test/test_bug_regression.py", line 78, in load_source
+     spec.loader.exec_module(module)
+   File "<frozen importlib._bootstrap_external>", line 883, in exec_module
+   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
+   File "/<<BUILDDIR>>/pyfai-0.20.0+dfsg1/.pybuild/cpython3_3.10_pyfai/build/pyFAI/utils/orderedset.py", line 30, in <module>
+     class OrderedSet(collections.MutableSet):
+ AttributeError: module 'collections' has no attribute 'MutableSet'
+Author: Lukas M?rdian <slyon at ubuntu.com>
+Origin: vendor, Ubuntu
+Bug: https://github.com/silx-kit/pyFAI/pull/1588
+Forwarded: https://github.com/silx-kit/pyFAI/pull/1588
+Last-Update: 2021-11-19
+---
+This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
+--- pyfai-0.20.0+dfsg1.orig/pyFAI/utils/orderedset.py
++++ pyfai-0.20.0+dfsg1/pyFAI/utils/orderedset.py
+@@ -27,7 +27,7 @@
+ import collections
+ 
+ 
+-class OrderedSet(collections.MutableSet):
++class OrderedSet(collections.abc.MutableSet):
+ 
+     def __init__(self, iterable=None):
+         self.end = end = []
diff -Nru pyfai-0.20.0+dfsg1/debian/patches/series pyfai-0.20.0+dfsg1/debian/patches/series
--- pyfai-0.20.0+dfsg1/debian/patches/series	2021-09-19 13:57:57.000000000 +0200
+++ pyfai-0.20.0+dfsg1/debian/patches/series	2021-11-19 16:51:28.000000000 +0100
@@ -6,3 +6,4 @@
 0006-fix-a-couple-of-test-failing-with-i386.patch
 0007-cleaner-test.patch
 0008-tunning.patch
+python3.10-compat.patch


More information about the debian-science-maintainers mailing list