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

[Dapr] Use semver instead of packaging #241

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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.