Skip to content

Commit

Permalink
python3Packages.home-assistant-chip-wheels: simplify dependency closu…
Browse files Browse the repository at this point in the history
…re generation
  • Loading branch information
DavHau committed Dec 31, 2024
1 parent 9039a9a commit cdbd087
Showing 1 changed file with 9 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -223,26 +223,15 @@ stdenv.mkDerivation rec {
wheel
yapf
];
depListToAttrs =
list:
builtins.listToAttrs (
map (dep: {
name = dep.name;
value = dep;
}) (lib.filter (x: x != null) list)
);
saturateDependencies =
deps:
let
before = deps;
new = lib.mergeAttrsList (
map (dep: depListToAttrs (dep.propagatedBuildInputs or [ ])) (lib.attrValues before)
);
after = before // new;
in
if lib.attrNames before != lib.attrNames after then saturateDependencies after else before;
saturateDependencyList = list: lib.attrValues (saturateDependencies (depListToAttrs list));
saturatedDependencyList = lib.filter (drv: drv ? dist) (saturateDependencyList dependencies);
toItem = dep: {
inherit dep;
key = dep.name;
};
saturatedDependencies = lib.genericClosure {
startSet = map toItem dependencies;
operator = item: map toItem ((item.dep).propagatedBuildInputs or [ ]);
};
saturatedDependencyList = lib.filter (dep: dep ? dist) (map (item: item.dep) saturatedDependencies);
in
lib.concatMapStringsSep " " (dep: "file://${dep.dist}") saturatedDependencyList;

Expand Down

0 comments on commit cdbd087

Please sign in to comment.