fetchPypiLegacy: Reformat with nixfmt
This commit is contained in:
parent
4e7d996aa8
commit
2a9ab9c1e0
@ -1,7 +1,8 @@
|
|||||||
# Fetch from PyPi legacy API as documented in https://warehouse.pypa.io/api-reference/legacy.html
|
# Fetch from PyPi legacy API as documented in https://warehouse.pypa.io/api-reference/legacy.html
|
||||||
{ runCommand
|
{
|
||||||
, lib
|
runCommand,
|
||||||
, python3
|
lib,
|
||||||
|
python3,
|
||||||
}:
|
}:
|
||||||
{
|
{
|
||||||
# package name
|
# package name
|
||||||
@ -21,15 +22,14 @@ let
|
|||||||
urls' = urls ++ lib.optional (url != null) url;
|
urls' = urls ++ lib.optional (url != null) url;
|
||||||
|
|
||||||
pathParts = lib.filter ({ prefix, path }: "NETRC" == prefix) builtins.nixPath;
|
pathParts = lib.filter ({ prefix, path }: "NETRC" == prefix) builtins.nixPath;
|
||||||
netrc_file =
|
netrc_file = if (pathParts != [ ]) then (lib.head pathParts).path else "";
|
||||||
if (pathParts != [ ])
|
|
||||||
then (lib.head pathParts).path
|
|
||||||
else "";
|
|
||||||
|
|
||||||
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";
|
||||||
@ -38,8 +38,11 @@ assert urls' != [ ]; runCommand file
|
|||||||
outputHash = hash;
|
outputHash = hash;
|
||||||
NETRC = netrc_file;
|
NETRC = netrc_file;
|
||||||
}
|
}
|
||||||
// (lib.optionalAttrs (name != null) {inherit name;}))
|
// (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
|
||||||
''
|
''
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
{ testers, fetchPypiLegacy, ... }: {
|
{ testers, fetchPypiLegacy, ... }:
|
||||||
|
{
|
||||||
# Tests that we can send custom headers with spaces in them
|
# Tests that we can send custom headers with spaces in them
|
||||||
fetchSimple = testers.invalidateFetcherByDrvHash fetchPypiLegacy {
|
fetchSimple = testers.invalidateFetcherByDrvHash fetchPypiLegacy {
|
||||||
pname = "requests";
|
pname = "requests";
|
||||||
|
Loading…
Reference in New Issue
Block a user