fix: use packaging.version instead of distutils

distutils is dead
This commit is contained in:
tretrauit 2024-02-06 12:04:53 +07:00
parent 70eb0e9443
commit bdf1f8d785
3 changed files with 4 additions and 3 deletions

2
poetry.lock generated
View File

@ -571,4 +571,4 @@ test = ["covdefaults (>=2.3)", "coverage (>=7.2.7)", "coverage-enable-subprocess
[metadata]
lock-version = "2.0"
python-versions = "^3.11"
content-hash = "20ec55c42e3ed67b4e3ae1a3da83a89b7e9ac1fd7d2c50c82959b1b951149611"
content-hash = "c2407ab07d5b45a15d2081a4b930574da4b55e04503e07e2cfa38f5cdbdb68e4"

View File

@ -11,6 +11,7 @@ python = "^3.11"
platformdirs = "^3.5.1"
requests = "^2.31.0"
cleo = "^2.1.0"
packaging = "^23.2"
[tool.poetry.group.dev.dependencies]
pytest = "^7.3.1"

View File

@ -1,6 +1,6 @@
from enum import Enum
from shutil import copy2, rmtree
from distutils.version import StrictVersion
from packaging import version
from vollerei.abc.patcher import PatcherABC
from vollerei.common import telemetry
from vollerei.exceptions.game import GameNotInstalledError
@ -66,7 +66,7 @@ class Patcher(PatcherABC):
with open(self._jadeite.joinpath("version"), "r") as f:
current_version = f.read()
if current_version:
if StrictVersion(file_version) <= StrictVersion(current_version):
if version.parse(file_version) <= version.parse(current_version):
return
download_and_extract(file, self._jadeite)
with open(self._jadeite.joinpath("version"), "w") as f: