mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 16:33:15 +00:00
fetchPypiLegacy: add test
This commit is contained in:
parent
d52b3a7cc0
commit
81d43b9b83
@ -14,6 +14,8 @@
|
|||||||
file,
|
file,
|
||||||
# SRI hash
|
# SRI hash
|
||||||
hash,
|
hash,
|
||||||
|
# allow overriding the derivation name
|
||||||
|
name ? null,
|
||||||
}:
|
}:
|
||||||
let
|
let
|
||||||
urls' = urls ++ lib.optional (url != null) url;
|
urls' = urls ++ lib.optional (url != null) url;
|
||||||
@ -27,17 +29,16 @@ let
|
|||||||
in
|
in
|
||||||
# Assert that we have at least one URL
|
# Assert that we have at least one URL
|
||||||
assert urls' != [ ]; runCommand file
|
assert urls' != [ ]; runCommand file
|
||||||
{
|
({
|
||||||
nativeBuildInputs = [ python3 ];
|
nativeBuildInputs = [ python3 ];
|
||||||
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
impureEnvVars = lib.fetchers.proxyImpureEnvVars;
|
||||||
outputHashMode = "flat";
|
outputHashMode = "flat";
|
||||||
outputHashAlgo = null;
|
# if hash is empty select a default algo to let nix propose the actual hash.
|
||||||
|
outputHashAlgo = if hash == "" then "sha256" else null;
|
||||||
outputHash = hash;
|
outputHash = hash;
|
||||||
NETRC = netrc_file;
|
NETRC = netrc_file;
|
||||||
passthru = {
|
|
||||||
urls = urls';
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
// (lib.optionalAttrs (name != null) {inherit name;}))
|
||||||
''
|
''
|
||||||
python ${./fetch-legacy.py} ${lib.concatStringsSep " " (map (url: "--url ${lib.escapeShellArg url}") urls')} --pname ${pname} --filename ${file}
|
python ${./fetch-legacy.py} ${lib.concatStringsSep " " (map (url: "--url ${lib.escapeShellArg url}") urls')} --pname ${pname} --filename ${file}
|
||||||
mv ${file} $out
|
mv ${file} $out
|
||||||
|
9
pkgs/build-support/fetchpypilegacy/tests.nix
Normal file
9
pkgs/build-support/fetchpypilegacy/tests.nix
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{ testers, fetchPypiLegacy, ... }: {
|
||||||
|
# Tests that we can send custom headers with spaces in them
|
||||||
|
fetchSimple = testers.invalidateFetcherByDrvHash fetchPypiLegacy {
|
||||||
|
pname = "requests";
|
||||||
|
file = "requests-2.31.0.tar.gz";
|
||||||
|
url = "https://pypi.org/simple";
|
||||||
|
hash = "sha256-lCxadY+Y15Dq7Ropy27vx/+w0c968Fw9J5Flbb1q0eE=";
|
||||||
|
};
|
||||||
|
}
|
@ -111,6 +111,7 @@ with pkgs;
|
|||||||
fetchzip = callPackages ../build-support/fetchzip/tests.nix { };
|
fetchzip = callPackages ../build-support/fetchzip/tests.nix { };
|
||||||
fetchgit = callPackages ../build-support/fetchgit/tests.nix { };
|
fetchgit = callPackages ../build-support/fetchgit/tests.nix { };
|
||||||
fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };
|
fetchFirefoxAddon = callPackages ../build-support/fetchfirefoxaddon/tests.nix { };
|
||||||
|
fetchPypiLegacy = callPackages ../build-support/fetchpypilegacy/tests.nix { };
|
||||||
|
|
||||||
install-shell-files = callPackage ./install-shell-files {};
|
install-shell-files = callPackage ./install-shell-files {};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user