diff options
Diffstat (limited to 'pkgs/build-support/build-setupcfg/default.nix')
-rw-r--r-- | pkgs/build-support/build-setupcfg/default.nix | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/pkgs/build-support/build-setupcfg/default.nix b/pkgs/build-support/build-setupcfg/default.nix new file mode 100644 index 000000000000..62dda59f1d52 --- /dev/null +++ b/pkgs/build-support/build-setupcfg/default.nix @@ -0,0 +1,23 @@ +# Build a python package from info made available by setupcfg2nix. +# +# * src: The source of the package. +# * info: The package information generated by setupcfg2nix. +# * meta: Standard nixpkgs metadata. +# * application: Whether this package is a python library or an +# application which happens to be written in python. +pythonPackages: { src, info, meta ? {}, application ? false }: let + build = if application + then pythonPackages.buildPythonApplication + else pythonPackages.buildPythonPackage; +in build { + inherit (info) pname version; + + inherit src meta; + + nativeBuildInputs = map (p: pythonPackages.${p}) ( + (info.setup_requires or []) ++ + (info.tests_require or [])); + + propagatedBuildInputs = map (p: pythonPackages.${p}) + (info.install_requires or []); +} |