From bb995e309ffb2d0dea15861bb2bd660db68d49ad Mon Sep 17 00:00:00 2001 From: PatrickAlphaC <54278053+PatrickAlphaC@users.noreply.github.com> Date: Wed, 11 Sep 2024 11:18:59 -0400 Subject: [PATCH] fixed: used a loop on checking versions --- gaboon/commands/install.py | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/gaboon/commands/install.py b/gaboon/commands/install.py index c8fdc6d..a76b075 100644 --- a/gaboon/commands/install.py +++ b/gaboon/commands/install.py @@ -216,14 +216,19 @@ def _get_download_url_from_tag(org: str, repo: str, version: str, headers: dict) data = response.json() if not data: raise ValueError("Github repository has no tags set") - org, repo = data[0]["zipball_url"].split("/")[3:5] - tags = [i["name"].lstrip("v") for i in data] - if version not in tags: - raise ValueError( - "Invalid version for this package. Available versions are:\n" - + ", ".join(tags) - ) from None - return next(i["zipball_url"] for i in data if i["name"].lstrip("v") == version) + + available_versions = [] + for tag in data: + tag_version = tag["name"].lstrip("v") + available_versions.append(tag_version) + if tag_version == version: + return tag["zipball_url"] + + # If we've gone through all tags without finding a match, raise an error + raise ValueError( + f"Invalid version '{version}' for this package. Available versions are:\n" + + ", ".join(available_versions) + ) def _pip_installs(