1# Build a python package from info made available by setupcfg2nix.
2#
3# * src: The source of the package.
4# * info: The package information generated by setupcfg2nix.
5# * meta: Standard nixpkgs metadata.
6# * application: Whether this package is a python library or an
7# application which happens to be written in python.
8# * doCheck: Whether to run the test suites.
9lib: pythonPackages:
10{ src, info, meta ? {}, application ? false, doCheck ? true}: let
11 build = if application
12 then pythonPackages.buildPythonApplication
13 else pythonPackages.buildPythonPackage;
14in build {
15 inherit (info) pname version;
16
17 inherit src meta doCheck;
18
19 nativeBuildInputs = map (p: pythonPackages.${p}) (
20 (info.setup_requires or []) ++
21 (lib.optionals doCheck (info.tests_require or []))
22 );
23
24 propagatedBuildInputs = map (p: pythonPackages.${p})
25 (info.install_requires or []);
26}