aboutsummaryrefslogtreecommitdiff
path: root/infra/libkookie/nixpkgs/pkgs/build-support/build-setupcfg/default.nix
blob: bc6482f0a88e6f1399596e6994f335ce9529affe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# 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.
# * doCheck: Whether to run the test suites.
pythonPackages:
{ src, info, meta ? {}, application ? false, doCheck ? true }: let
  build = if application
    then pythonPackages.buildPythonApplication
  else pythonPackages.buildPythonPackage;
in build {
  inherit (info) pname version;

  inherit src meta doCheck;

  nativeBuildInputs = map (p: pythonPackages.${p}) (
    (info.setup_requires or []) ++
    (if doCheck then (info.tests_require or []) else []));

  propagatedBuildInputs = map (p: pythonPackages.${p})
    (info.install_requires or []);
}