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