packages/build-support/drv-parts: allow passing pyproject.toml to buildPythonPackage

This commit is contained in:
Max Headroom 2022-12-18 15:45:24 +01:00
parent 67cc803c88
commit a8059925d5
2 changed files with 20 additions and 1 deletions

View file

@ -9,9 +9,19 @@ let
"flit" "flit"
"wheel" "wheel"
]; ];
hasPyproject = config.format == "pyproject" && config.pyprojectToml != null;
pyproject = if hasPyproject then
lib.importTOML config.pyprojectToml
else
null;
in in
{ {
pname = lib.mkIf hasPyproject (lib.mkDefault pyproject.tool.poetry.name);
version = lib.mkIf hasPyproject (lib.mkDefault pyproject.tool.poetry.version);
deps = { pkgs, python3Packages, ... }: { deps = { pkgs, python3Packages, ... }: {
inherit (python3Packages) inherit (python3Packages)
python python

View file

@ -1,4 +1,4 @@
{ lib, ... }: { config, lib, ... }:
with lib; with lib;
let let
@ -19,6 +19,15 @@ in
"wheel" "wheel"
"other" "other"
]; ];
default = if config.pyprojectToml != null then "pyproject" else "setuptools";
defaultText = ''
"pyproject" if pyprojectToml is set, otherwise "setuptools".
'';
};
pyprojectToml = mkOption {
description = "pyproject.toml file used for extracting package metadata";
type = with types; nullOr path;
default = null;
}; };
catchConflicts = flag true "If true, abort package build if a package name appears more than once in dependency tree."; catchConflicts = flag true "If true, abort package build if a package name appears more than once in dependency tree.";
dontWrapPythonPrograms = flag false "Skip wrapping of Python programs."; dontWrapPythonPrograms = flag false "Skip wrapping of Python programs.";