From 217c66bbb392992e276ca81869772db60951c996 Mon Sep 17 00:00:00 2001 From: Peder Hovdan Andresen <107681714+pederhan@users.noreply.github.com> Date: Fri, 24 Nov 2023 12:19:31 +0100 Subject: [PATCH] Replace distutils.version with packaging.version (#164) --- setup.py | 2 +- zabbix_cli/cli.py | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/setup.py b/setup.py index ce903b26..3e4e1955 100755 --- a/setup.py +++ b/setup.py @@ -39,7 +39,7 @@ if sys.version_info < (3, 6): raise SystemExit('ERROR: zabbix-cli needs at least python 3.6 to work') - install_requires = ['requests'] + install_requires = ['requests', 'packaging'] # # Setup diff --git a/zabbix_cli/cli.py b/zabbix_cli/cli.py index 93adf725..b6c5c5d9 100644 --- a/zabbix_cli/cli.py +++ b/zabbix_cli/cli.py @@ -21,7 +21,6 @@ # import cmd import datetime -import distutils.version import glob import hashlib import ipaddress @@ -37,6 +36,8 @@ import textwrap import time +from packaging.version import Version + import zabbix_cli import zabbix_cli.apiutils import zabbix_cli.utils @@ -4935,8 +4936,8 @@ def do_acknowledge_event(self, args): return False # Hotfix for Zabbix 4.0 compability - api_version = distutils.version.StrictVersion(self.zapi.api_version()) - if api_version >= distutils.version.StrictVersion("4.0"): + api_version = Version(self.zapi.api_version()) + if api_version >= Version("4.0"): if close == 'false': action = 6 # "Add message" and "Acknowledge" elif close == 'true': @@ -5050,8 +5051,8 @@ def do_acknowledge_trigger_last_event(self, args): event_ids.append(data[0]['eventid']) # Hotfix for Zabbix 4.0 compability - api_version = distutils.version.StrictVersion(self.zapi.api_version()) - if api_version >= distutils.version.StrictVersion("4.0"): + api_version = Version(self.zapi.api_version()) + if api_version >= Version("4.0"): if close == 'false': action = 6 # "Add message" and "Acknowledge" elif close == 'true':