Hi,
Those two patches should fix autopkgtest.
The importlib one shouldn't be a problem.
The looseversion one, otoh, requires a bit more attention. LooseVersion
was part of distutils, and got removed with Python 3.12, but there
doesn't seem to be any replacement anywhere in the standard library.
There are basically two solutions here for now:
* use that patch since setuptools is already packaged and provide a
working implementation of LooseVersion. It's still in a `._distutils`
module, which doesn't make it appear as being officially part of the
API, meaning it could break eventually if it gets removed from here too.
* make another patch that would make use of the `looseversion`
package [1], that is currently not packaged in Debian, but should
probably be the safer way forward, since the only purpose of that
package is to provide that API. I haven't yet started the work of
packaging that `looseversion` module, and don't know if that's the right
path forward.
Obviously, this also depends on what solution upstream will take to
support Python 3.12. I've already opened an issue here:
https://github.com/ClusterLabs/crmsh/issues/1324
I also have that branch that passes autopkgtests locally:
https://git.launchpad.net/~hyask/ubuntu/+source/crmsh/log/
[1]: https://github.com/effigies/looseversion
Skiadiff --git a/test/unittests/test_utils.py b/test/unittests/test_utils.py
index 77fd14b0b67d..900e8528143a 100644
--- a/test/unittests/test_utils.py
+++ b/test/unittests/test_utils.py
@@ -7,7 +7,7 @@ from __future__ import unicode_literals
import os
import socket
import re
-import imp
+import importlib
import subprocess
import unittest
import pytest
@@ -24,7 +24,7 @@ def setup_function():
utils._ip_for_cloud = None
# Mock memoize method and reload the module under test later with imp
mock.patch('crmsh.utils.memoize', lambda x: x).start()
-imp.reload(utils)
+importlib.reload(utils)
@mock.patch("crmsh.utils.get_stdout_stderr")
diff --git a/crmsh/ra.py b/crmsh/ra.py
index 6060ec7a3fd5..fcadc860aa5f 100644
--- a/crmsh/ra.py
+++ b/crmsh/ra.py
@@ -49,15 +49,15 @@ def crm_resource(opts):
@utils.memoize
def can_use_lrmadmin():
-from distutils import version
+from setuptools._distutils.version import LooseVersion
# after this glue release all users can get meta-data and
# similar from lrmd
minimum_glue = "1.0.10"
_rc, glue_ver = get_stdout("%s -v" % lrmadmin_prog, stderr_on=False)
if not glue_ver: # lrmadmin probably not found
return False
-v_min = version.LooseVersion(minimum_glue)
-v_this = version.LooseVersion(glue_ver)
+v_min = LooseVersion(minimum_glue)
+v_this = LooseVersion(glue_ver)
if v_this < v_min:
return False
if userdir.getuser() not in ("root", config.path.crm_daemon_user):
diff --git a/crmsh/utils.py b/crmsh/utils.py
index 51ff5b326d56..40c74a9019b5 100644
--- a/crmsh/utils.py
+++ b/crmsh/utils.py
@@ -34,7 +34,7 @@ from . import userdir
from . import constants
from . import options
from . import term
-from distutils.version import LooseVersion
+from setuptools._distutils.version import LooseVersion
from .constants import SSH_OPTION
from . import log
diff --git a/debian/control b/debian/control
index 8fe560e13935..ea924b952335 100644
--- a/debian/control
+++ b/debian/control
@@ -40,6 +40,7 @@ Depends:
python3-lxml,
python3-packaging,
python3-parallax,
+ python3-setuptools,
python3-yaml
Recommends: pacemaker (>= 1.1.12)
Replaces: pacemaker (<< 1.1.12)