update-python-libraries: make hermetic

+16 -11
+6 -4
pkgs/by-name/up/update-python-libraries/package.nix
··· 1 1 { 2 + lib, 2 3 python3, 3 4 runCommand, 4 5 git, ··· 9 10 runCommand "update-python-libraries" 10 11 { 11 12 buildInputs = [ 12 - nix 13 - nix-prefetch-git 14 13 (python3.withPackages ( 15 14 ps: with ps; [ 16 15 packaging ··· 18 17 toolz 19 18 ] 20 19 )) 21 - git 22 20 ]; 23 21 } 24 22 '' 25 23 cp ${./update-python-libraries.py} $out 26 24 patchShebangs $out 27 - substituteInPlace $out --replace 'GIT = "git"' 'GIT = "${git}/bin/git"' 25 + substituteInPlace $out \ 26 + --replace-fail 'NIX = "nix"' 'NIX = "${lib.getExe nix}"' \ 27 + --replace-fail 'NIX_PREFETCH_URL = "nix-prefetch-url"' 'NIX_PREFETCH_URL = "${lib.getExe' nix "nix-prefetch-url"}"' \ 28 + --replace-fail 'NIX_PREFETCH_GIT = "nix-prefetch-git"' 'NIX_PREFETCH_GIT = "${lib.getExe nix-prefetch-git}"' \ 29 + --replace-fail 'GIT = "git"' 'GIT = "${lib.getExe git}"' 28 30 ''
+10 -7
pkgs/by-name/up/update-python-libraries/update-python-libraries.py
··· 36 36 37 37 BULK_UPDATE = False 38 38 39 + NIX = "nix" 40 + NIX_PREFETCH_URL = "nix-prefetch-url" 41 + NIX_PREFETCH_GIT = "nix-prefetch-git" 39 42 GIT = "git" 40 43 41 44 NIXPKGS_ROOT = ( 42 - subprocess.check_output(["git", "rev-parse", "--show-toplevel"]) 45 + subprocess.check_output([GIT, "rev-parse", "--show-toplevel"]) 43 46 .decode("utf-8") 44 47 .strip() 45 48 ) ··· 79 82 try: 80 83 response = subprocess.check_output( 81 84 [ 82 - "nix", 85 + NIX, 83 86 "--extra-experimental-features", 84 87 "nix-command", 85 88 "eval", ··· 164 167 return ( 165 168 subprocess.check_output( 166 169 [ 167 - "nix", 170 + NIX, 168 171 "--extra-experimental-features", 169 172 "nix-command", 170 173 "hash", ··· 260 263 try: 261 264 homepage = subprocess.check_output( 262 265 [ 263 - "nix", 266 + NIX, 264 267 "--extra-experimental-features", 265 268 "nix-command", 266 269 "eval", ··· 301 304 302 305 algorithm = "sha256" 303 306 cmd = [ 304 - "nix-prefetch-git", 307 + NIX_PREFETCH_GIT, 305 308 f"https://github.com/{owner}/{repo}.git", 306 309 "--hash", 307 310 algorithm, ··· 317 320 hash = ( 318 321 subprocess.check_output( 319 322 [ 320 - "nix-prefetch-url", 323 + NIX_PREFETCH_URL, 321 324 "--type", 322 325 "sha256", 323 326 "--unpack", ··· 336 339 try: 337 340 hash = ( 338 341 subprocess.check_output( 339 - ["nix-prefetch-url", "--type", "sha256", "--unpack", tag_url], 342 + [NIX_PREFETCH_URL, "--type", "sha256", "--unpack", tag_url], 340 343 stderr=subprocess.DEVNULL, 341 344 ) 342 345 .decode("utf-8")