diff options
Diffstat (limited to 'pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py')
-rwxr-xr-x | pkgs/development/interpreters/python/update-python-libraries/update-python-libraries.py | 38 |
1 files changed, 21 insertions, 17 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 fbc096502fa7e..57153383fc189 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 @@ -275,16 +275,17 @@ def _get_latest_version_github(attr_path, package, extension, current_version, t release = next(filter(lambda x: strip_prefix(x["tag_name"]) == version, releases)) prefix = get_prefix(release["tag_name"]) - # some attributes require using the fetchgit - git_fetcher_args = [] - if _get_attr_value(f"{attr_path}.src.fetchSubmodules"): - git_fetcher_args.append("--fetch-submodules") - if _get_attr_value(f"{attr_path}.src.fetchLFS"): - git_fetcher_args.append("--fetch-lfs") - if _get_attr_value(f"{attr_path}.src.leaveDotGit"): - git_fetcher_args.append("--leave-dotGit") - - if git_fetcher_args or _get_attr_value(f"{attr_path}.src.fetcher").endswith("nix-prefetch-git"): + fetcher = _get_attr_value(f"{attr_path}.src.fetcher") + if fetcher is not None and fetcher.endswith("nix-prefetch-git"): + # some attributes require using the fetchgit + git_fetcher_args = [] + if _get_attr_value(f"{attr_path}.src.fetchSubmodules"): + git_fetcher_args.append("--fetch-submodules") + if _get_attr_value(f"{attr_path}.src.fetchLFS"): + git_fetcher_args.append("--fetch-lfs") + if _get_attr_value(f"{attr_path}.src.leaveDotGit"): + git_fetcher_args.append("--leave-dotGit") + algorithm = "sha256" cmd = [ "nix-prefetch-git", @@ -319,14 +320,17 @@ def _get_latest_version_github(attr_path, package, extension, current_version, t tag_url = str(release["tarball_url"]).replace( "tarball", "tarball/refs/tags" ) - hash = ( - subprocess.check_output( - ["nix-prefetch-url", "--type", "sha256", "--unpack", tag_url], - stderr=subprocess.DEVNULL, + try: + hash = ( + subprocess.check_output( + ["nix-prefetch-url", "--type", "sha256", "--unpack", tag_url], + stderr=subprocess.DEVNULL, + ) + .decode("utf-8") + .strip() ) - .decode("utf-8") - .strip() - ) + except subprocess.CalledProcessError: + raise ValueError("nix-prefetch-url failed") return version, hash, prefix |