Skip to content

Commit

Permalink
Replace distutils with packaging
Browse files Browse the repository at this point in the history
distutils was removed in Python 3.12 and the packaging module is already
a dependency of at least one of our current dependencies.
  • Loading branch information
clenk committed Feb 7, 2024
1 parent 356589d commit e293ba0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/utility/base_world.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import yaml
import logging
import subprocess
import distutils.version
import packaging.version
from base64 import b64encode, b64decode
from datetime import datetime, timezone
from importlib import import_module
Expand Down Expand Up @@ -126,7 +126,7 @@ def check_program_version(command, version, **kwargs):

def compare_versions(version_string, minimum_version):
version = parse_version(version_string)
return distutils.version.StrictVersion(version) >= distutils.version.StrictVersion(str(minimum_version))
return packaging.version.parse(version) >= packaging.version.parse(str(minimum_version))

def parse_version(version_string, pattern=r'([0-9]+(?:\.[0-9]+)+)'):
groups = re.search(pattern, version_string)
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ Markdown==3.4.4 # training
dnspython==2.4.2
asyncssh==2.14.1
aioftp~=0.20.0
packaging==23.2

0 comments on commit e293ba0

Please sign in to comment.