diff --git a/onlinejudge_command/update_checking.py b/onlinejudge_command/update_checking.py index 5f202174..e85bcc16 100644 --- a/onlinejudge_command/update_checking.py +++ b/onlinejudge_command/update_checking.py @@ -1,10 +1,10 @@ -import distutils.version import http.client import json import time from logging import getLogger from typing import * +import packaging.version import requests import onlinejudge.__about__ as api_version @@ -73,8 +73,8 @@ def get_latest_version_from_pypi(package_name: str) -> str: def is_update_available_on_pypi(package_name: str, current_version: str) -> bool: - a = distutils.version.StrictVersion(current_version) - b = distutils.version.StrictVersion(get_latest_version_from_pypi(package_name)) + a = packaging.version.parse(current_version) + b = packaging.version.parse(get_latest_version_from_pypi(package_name)) return a < b diff --git a/setup.py b/setup.py index 56ae0712..37665f5d 100755 --- a/setup.py +++ b/setup.py @@ -15,6 +15,7 @@ install_requires=[ 'online-judge-api-client >= 10.9.0, < 11', 'colorama >= 0.3, < 1', + 'packaging >= 24', 'requests >= 2, < 3', ], packages=find_packages(exclude=('tests', 'docs')),