depot/third_party/nixpkgs/pkgs/development/python-modules/tree-sitter/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

55 lines
1.2 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,
setuptools,
tree-sitter-python,
tree-sitter-rust,
tree-sitter-html,
tree-sitter-javascript,
tree-sitter-json,
}:
buildPythonPackage rec {
pname = "tree-sitter";
version = "0.22.3";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "py-tree-sitter";
rev = "refs/tags/v${version}";
hash = "sha256-4lxE8oDFE0X7YAnB72PKIaHIqovWSM5QnFo0grPAtKU=";
fetchSubmodules = true;
};
build-system = [ setuptools ];
nativeCheckInputs = [
pytestCheckHook
tree-sitter-python
tree-sitter-rust
tree-sitter-html
tree-sitter-javascript
tree-sitter-json
];
pythonImportsCheck = [ "tree_sitter" ];
preCheck = ''
# https://github.com/NixOS/nixpkgs/issues/255262#issuecomment-1721265871
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 ];
};
}