mirror of
https://github.com/nix-community/dream2nix.git
synced 2024-11-29 23:35:33 +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;
|
||||
|
||||
nativeBuildInputs =
|
||||
l.optionals config.deps.stdenv.isLinux [config.deps.autoPatchelfHook];
|
||||
[config.deps.unzip]
|
||||
++ (l.optionals config.deps.stdenv.isLinux [config.deps.autoPatchelfHook]);
|
||||
buildInputs =
|
||||
l.optionals config.deps.stdenv.isLinux [config.deps.manylinux1];
|
||||
propagatedBuildInputs = let
|
||||
depsByExtra = extra: metadata.targets.${extra}.${config.name} or [];
|
||||
defaultDeps = metadata.targets.default.${config.name} or [];
|
||||
depsByExtra = extra: targets.${extra}.${config.name} or [];
|
||||
defaultDeps = targets.default.${config.name} or [];
|
||||
deps = defaultDeps ++ (l.concatLists (l.map depsByExtra cfg.buildExtras));
|
||||
in
|
||||
l.map (name: cfg.drvs.${name}.public.out) deps;
|
||||
@ -122,6 +123,26 @@ in {
|
||||
|
||||
mkDerivation = {
|
||||
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;
|
||||
in {
|
||||
options.pip = {
|
||||
flattenDependencies = l.mkOption {
|
||||
type = t.bool;
|
||||
description = ''
|
||||
Use all dependencies as top-level dependencies
|
||||
'';
|
||||
default = false;
|
||||
};
|
||||
pypiSnapshotDate = l.mkOption {
|
||||
type = t.str;
|
||||
description = ''
|
||||
|
Loading…
Reference in New Issue
Block a user