Skip to content

Commit

Permalink
fixed: used a loop on checking versions
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickAlphaC committed Sep 11, 2024
1 parent 1b1b2b5 commit bb995e3
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions gaboon/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit bb995e3

Please sign in to comment.