1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-03-22 21:29:19 +00:00

uv_python module: refactor code

This commit is contained in:
Mariam Ahhttouche 2026-02-18 11:18:14 +01:00
parent afbe833c02
commit 0b158b6153

View file

@ -87,7 +87,7 @@ class UV:
"""
rc, out, _ = self._find_python("--show-version")
if rc == 0:
return False, out.split()[0], "", rc
return False, out.strip(), "", rc
if self.module.check_mode:
_, versions_available, _ = self._list_python()
# when uv does not find any available patch version the install command will fail
@ -134,7 +134,7 @@ class UV:
latest_version = self._get_latest_patch_release()
if not latest_version:
self.module.fail_json(msg=f"Version {self.python_version_str} is not available.")
if rc == 0 and out.split()[0] == latest_version:
if rc == 0 and out.strip() == latest_version:
return False, latest_version, "", rc
if self.module.check_mode:
return True, latest_version, "", 0