1{
2 lib,
3 ast-grep,
4 buildPythonPackage,
5 rustPlatform,
6 pytestCheckHook,
7 nix-update-script,
8}:
9buildPythonPackage {
10 inherit (ast-grep) version src cargoDeps;
11 pname = "ast-grep-py";
12 pyproject = true;
13
14 buildAndTestSubdir = "crates/pyo3";
15
16 nativeBuildInputs = with rustPlatform; [
17 cargoSetupHook
18 maturinBuildHook
19 ];
20
21 prePatch = ''
22 substituteInPlace ./crates/pyo3/tests/test_register_lang.py \
23 --replace-fail '../..' ${ast-grep.src}
24 '';
25
26 nativeCheckInputs = [ pytestCheckHook ];
27
28 pythonImportsCheck = [ "ast_grep_py" ];
29
30 passthru.updateScript = nix-update-script { };
31
32 meta = {
33 inherit (ast-grep.meta)
34 description
35 homepage
36 changelog
37 license
38 ;
39 maintainers = with lib.maintainers; [
40 nezia
41 ];
42 };
43}