diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:49:00 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:49:00 +0000 |
commit | 93907d0c009d758811b54e7984337477a39f05cf (patch) | |
tree | a34881e1b02ccd5281ca58a799877f2d5e80d778 /debian/patches/0020-Replace-distutils.patch | |
parent | Adding upstream version 4.6.0. (diff) | |
download | crmsh-93907d0c009d758811b54e7984337477a39f05cf.tar.xz crmsh-93907d0c009d758811b54e7984337477a39f05cf.zip |
Adding debian version 4.6.0-1.debian/4.6.0-1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/patches/0020-Replace-distutils.patch')
-rw-r--r-- | debian/patches/0020-Replace-distutils.patch | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/debian/patches/0020-Replace-distutils.patch b/debian/patches/0020-Replace-distutils.patch new file mode 100644 index 0000000..fd5cfb3 --- /dev/null +++ b/debian/patches/0020-Replace-distutils.patch @@ -0,0 +1,75 @@ +Description: Fix build with python 3.12 +Author: Valentin Vidic <vvidic@debian.org> +Last-Update: 2024-03-04 +--- +This patch header follows DEP-3: http://dep.debian.net/deps/dep3/ +--- a/crmsh/ra.py ++++ b/crmsh/ra.py +@@ -50,15 +50,15 @@ + + @utils.memoize + def can_use_lrmadmin(): +- from distutils import version ++ from packaging.version import Version + # after this glue release all users can get meta-data and + # similar from lrmd + minimum_glue = "1.0.10" + _rc, glue_ver = ShellUtils().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 = Version(minimum_glue) ++ v_this = Version(glue_ver) + if v_this < v_min: + return False + if userdir.getuser() not in ("root", config.path.crm_daemon_user): +--- a/crmsh/utils.py ++++ b/crmsh/utils.py +@@ -37,7 +37,7 @@ + from . import constants + from . import options + from . import term +-from distutils.version import LooseVersion ++from packaging import version + from .constants import SSH_OPTION + from . import log + from .prun import prun +@@ -1632,8 +1632,15 @@ + return val_l + + +-def is_larger_than_min_version(version, min_version): +- return LooseVersion(version) >= LooseVersion(min_version) ++def is_larger_than_min_version(this_version, min_version): ++ version_re = re.compile(version.VERSION_PATTERN, re.VERBOSE | re.IGNORECASE) ++ match1 = version_re.search(this_version) ++ if not match1: ++ raise InvalidVersion(f"Invalid version: '{this_version}'") ++ match2 = version_re.search(min_version) ++ if not match2: ++ raise InvalidVersion(f"Invalid version: '{min_version}'") ++ return version.parse(match1.group(0)) >= version.parse(match2.group(0)) + + + def is_min_pcmk_ver(min_ver, cib_f=None): +--- a/test/unittests/test_utils.py ++++ b/test/unittests/test_utils.py +@@ -7,7 +7,7 @@ + import os + import socket + import re +-import imp ++import importlib + import subprocess + import unittest + import pytest +@@ -24,7 +24,7 @@ + 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.sh.ShellUtils.get_stdout_stderr") |