-
Notifications
You must be signed in to change notification settings - Fork 66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix bug on update_package.py #1162
base: main
Are you sure you want to change the base?
Conversation
Update comments on update_package.py add comments that help understand the issue that the latest sclauncher doesn't get updated. The version from the regex (current version) didn't include `v` however the function get_latest_version did include the `v`. The URL replaced the version without `v` (current version) with the latest version found that included the `v`, which resulted in the wrong URL `https://github.com/jstrosch/sclauncher/releases/download/vv0.0.6/sclauncher.exe`
@@ -37,7 +37,10 @@ def get_latest_version(org, project, version): | |||
print(f"GitHub API response not ok: {response.status_code}") | |||
return None | |||
latest_version = response.json()["tag_name"] | |||
return latest_version | |||
if latest_version.startswith('v'): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@naacbin introduced the support for packages whose version is preceded by v
in #1067, but it seems the v
was only taken into account when matching the url in the file and not to get the latest version, so it seems like the fix has never worked.
What is really getting me confused is that I see upx being correctly updated by our bot in acec181 before #1067, how is this possible? 🕵️♀️
@@ -37,7 +37,10 @@ def get_latest_version(org, project, version): | |||
print(f"GitHub API response not ok: {response.status_code}") | |||
return None | |||
latest_version = response.json()["tag_name"] | |||
return latest_version | |||
if latest_version.startswith('v'): | |||
return latest_version.replace('v','',1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A bit more elegant 😉
return latest_version.replace('v','',1) | |
return latest_version[1:] |
@@ -104,6 +107,7 @@ def update_github_url(package): | |||
|
|||
latest_version = None | |||
for url, org, project, version in matches: | |||
# version excludes `v` from the capturing group in the regex therefore latest_version_match mustn't include `v` if the version starts with `v` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you move this comment (maybe with a bit rewording needed) just before the line if latest_version.startswith('v'):
? Here it is difficult to understand what it is refering to 😕
fix issue #1142 for when --update-type is GITHUB_URL