Merge pull request #316901 from doronbehar/pkg/autotools-language-server

autotools-language-server: init at 0.0.19
This commit is contained in:
Doron Behar 2024-06-18 09:52:14 +03:00 committed by GitHub
commit 7eabbc2829
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 895 additions and 14 deletions

View File

@ -0,0 +1,51 @@
{ lib
, python3
, fetchFromGitHub
, fetchpatch
}:
python3.pkgs.buildPythonApplication rec {
pname = "autotools-language-server";
version = "0.0.19";
pyproject = true;
src = fetchFromGitHub {
owner = "Freed-Wu";
repo = "autotools-language-server";
rev = "refs/tags/${version}";
hash = "sha256-V0EOV1ZmeC+4svc2fqV6AIiL37dkrxUJAnjywMZcENw=";
};
patches = [
# Right before the release, upstream decided to replace the
# tree-sitter-languages dependency with tree-sitter-make, which is yanked
# from some reason. Hopefully upstream will fix this dependency a bit
# better in the next release. See also:
# https://github.com/Freed-Wu/autotools-language-server/commit/f149843becfcfd6b2bb4a98eb1f3984c01d5fd33#r142659163
(fetchpatch {
url = "https://github.com/Freed-Wu/autotools-language-server/commit/f149843becfcfd6b2bb4a98eb1f3984c01d5fd33.patch";
hash = "sha256-TrzHbfR6GYAEqDIFiCqSX2+Qv4JeFJ5faiKJhNYojf0=";
revert = true;
})
];
build-system = [
python3.pkgs.setuptools-generate
python3.pkgs.setuptools-scm
];
dependencies = with python3.pkgs; [
tree-sitter-languages
lsp-tree-sitter
];
nativeCheckInputs = [
python3.pkgs.pytestCheckHook
];
meta = with lib; {
description = "Autotools language server, support configure.ac, Makefile.am, Makefile";
homepage = "https://github.com/Freed-Wu/autotools-language-server";
license = licenses.gpl3Only;
maintainers = with maintainers; [ doronbehar ];
mainProgram = "autotools-language-server";
};
}

View File

@ -0,0 +1,55 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools-generate
, setuptools-scm
, colorama
, jinja2
, jsonschema
, pygls
, tree-sitter0_21
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "lsp-tree-sitter";
version = "0.0.15";
pyproject = true;
src = fetchFromGitHub {
owner = "neomutt";
repo = "lsp-tree-sitter";
rev = version;
hash = "sha256-yzScgix3BtSCBzlDoE1kMYGtVzkup/+ZK9L1C7VA3do=";
};
build-system = [
setuptools-generate
setuptools-scm
];
dependencies = [
colorama
jinja2
jsonschema
pygls
# The build won't fail if we had used tree-sitter (version > 0.21), but
# this package is only a dependency of autotools-language-server which also
# depends on tree-sitter-languages which must use tree-sitter0_21 and not
# tree-sitter. Hence we avoid different tree-sitter versions dependency
# mismatch by defaulting here to this lower version.
tree-sitter0_21
];
nativeCheckInputs = [
pytestCheckHook
];
pythonImportsCheck = [ "lsp_tree_sitter" ];
meta = with lib; {
description = "A library to create language servers";
homepage = "https://github.com/neomutt/lsp-tree-sitter";
license = licenses.gpl3Only;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -0,0 +1,71 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "tree-sitter"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca"
dependencies = [
"cc",
"regex",
]
[[package]]
name = "tree-sitter-html"
version = "0.20.3"
dependencies = [
"cc",
"tree-sitter",
]

View File

@ -0,0 +1,56 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, setuptools
, wheel
, tree-sitter
}:
buildPythonPackage rec {
pname = "tree-sitter-html";
version = "0.20.3";
pyproject = true;
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-html";
rev = "v${version}";
hash = "sha256-sHy3fVWemJod18HCQ8zBC/LpeCCPH0nzhI1wrkCg8nw=";
};
cargoDeps = rustPlatform.importCargoLock {
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
build-system = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools
wheel
];
passthru.optional-dependencies = {
core = [
tree-sitter
];
};
# There are no tests
doCheck = false;
pythonImportsCheck = [ "tree_sitter_html" ];
meta = with lib; {
description = "HTML grammar for tree-sitter";
homepage = "https://github.com/tree-sitter/tree-sitter-html";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -0,0 +1,71 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "tree-sitter"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca"
dependencies = [
"cc",
"regex",
]
[[package]]
name = "tree-sitter-javascript"
version = "0.21.3"
dependencies = [
"cc",
"tree-sitter",
]

View File

@ -0,0 +1,58 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, setuptools
, wheel
, tree-sitter
}:
buildPythonPackage rec {
pname = "tree-sitter-javascript";
version = "0.21.3";
pyproject = true;
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-javascript";
rev = "v${version}";
hash = "sha256-jsdY9Pd9WqZuBYtk088mx1bRQadC6D2/tGGVY+ZZ0J4=";
};
cargoDeps = rustPlatform.importCargoLock {
# Upstream doesn't track a Cargo.lock file unfortunatly, but they barely
# have rust dependencies so it doesn't cost us too much.
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
build-system = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools
wheel
];
passthru.optional-dependencies = {
core = [
tree-sitter
];
};
# There are no tests
doCheck = false;
pythonImportsCheck = [ "tree_sitter_javascript" ];
meta = with lib; {
description = "JavaScript and JSX grammar for tree-sitter";
homepage = "https://github.com/tree-sitter/tree-sitter-javascript";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -0,0 +1,71 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "tree-sitter"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca"
dependencies = [
"cc",
"regex",
]
[[package]]
name = "tree-sitter-json"
version = "0.21.0"
dependencies = [
"cc",
"tree-sitter",
]

View File

@ -0,0 +1,58 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, setuptools
, wheel
, tree-sitter
}:
buildPythonPackage rec {
pname = "tree-sitter-json";
version = "0.21.0";
pyproject = true;
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-json";
rev = "v${version}";
hash = "sha256-waejAbS7MjrE7w03MPqvBRpEpqTcKc6RgKCVSYaDV1Y=";
};
cargoDeps = rustPlatform.importCargoLock {
# Upstream doesn't track a Cargo.lock file unfortunatly, but they barely
# have rust dependencies so it doesn't cost us too much.
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
build-system = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools
wheel
];
passthru.optional-dependencies = {
core = [
tree-sitter
];
};
# There are no tests
doCheck = false;
pythonImportsCheck = [ "tree_sitter_json" ];
meta = with lib; {
description = "JSON grammar for tree-sitter";
homepage = "https://github.com/tree-sitter/tree-sitter-json";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -0,0 +1,68 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, setuptools
, wheel
, cython
, tree-sitter0_21
, pytestCheckHook
, python
}:
buildPythonPackage rec {
pname = "tree-sitter-languages";
version = "1.10.2";
pyproject = true;
src = fetchFromGitHub {
owner = "grantjenks";
repo = "py-tree-sitter-languages";
rev = "v${version}";
hash = "sha256-wKU2c8QRBKFVFqg+DAeH5+cwm5jpDLmPZG3YBUsh/lM=";
# Use git, to also fetch tree-sitter repositories that upstream puts their
# hases in the repository as well, in repos.txt.
forceFetchGit = true;
postFetch = ''
cd $out
substitute build.py get-repos.py \
--replace-fail "from tree_sitter import Language" "" \
--replace-fail 'print(f"{sys.argv[0]}: Building", languages_filename)' "exit(0)"
${python.pythonOnBuildForHost.interpreter} get-repos.py
rm -rf vendor/*/.git
'';
};
build-system = [
setuptools
wheel
cython
];
dependencies = [
# https://github.com/grantjenks/py-tree-sitter-languages/issues/67
tree-sitter0_21
];
# Generate languages.so file (build won't fail without this, but tests will).
preBuild = ''
${python.pythonOnBuildForHost.interpreter} build.py
'';
nativeCheckInputs = [
pytestCheckHook
];
# Without cd $out, tests fail to import the compiled cython extensions.
# Without copying the ./tests/ directory to $out, pytest won't detect the
# tests and run them. See also:
# https://github.com/NixOS/nixpkgs/issues/255262
preCheck = ''
cp -r tests $out/${python.sitePackages}/tree_sitter_languages
cd $out
'';
pythonImportsCheck = [ "tree_sitter_languages" ];
meta = with lib; {
description = "Binary Python wheels for all tree sitter languages";
homepage = "https://github.com/grantjenks/py-tree-sitter-languages";
license = licenses.asl20;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -0,0 +1,71 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "tree-sitter"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca"
dependencies = [
"cc",
"regex",
]
[[package]]
name = "tree-sitter-python"
version = "0.21.0"
dependencies = [
"cc",
"tree-sitter",
]

View File

@ -0,0 +1,58 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, setuptools
, wheel
, tree-sitter
}:
buildPythonPackage rec {
pname = "tree-sitter-python";
version = "0.21.0";
pyproject = true;
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-python";
rev = "v${version}";
hash = "sha256-ZQ949GbgzZ/W667J+ekvQbs4bGnbDO+IWejivhxPZXM=";
};
cargoDeps = rustPlatform.importCargoLock {
# Upstream doesn't track a Cargo.lock file unfortunatly, but they barely
# have rust dependencies so it doesn't cost us too much.
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
build-system = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools
wheel
];
passthru.optional-dependencies = {
core = [
tree-sitter
];
};
# There are no tests
doCheck = false;
pythonImportsCheck = [ "tree_sitter_python" ];
meta = with lib; {
description = "Python grammar for tree-sitter";
homepage = "https://github.com/tree-sitter/tree-sitter-python";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -0,0 +1,71 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "aho-corasick"
version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916"
dependencies = [
"memchr",
]
[[package]]
name = "cc"
version = "1.0.98"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41c270e7540d725e65ac7f1b212ac8ce349719624d7bcff99f8e2e488e8cf03f"
[[package]]
name = "memchr"
version = "2.7.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d"
[[package]]
name = "regex"
version = "1.10.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c"
dependencies = [
"aho-corasick",
"memchr",
"regex-automata",
"regex-syntax",
]
[[package]]
name = "regex-automata"
version = "0.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea"
dependencies = [
"aho-corasick",
"memchr",
"regex-syntax",
]
[[package]]
name = "regex-syntax"
version = "0.8.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56"
[[package]]
name = "tree-sitter"
version = "0.22.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "df7cc499ceadd4dcdf7ec6d4cbc34ece92c3fa07821e287aedecd4416c516dca"
dependencies = [
"cc",
"regex",
]
[[package]]
name = "tree-sitter-rust"
version = "0.21.2"
dependencies = [
"cc",
"tree-sitter",
]

View File

@ -0,0 +1,59 @@
{ lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, setuptools
, wheel
, tree-sitter
}:
buildPythonPackage rec {
pname = "tree-sitter-rust";
version = "0.21.2";
pyproject = true;
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "tree-sitter-rust";
rev = "v${version}";
hash = "sha256-4CTh6fKSV8TuMHLAfEKWsAeCqeCM2uo6hVmF5KWhyPY=";
};
cargoDeps = rustPlatform.importCargoLock {
# Upstream doesn't track a Cargo.lock file unfortunatly, but they barely
# have rust dependencies so it doesn't cost us too much.
lockFile = ./Cargo.lock;
};
postPatch = ''
ln -s ${./Cargo.lock} Cargo.lock
'';
build-system = [
cargo
rustPlatform.cargoSetupHook
rustc
setuptools
wheel
];
passthru.optional-dependencies = {
core = [
tree-sitter
];
};
# There are no tests
doCheck = false;
pythonImportsCheck = [ "tree_sitter_rust" ];
meta = with lib; {
description = "Rust grammar for tree-sitter";
homepage = "https://github.com/tree-sitter/tree-sitter-rust";
license = licenses.mit;
maintainers = with maintainers; [ doronbehar ];
};
}

View File

@ -2,15 +2,19 @@
lib,
buildPythonPackage,
fetchFromGitHub,
fetchpatch,
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.21.1";
version = "0.22.3";
pyproject = true;
disabled = pythonOlder "3.7";
@ -19,26 +23,25 @@ buildPythonPackage rec {
owner = "tree-sitter";
repo = "py-tree-sitter";
rev = "refs/tags/v${version}";
hash = "sha256-U4ZdU0lxjZO/y0q20bG5CLKipnfpaxzV3AFR6fGS7m4=";
hash = "sha256-4lxE8oDFE0X7YAnB72PKIaHIqovWSM5QnFo0grPAtKU=";
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=";
})
build-system = [ setuptools ];
nativeCheckInputs = [
pytestCheckHook
tree-sitter-python
tree-sitter-rust
tree-sitter-html
tree-sitter-javascript
tree-sitter-json
];
nativeBuildInputs = [ setuptools ];
nativeCheckInputs = [ pytestCheckHook ];
pythonImportsCheck = [ "tree_sitter" ];
preCheck = ''
# https://github.com/NixOS/nixpkgs/issues/255262#issuecomment-1721265871
rm -r tree_sitter
'';

View File

@ -0,0 +1,44 @@
{
lib,
buildPythonPackage,
fetchFromGitHub,
pytestCheckHook,
pythonOlder,
pythonAtLeast,
setuptools,
}:
buildPythonPackage rec {
pname = "tree-sitter0_21";
version = "0.21.3";
pyproject = true;
# https://github.com/tree-sitter/py-tree-sitter/issues/209
disabled = pythonAtLeast "3.12" || pythonOlder "3.7";
src = fetchFromGitHub {
owner = "tree-sitter";
repo = "py-tree-sitter";
rev = "refs/tags/v${version}";
hash = "sha256-HT1sRzDFpeelWCq1ZMeRmoUg0a3SBR7bZKxBqn4fb2g=";
fetchSubmodules = true;
};
build-system = [ 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 ];
};
}

View File

@ -7096,6 +7096,8 @@ self: super: with self; {
lsprotocol = callPackage ../development/python-modules/lsprotocol { };
lsp-tree-sitter = callPackage ../development/python-modules/lsp-tree-sitter { };
ltpycld2 = callPackage ../development/python-modules/ltpycld2 { };
lttng = callPackage ../development/python-modules/lttng { };
@ -15481,6 +15483,20 @@ self: super: with self; {
tree-sitter = callPackage ../development/python-modules/tree-sitter { };
tree-sitter0_21 = callPackage ../development/python-modules/tree-sitter0_21 { };
tree-sitter-html = callPackage ../development/python-modules/tree-sitter-html { };
tree-sitter-python = callPackage ../development/python-modules/tree-sitter-python { };
tree-sitter-rust = callPackage ../development/python-modules/tree-sitter-rust { };
tree-sitter-javascript = callPackage ../development/python-modules/tree-sitter-javascript { };
tree-sitter-json = callPackage ../development/python-modules/tree-sitter-json { };
tree-sitter-languages = callPackage ../development/python-modules/tree-sitter-languages { };
treelib = callPackage ../development/python-modules/treelib { };
treelog = callPackage ../development/python-modules/treelog { };