From fa024e2f65021b2019d94912c8d09d1a8df29b9b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dirk=20M=C3=BCller?= Date: Tue, 14 May 2024 17:30:23 +0200 Subject: [PATCH] Treat LegacyVersion as InvalidVersion 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 "" instead. --- set_version | 3 +++ 1 file changed, 3 insertions(+) diff --git a/set_version b/set_version index 68f9d25..22a8a00 100755 --- a/set_version +++ b/set_version @@ -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