Skip to content

Commit

Permalink
Switch from pkg_resources.parse_version to packaging.version (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
cottsay authored Feb 27, 2024
1 parent ae5aa36 commit 11865de
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
package_augmentation_logger
from colcon_core.package_augmentation import PackageAugmentationExtensionPoint
from colcon_core.plugin_system import satisfies_version
from pkg_resources import parse_version
from packaging.version import Version

logger = package_augmentation_logger.getChild('check_dependency_constraint')

Expand Down Expand Up @@ -46,7 +46,7 @@ def _check_version_constraints(self, desc, dep, dep_desc):
if 'version' not in dep_desc.metadata:
return
try:
dep_version = parse_version(dep_desc.metadata['version'])
dep_version = Version(dep_desc.metadata['version'])
except Exception: # noqa: B902
# skip check if the version fails to parse
return
Expand All @@ -71,7 +71,7 @@ def gte(a, b):
continue
op, msg = operators[key]
try:
version_constraint = parse_version(value)
version_constraint = Version(value)
except Exception: # noqa: B902
logger.error(
"Failed to parse version '" + value + "' with " +
Expand Down
3 changes: 2 additions & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ keywords = colcon
python_requires = >=3.6
install_requires =
colcon-core>=0.5.2
packaging
packages = find:
zip_safe = true

Expand All @@ -53,7 +54,7 @@ filterwarnings =
error
# Suppress deprecation warnings in other packages
ignore:lib2to3 package is deprecated::scspell
ignore:pkg_resources is deprecated as an API::
ignore:pkg_resources is deprecated as an API::flake8_import_order
ignore:SelectableGroups dict interface is deprecated::flake8
ignore:Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated::pyreadline
junit_suite_name = colcon-package-information
Expand Down
2 changes: 1 addition & 1 deletion stdeb.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[colcon-package-information]
No-Python2:
Depends3: python3-colcon-core (>= 0.5.2)
Depends3: python3-colcon-core (>= 0.5.2), python3-packaging
Suite: focal jammy noble bookworm trixie
X-Python3-Version: >= 3.6

0 comments on commit 11865de

Please sign in to comment.