From f27fe0c129a135b854d0de7a7f5c2771b805c2ad Mon Sep 17 00:00:00 2001 From: Shubham Sharma Date: Thu, 27 Jul 2023 12:02:56 +0530 Subject: [PATCH] Use semver package Signed-off-by: Shubham Sharma --- .../azext_k8s_extension/partner_extensions/Dapr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py b/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py index 752e6c39587..46520c69a7a 100644 --- a/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py +++ b/src/k8s-extension/azext_k8s_extension/partner_extensions/Dapr.py @@ -13,7 +13,7 @@ from copy import deepcopy from knack.log import get_logger from knack.prompting import prompt, prompt_y_n -from packaging import version as packaging_version +from semver import VersionInfo from ..vendored_sdks.models import Extension, PatchExtension, Scope, ScopeCluster from .DefaultExtension import DefaultExtension @@ -204,7 +204,7 @@ def _is_downgrade(v1: str, v2: str) -> bool: Returns True if version v1 is less than version v2. """ try: - return packaging_version.Version(v1) < packaging_version.Version(v2) - except packaging_version.InvalidVersion: + return VersionInfo.parse(v1) < VersionInfo.parse(v2) + except ValueError: logger.debug("Warning: Unable to compare versions %s and %s.", v1, v2) return True # This will cause the apply-CRDs hook to be disabled, which is safe.