about summary refs log tree commit diff
path: root/pkgs/development/python-modules/ninja/default.nix
blob: a735308e657e524a08c92a736493e9d56a2a2b3b (plain) (blame)
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
{
  lib,
  buildPythonPackage,
  flit-core,
  ninja,
}:

buildPythonPackage rec {
  pname = "ninja";
  inherit (ninja) version;
  format = "pyproject";

  src = ./stub;

  postUnpack = ''
    substituteInPlace "$sourceRoot/pyproject.toml" \
      --subst-var version

    substituteInPlace "$sourceRoot/ninja/__init__.py" \
      --subst-var version \
      --subst-var-by BIN_DIR "${ninja}/bin"
  '';

  inherit (ninja) setupHook;

  nativeBuildInputs = [ flit-core ];

  preBuild = ''
    cp "${ninja.src}/misc/ninja_syntax.py" ninja/ninja_syntax.py
  '';

  pythonImportsCheck = [
    "ninja"
    "ninja.ninja_syntax"
  ];

  meta = with lib; {
    description = "Small build system with a focus on speed";
    mainProgram = "ninja";
    longDescription = ''
      This is a stub of the ninja package on PyPI that uses the ninja program
      provided by nixpkgs instead of downloading ninja from the web.
    '';
    homepage = "https://github.com/scikit-build/ninja-python-distributions";
    license = licenses.asl20;
    maintainers = with maintainers; [
      _999eagle
      tjni
    ];
  };
}