Skip to content

Commit

Permalink
Replace distutils.version with packaging.version (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
pederhan authored Nov 24, 2023
1 parent 2cd2928 commit 217c66b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 6 additions & 5 deletions zabbix_cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#
import cmd
import datetime
import distutils.version
import glob
import hashlib
import ipaddress
Expand All @@ -37,6 +36,8 @@
import textwrap
import time

from packaging.version import Version

import zabbix_cli
import zabbix_cli.apiutils
import zabbix_cli.utils
Expand Down Expand Up @@ -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':
Expand Down Expand Up @@ -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':
Expand Down

0 comments on commit 217c66b

Please sign in to comment.