blob: 039b9ce21cea7f4ccba2573f90e7796e064edf8b (
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
52
53
54
55
56
57
|
{ lib
, buildPythonPackage
, fetchFromGitHub
, fetchpatch
, pytestCheckHook
, pythonOlder
, setuptools
}:
buildPythonPackage rec {
pname = "tree-sitter";
version = "0.21.1";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "py-tree-sitter";
rev = "refs/tags/v${version}";
hash = "sha256-U4ZdU0lxjZO/y0q20bG5CLKipnfpaxzV3AFR6fGS7m4=";
fetchSubmodules = true;
};
patches = [
# Replace distutils with setuptools, https://github.com/tree-sitter/py-tree-sitter/pull/214
(fetchpatch {
name = "replace-distutils.patch";
url = "https://github.com/tree-sitter/py-tree-sitter/commit/80d3cae493c4a47e49cc1d2ebab0a8eaf7617825.patch";
hash = "sha256-00coI8/COpYMiSflAECwh6yJCMJj/ucFEn18Npj2g+Q=";
})
];
nativeBuildInputs = [
setuptools
];
nativeCheckInputs = [
pytestCheckHook
];
pythonImportsCheck = [
"tree_sitter"
];
preCheck = ''
rm -r tree_sitter
'';
meta = with lib; {
description = "Python bindings to the Tree-sitter parsing library";
homepage = "https://github.com/tree-sitter/py-tree-sitter";
changelog = "https://github.com/tree-sitter/py-tree-sitter/releases/tag/v${version}";
license = licenses.mit;
maintainers = with maintainers; [ fab ];
};
}
|