Skip to content

Commit

Permalink
Merge pull request #44 from jwodder/parse-version
Browse files Browse the repository at this point in the history
Replace `pkg_resources.parse_version` with `packaging.version.Version`
  • Loading branch information
satra authored Oct 13, 2023
2 parents 88adc39 + 65d4237 commit 5bdab69
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:

runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9, "3.10"]
Expand All @@ -37,4 +38,4 @@ jobs:
file: ./cov.xml # optional
flags: unittests # optional
name: codecov-et # optional
fail_ci_if_error: true # optional (default = false)
fail_ci_if_error: false
9 changes: 4 additions & 5 deletions etelemetry/client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from packaging.version import Version

try:
import ci_info
Expand Down Expand Up @@ -92,8 +93,6 @@ def check_available_version(project, version, lgr=None, raise_exception=False):
import logging
lgr = logging.getLogger('et-client')

from pkg_resources import parse_version

latest = {"version": "Unknown", "bad_versions": []}
ret = None
try:
Expand All @@ -104,8 +103,8 @@ def check_available_version(project, version, lgr=None, raise_exception=False):
finally:
if ret:
latest.update(**ret)
local_version = parse_version(version)
remote_version = parse_version(latest["version"])
local_version = Version(version)
remote_version = Version(latest["version"])
if local_version < remote_version:
lgr.warning("A newer version (%s) of %s is available. You are "
"using %s", latest["version"], project, version)
Expand All @@ -118,7 +117,7 @@ def check_available_version(project, version, lgr=None, raise_exception=False):
version, project)
if latest["bad_versions"] and any(
[
local_version == parse_version(ver)
local_version == Version(ver)
for ver in latest["bad_versions"]
]
):
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ classifiers =
[options]
python_requires = >= 3.7
install_requires =
packaging
requests
ci-info >= 0.2
test_requires =
Expand Down

0 comments on commit 5bdab69

Please sign in to comment.