summaryrefslogtreecommitdiff
path: root/pkgs/development/python-modules/ast-grep-py/default.nix
blob: e42eb3e754fc6b0a407bfcec7a8971bca0e39497 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
{
  lib,
  ast-grep,
  buildPythonPackage,
  rustPlatform,
  pytestCheckHook,
  nix-update-script,
}:
buildPythonPackage {
  inherit (ast-grep) version src cargoDeps;
  pname = "ast-grep-py";
  pyproject = true;

  buildAndTestSubdir = "crates/pyo3";

  nativeBuildInputs = with rustPlatform; [
    cargoSetupHook
    maturinBuildHook
  ];

  prePatch = ''
    substituteInPlace ./crates/pyo3/tests/test_register_lang.py \
      --replace-fail '../..' ${ast-grep.src}
  '';

  nativeCheckInputs = [ pytestCheckHook ];

  pythonImportsCheck = [ "ast_grep_py" ];

  passthru.updateScript = nix-update-script { };

  meta = {
    inherit (ast-grep.meta)
      description
      homepage
      changelog
      license
      ;
    maintainers = with lib.maintainers; [
      nezia
    ];
  };
}