feat(fetchPip): add option noBinary

This commit is contained in:
DavHau 2023-03-30 11:18:14 +02:00
parent 45cdd3f367
commit 7d69373d31
3 changed files with 14 additions and 0 deletions

View File

@ -28,6 +28,13 @@ in {
suffix of the fetcher derivation name
'';
};
noBinary = l.mkOption {
type = t.listOf t.str;
default = [];
description = ''
enforce source downloads for these package names
'';
};
onlyBinary = l.mkOption {
type = t.bool;
default = false;

View File

@ -28,6 +28,8 @@
requirementsList ? [],
# list of requirements.txt files
requirementsFiles ? [],
# enforce source downloads for these package names
noBinary ? [],
# restrict to binary releases (.whl)
# this allows buildPlatform independent fetching
onlyBinary ? false,
@ -110,6 +112,7 @@
# All variables that might influence the output
${finalAttrs.pypiSnapshotDate}
${toString finalAttrs.noBinary}
${finalAttrs.onlyBinaryFlags}
${finalAttrs.pipVersion}
${finalAttrs.pipFlags}
@ -181,6 +184,7 @@
# add some variables to the derivation to integrate them into finalAttrs
inherit
noBinary
pipVersion
requirementsFiles
requirementsList

View File

@ -22,6 +22,7 @@ PYTHON_WITH_MITM_PROXY = os.getenv("pythonWithMitmproxy")
FILTER_PYPI_RESPONSE_SCRIPTS = os.getenv("filterPypiResponsesScript")
PIP_VERSION = os.getenv("pipVersion")
PIP_FLAGS = os.getenv("pipFlags")
NO_BINARY = os.getenv("noBinary")
ONLY_BINARY_FLAGS = os.getenv("onlyBinaryFlags")
REQUIREMENTS_LIST = os.getenv("requirementsList")
REQUIREMENTS_FILES = os.getenv("requirementsFiles")
@ -124,6 +125,8 @@ if __name__ == "__main__":
]
if REQUIREMENTS_FILES:
optional_flags += ["-r " + " -r ".join(REQUIREMENTS_FILES.split())]
if NO_BINARY:
optional_flags += ["--no-binary " + " --no-binary ".join(NO_BINARY.split())]
optional_flags = " ".join(filter(None, optional_flags)).split(" ")
pip(