Skip to content

Commit

Permalink
renderers: Implement build-systems fallback behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
adisbladis committed Dec 16, 2023
1 parent c337a98 commit 0ad8ca0
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions lib/renderers.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ in
namedDeps = pep621.getDependenciesNames filteredDeps;
flatDeps = namedDeps.dependencies ++ flatten (attrValues namedDeps.extras) ++ namedDeps.build-systems;
in
ps: map (dep: ps.${dep}) flatDeps ++ extraPackages ps;
ps:
let
buildSystems' =
if namedDeps.build-systems != [ ] then [ ]
else [ ps.setuptools ps.wheel ];
in
map (dep: ps.${dep}) flatDeps ++ extraPackages ps ++ buildSystems';

/*
Renders a project as an argument that can be passed to buildPythonPackage/buildPythonApplication.
Expand Down Expand Up @@ -90,6 +96,8 @@ in

pythonVersion = pep440.parseVersion python.version;

pythonPackages = python.pkgs;

namedDeps = pep621.getDependenciesNames filteredDeps;

inherit (project) pyproject;
Expand Down Expand Up @@ -144,7 +152,9 @@ in
optional-dependencies = lib.mapAttrs (_group: deps: map (dep: python.pkgs.${dep.name}) deps) project.dependencies.extras;
};
} // optionalAttrs (format != "wheel") {
nativeBuildInputs = map (dep: python.pkgs.${dep}) namedDeps.build-systems;
nativeBuildInputs =
if namedDeps.build-systems != [ ] then map (dep: pythonPackages.${dep}) namedDeps.build-systems
else [ pythonPackages.setuptools pythonPackages.wheel ];
} // optionalAttrs (pyproject.project ? name) {
pname = pyproject.project.name;
} // optionalAttrs (project.projectRoot != null) {
Expand Down

0 comments on commit 0ad8ca0

Please sign in to comment.