2018-04-11 18:02:06 +02:00
|
|
|
# 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.
|
2018-04-13 18:25:10 +02:00
|
|
|
# * doCheck: Whether to run the test suites.
|
2018-04-15 02:12:22 +02:00
|
|
|
pythonPackages:
|
2018-04-13 18:25:10 +02:00
|
|
|
{ src, info, meta ? {}, application ? false, doCheck ? true }: let
|
2018-04-11 18:02:06 +02:00
|
|
|
build = if application
|
|
|
|
then pythonPackages.buildPythonApplication
|
|
|
|
else pythonPackages.buildPythonPackage;
|
|
|
|
in build {
|
|
|
|
inherit (info) pname version;
|
|
|
|
|
2018-04-13 18:25:10 +02:00
|
|
|
inherit src meta doCheck;
|
2018-04-11 18:02:06 +02:00
|
|
|
|
2018-04-15 02:12:22 +02:00
|
|
|
nativeBuildInputs = map (p: pythonPackages.${p}) (
|
2018-04-11 18:02:06 +02:00
|
|
|
(info.setup_requires or []) ++
|
2018-04-13 18:25:10 +02:00
|
|
|
(if doCheck then (info.tests_require or []) else []));
|
2018-04-11 18:02:06 +02:00
|
|
|
|
|
|
|
propagatedBuildInputs = map (p: pythonPackages.${p})
|
|
|
|
(info.install_requires or []);
|
|
|
|
}
|