mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-26 09:46:04 +03:00
feat(pip): add option flattenedDependencies for requirements specifications without root
This commit is contained in:
parent
66658fb429
commit
919cd21990
@ -81,12 +81,13 @@
|
|||||||
doCheck = l.mkDefault false;
|
doCheck = l.mkDefault false;
|
||||||
|
|
||||||
nativeBuildInputs =
|
nativeBuildInputs =
|
||||||
l.optionals config.deps.stdenv.isLinux [config.deps.autoPatchelfHook];
|
[config.deps.unzip]
|
||||||
|
++ (l.optionals config.deps.stdenv.isLinux [config.deps.autoPatchelfHook]);
|
||||||
buildInputs =
|
buildInputs =
|
||||||
l.optionals config.deps.stdenv.isLinux [config.deps.manylinux1];
|
l.optionals config.deps.stdenv.isLinux [config.deps.manylinux1];
|
||||||
propagatedBuildInputs = let
|
propagatedBuildInputs = let
|
||||||
depsByExtra = extra: metadata.targets.${extra}.${config.name} or [];
|
depsByExtra = extra: targets.${extra}.${config.name} or [];
|
||||||
defaultDeps = metadata.targets.default.${config.name} or [];
|
defaultDeps = targets.default.${config.name} or [];
|
||||||
deps = defaultDeps ++ (l.concatLists (l.map depsByExtra cfg.buildExtras));
|
deps = defaultDeps ++ (l.concatLists (l.map depsByExtra cfg.buildExtras));
|
||||||
in
|
in
|
||||||
l.map (name: cfg.drvs.${name}.public.out) deps;
|
l.map (name: cfg.drvs.${name}.public.out) deps;
|
||||||
@ -122,6 +123,26 @@ in {
|
|||||||
|
|
||||||
mkDerivation = {
|
mkDerivation = {
|
||||||
dontStrip = l.mkDefault true;
|
dontStrip = l.mkDefault true;
|
||||||
|
propagatedBuildInputs =
|
||||||
|
if cfg.flattenDependencies
|
||||||
|
then
|
||||||
|
if targets.default ? ${config.name}
|
||||||
|
then
|
||||||
|
throw ''
|
||||||
|
Top-level package ${config.name} is listed in the lockfile.
|
||||||
|
Set `pip.flattenDependencies` to false to use only the top-level dependencies.
|
||||||
|
''
|
||||||
|
else let
|
||||||
|
topLevelDepNames = l.attrNames (targets.default);
|
||||||
|
in
|
||||||
|
l.map (name: cfg.drvs.${name}.public.out) topLevelDepNames
|
||||||
|
else if ! targets.default ? ${config.name}
|
||||||
|
then
|
||||||
|
throw ''
|
||||||
|
Top-level package ${config.name} is not listed in the lockfile.
|
||||||
|
Set `pip.flattenDependencies` to true to use all dependencies for the top-level package.
|
||||||
|
''
|
||||||
|
else [];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,13 @@
|
|||||||
t = l.types;
|
t = l.types;
|
||||||
in {
|
in {
|
||||||
options.pip = {
|
options.pip = {
|
||||||
|
flattenDependencies = l.mkOption {
|
||||||
|
type = t.bool;
|
||||||
|
description = ''
|
||||||
|
Use all dependencies as top-level dependencies
|
||||||
|
'';
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
pypiSnapshotDate = l.mkOption {
|
pypiSnapshotDate = l.mkOption {
|
||||||
type = t.str;
|
type = t.str;
|
||||||
description = ''
|
description = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user