diff options
author | Jonathan Ringer <jonringer117@gmail.com> | 2021-06-18 17:41:44 -0700 |
---|---|---|
committer | Martin Weinelt <hexa@darmstadt.ccc.de> | 2021-06-22 13:42:46 +0200 |
commit | 48d0ca0c05925741e698fb55dc6459c11f77962f (patch) | |
tree | b987de8b3f59d7ec9fb5cfca9881958765e7ecc3 /pkgs/development/interpreters | |
parent | d0e776436eb1a0767edba09b41002bc68ceab5ca (diff) |
update-python-libraries: handle github branches and tags with same name
Diffstat (limited to 'pkgs/development/interpreters')
-rwxr-xr-x | pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py b/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py index 9054195ab7e6b..d3642592ae43b 100755 --- a/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py +++ b/pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py @@ -217,8 +217,15 @@ def _get_latest_version_github(package, extension, current_version, target): release = next(filter(lambda x: strip_prefix(x['tag_name']) == version, releases)) prefix = get_prefix(release['tag_name']) - sha256 = subprocess.check_output(["nix-prefetch-url", "--type", "sha256", "--unpack", f"{release['tarball_url']}"], stderr=subprocess.DEVNULL)\ - .decode('utf-8').strip() + try: + sha256 = subprocess.check_output(["nix-prefetch-url", "--type", "sha256", "--unpack", f"{release['tarball_url']}"], stderr=subprocess.DEVNULL)\ + .decode('utf-8').strip() + except: + # this may fail if they have both a branch and a tag of the same name, attempt tag name + tag_url = str(release['tarball_url']).replace("tarball","tarball/refs/tags") + sha256 = subprocess.check_output(["nix-prefetch-url", "--type", "sha256", "--unpack", tag_url], stderr=subprocess.DEVNULL)\ + .decode('utf-8').strip() + return version, sha256, prefix |