Skip to content

Commit

Permalink
fix saltstack#66686: don't fail for InvalidVersion, instead drop the …
Browse files Browse the repository at this point in the history
…version as-if it was never there
  • Loading branch information
Legrems committed Jul 3, 2024
1 parent 3618966 commit f24ae27
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions salt/modules/pip.py
Original file line number Diff line number Diff line change
Expand Up @@ -1696,11 +1696,18 @@ def list_all_versions(
for line in result["stdout"].splitlines():
match = regex.search(line)
if match:
versions = [
v for v in match.group(1).split(", ") if v and excludes.match(v)
]
versions.sort(key=pkg_resources.parse_version)
break
versions = []
for v in match.group(1).split(", "):
if v and excludes.match(v):
try:
pkg_resources.parse_version(v)

except pkg_resources.extern.packaging.version.InvalidVersion as e:
logger.info(f"{e} for package {pkg}, skipping this version...")
continue

versions.append(v)

if not versions:
return None

Expand Down

0 comments on commit f24ae27

Please sign in to comment.