Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependencies: replace semver by packaging to compare versions #177

Merged
merged 1 commit into from
Jan 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions qgis_deployment_toolbelt/commands/cli_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

# 3rd party library
import click
import semver
from packaging.version import Version

# submodules
from qgis_deployment_toolbelt.__about__ import __title__, __uri_repository__
Expand Down Expand Up @@ -139,9 +139,7 @@ def upgrade(check_only: bool, where: Path):

# compare it
latest_version = latest_release.get("tag_name")
if semver.VersionInfo.parse(actual_version) < semver.VersionInfo.parse(
latest_version
):
if Version(actual_version) < Version(latest_version):
if check_only:
exit_cli_normal(
f"A newer version is available: {latest_version}", abort=True
Expand Down
1 change: 0 additions & 1 deletion requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,5 @@ packaging>=20,<24
pyyaml>=5.4,<7
py-setenv>=1.1,<1.2
pywin32==305 ; sys_platform == 'win32'
semver>=2.13,<2.14
send2trash>=1.7.1
typing-extensions>=4,<5 ; python_version < '3.11'
4 changes: 2 additions & 2 deletions tests/test_about.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import unittest

# 3rd party
from semver import VersionInfo
from packaging.version import parse
from validators import url

# project
Expand Down Expand Up @@ -59,7 +59,7 @@ def test_metadata_types(self):

def test_version_semver(self):
"""Test if version comply with semantic versioning."""
self.assertTrue(VersionInfo.isvalid(__about__.__version__))
self.assertTrue(parse(__about__.__version__))


# ############################################################################
Expand Down