From b2c0a291d981fb1783c1e33a68c741d21942a4ee Mon Sep 17 00:00:00 2001 From: Filipe Fernandes Date: Wed, 9 Aug 2023 11:13:50 -0300 Subject: [PATCH] remove distutils --- compliance_checker/suite.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/compliance_checker/suite.py b/compliance_checker/suite.py index c512f91b..7d922110 100644 --- a/compliance_checker/suite.py +++ b/compliance_checker/suite.py @@ -13,7 +13,6 @@ import warnings from collections import defaultdict from datetime import datetime, timezone -from distutils.version import StrictVersion from operator import itemgetter from pathlib import Path from urllib.parse import urlparse @@ -23,6 +22,7 @@ from netCDF4 import Dataset from owslib.sos import SensorObservationService from owslib.swe.sensor.sml import SensorML +from packaging.version import parse from pkg_resources import working_set from compliance_checker import __version__, tempnc @@ -186,9 +186,8 @@ def _load_checkers(cls, checkers): for spec, versions in itertools.groupby(ver_checkers, itemgetter(0)): version_nums = [v[-1] for v in versions] try: - latest_version = str(max(StrictVersion(v) for v in version_nums)) - # if the version can't be parsed as a StrictVersion, parse - # according to character collation + latest_version = str(max(parse(v) for v in version_nums)) + # if the version can't be parsed, do it according to character collation except ValueError: latest_version = max(version_nums) cls.checkers[spec] = cls.checkers[spec + ":latest"] = cls.checkers[