2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pytestCheckHook,
|
|
|
|
pythonOlder,
|
|
|
|
setuptools,
|
2024-06-20 14:57:18 +00:00
|
|
|
tree-sitter-python,
|
|
|
|
tree-sitter-rust,
|
|
|
|
tree-sitter-html,
|
|
|
|
tree-sitter-javascript,
|
|
|
|
tree-sitter-json,
|
2023-04-12 12:48:02 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "tree-sitter";
|
2024-06-20 14:57:18 +00:00
|
|
|
version = "0.22.3";
|
2024-04-21 15:54:59 +00:00
|
|
|
pyproject = true;
|
2023-04-12 12:48:02 +00:00
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "tree-sitter";
|
|
|
|
repo = "py-tree-sitter";
|
|
|
|
rev = "refs/tags/v${version}";
|
2024-06-20 14:57:18 +00:00
|
|
|
hash = "sha256-4lxE8oDFE0X7YAnB72PKIaHIqovWSM5QnFo0grPAtKU=";
|
2024-04-21 15:54:59 +00:00
|
|
|
fetchSubmodules = true;
|
2023-04-12 12:48:02 +00:00
|
|
|
};
|
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
build-system = [ setuptools ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-06-20 14:57:18 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
|
|
|
tree-sitter-python
|
|
|
|
tree-sitter-rust
|
|
|
|
tree-sitter-html
|
|
|
|
tree-sitter-javascript
|
|
|
|
tree-sitter-json
|
|
|
|
];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "tree_sitter" ];
|
2023-04-12 12:48:02 +00:00
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
preCheck = ''
|
2024-06-20 14:57:18 +00:00
|
|
|
# https://github.com/NixOS/nixpkgs/issues/255262#issuecomment-1721265871
|
2024-04-21 15:54:59 +00:00
|
|
|
rm -r tree_sitter
|
|
|
|
'';
|
|
|
|
|
2023-04-12 12:48:02 +00:00
|
|
|
meta = with lib; {
|
|
|
|
description = "Python bindings to the Tree-sitter parsing library";
|
|
|
|
homepage = "https://github.com/tree-sitter/py-tree-sitter";
|
2024-01-02 11:29:13 +00:00
|
|
|
changelog = "https://github.com/tree-sitter/py-tree-sitter/releases/tag/v${version}";
|
2023-04-12 12:48:02 +00:00
|
|
|
license = licenses.mit;
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|