Skip to content

Commit

Permalink
Treat LegacyVersion as InvalidVersion
Browse files Browse the repository at this point in the history
This resolves a behavior difference with the packaging 21.3 version
on Leap 15.2 where parsing('1.7.40~svn') does not raise an
InvalidVersion exception but returns "<LegacyVersion('1.7.40~svn')>"
instead.
  • Loading branch information
dirkmueller committed May 14, 2024
1 parent fe6061f commit fa024e2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions set_version
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ def _version_python_pip2rpm(version_pip):

try:
v = parse(version_pip)
with suppress(NameError):
if isinstance(v, LegacyVersion):
raise InvalidVersion
except InvalidVersion:
# Maybe is converted already?
return None
Expand Down

0 comments on commit fa024e2

Please sign in to comment.