Bug#1004446: cdist: FTBFS against python 3.10
Package: cdist
Version: 6.9.4-1
Severity: normal
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu jammy
Dear Maintainer,
This bug report was also filed in Ubuntu and can be found at
https://launchpad.net/bugs/1959330
autopkgtest will fail when python3.10 is used. Upstream has fixed relevant
things already, so here's a patch with those commits.
-Dan
diff -Nru cdist-6.9.4/debian/changelog cdist-6.9.4/debian/changelog
--- cdist-6.9.4/debian/changelog 2021-02-07 00:45:26.000000000 -0700
+++ cdist-6.9.4/debian/changelog 2022-01-27 11:45:53.000000000 -0700
@@ -1,3 +1,11 @@
+cdist (6.9.4-1.1) jammy; urgency=medium
+
+ * Cherry-pick 2 commits for python 3.10 compatibility
+ * Fix version compare
+ * Fix transition of some classes from collections to collections.abc
+
+ -- Dan Bungert <daniel.bungert@canonical.com> Thu, 27 Jan 2022 11:45:53 -0700
+
cdist (6.9.4-1) unstable; urgency=medium
* QA upload.
diff -Nru cdist-6.9.4/debian/patches/collections-abc.patch cdist-6.9.4/debian/patches/collections-abc.patch
--- cdist-6.9.4/debian/patches/collections-abc.patch 1969-12-31 17:00:00.000000000 -0700
+++ cdist-6.9.4/debian/patches/collections-abc.patch 2022-01-27 11:45:53.000000000 -0700
@@ -0,0 +1,36 @@
+Description: Python 3.10: collections.X -> collections.abc.X
+Origin: https://code.ungleich.ch/ungleich-public/cdist/commit/3a321469a8ba5aea55220bd70bd4900de732e917
+Author: Timothée Floure <timothee.floure@posteo.net>
+Forwarded: 'not-needed'
+Last-Update: 2022-01-27
+--- a/cdist/integration.py
++++ b/cdist/integration.py
+@@ -84,7 +84,7 @@
+ """
+ if isinstance(host, str):
+ hosts = [host, ]
+- elif isinstance(host, collections.Iterable):
++ elif isinstance(host, collections.abc.Iterable):
+ hosts = host
+ else:
+ raise cdist.Error('Invalid host argument: {}'.format(host))
+--- a/cdist/util/fsproperty.py
++++ b/cdist/util/fsproperty.py
+@@ -33,7 +33,7 @@
+ return 'Absolute path required, got: %s' % self.path
+
+
+-class FileList(collections.MutableSequence):
++class FileList(collections.abc.MutableSequence):
+ """A list that stores it's state in a file.
+
+ """
+@@ -102,7 +102,7 @@
+ self.__write(lines)
+
+
+-class DirectoryDict(collections.MutableMapping):
++class DirectoryDict(collections.abc.MutableMapping):
+ """A dict that stores it's items as files in a directory.
+
+ """
diff -Nru cdist-6.9.4/debian/patches/series cdist-6.9.4/debian/patches/series
--- cdist-6.9.4/debian/patches/series 2021-02-07 00:45:26.000000000 -0700
+++ cdist-6.9.4/debian/patches/series 2022-01-27 11:45:53.000000000 -0700
@@ -1 +1,3 @@
explicitly-specify-path-one-remote-side.patch
+collections-abc.patch
+version-compare.patch
diff -Nru cdist-6.9.4/debian/patches/version-compare.patch cdist-6.9.4/debian/patches/version-compare.patch
--- cdist-6.9.4/debian/patches/version-compare.patch 1969-12-31 17:00:00.000000000 -0700
+++ cdist-6.9.4/debian/patches/version-compare.patch 2022-01-27 11:45:53.000000000 -0700
@@ -0,0 +1,33 @@
+Description: [bin/cdist] Fix Python version check
+Origin: https://code.ungleich.ch/ungleich-public/cdist/commit/1c047353a95e7ac079ccf89af8fc232451b8f891
+Author: Dennis Camera <dennis.camera@ssrq-sds-fds.ch>
+Forwarded: 'not-needed'
+Last-Update: 2021-04-17
+--- a/bin/cdist
++++ b/bin/cdist
+@@ -72,9 +72,11 @@
+
+
+ if __name__ == "__main__":
+- if sys.version < cdist.MIN_SUPPORTED_PYTHON_VERSION:
+- print('Python >= {} is required on the source host.'.format(
+- cdist.MIN_SUPPORTED_PYTHON_VERSIO), file=sys.stderr)
++ if sys.version_info[:3] < cdist.MIN_SUPPORTED_PYTHON_VERSION:
++ print(
++ 'Python >= {} is required on the source host.'.format(
++ ".".join(map(str, cdist.MIN_SUPPORTED_PYTHON_VERSION))),
++ file=sys.stderr)
+ sys.exit(1)
+
+ exit_code = 0
+--- a/cdist/__init__.py
++++ b/cdist/__init__.py
+@@ -64,7 +64,7 @@
+ REMOTE_CMDS_CLEANUP_PATTERN = "ssh -o User=root -O exit -S {}"
+
+
+-MIN_SUPPORTED_PYTHON_VERSION = '3.5'
++MIN_SUPPORTED_PYTHON_VERSION = (3, 5)
+
+
+ class Error(Exception):
Reply to: