about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorFabian Affolter <fabian@affolter-engineering.ch>2024-03-20 13:35:21 +0100
committerGitHub <noreply@github.com>2024-03-20 13:35:21 +0100
commit66e2e75c671f9a674a28d340e59a0157efb6f905 (patch)
treeb1717ba4f7f643d7b509055e47eb5c1b0ed7729f /pkgs/development
parente21968aa89aadba105e8bf018f660b5fdb7fab27 (diff)
parent62ef647346faf34e7f48c32009a966893a56db39 (diff)
Merge pull request #297420 from fabaff/py-tree-sitter-remove
python311Packages.py-tree-sitter: remove, python311Packages.tree-sitter: 0.20.4 -> 0.21.1
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/python-modules/py-tree-sitter/default.nix34
-rw-r--r--pkgs/development/python-modules/tree-sitter/default.nix37
2 files changed, 26 insertions, 45 deletions
diff --git a/pkgs/development/python-modules/py-tree-sitter/default.nix b/pkgs/development/python-modules/py-tree-sitter/default.nix
deleted file mode 100644
index 9358a0fbca887..0000000000000
--- a/pkgs/development/python-modules/py-tree-sitter/default.nix
+++ /dev/null
@@ -1,34 +0,0 @@
-{ lib
-, stdenv
-, buildPythonPackage
-, fetchFromGitHub
-, setuptools
-}:
-
-buildPythonPackage rec {
-  pname = "py-tree-sitter";
-  version = "0.20.4";
-  format = "pyproject";
-
-  src = fetchFromGitHub {
-    owner = "tree-sitter";
-    repo = "py-tree-sitter";
-    rev = "refs/tags/v${version}";
-    hash = "sha256-R97WcsHQMcuEOCg/QQ9YbGTRD30G9PRv0xAbxuoFyC4=";
-    fetchSubmodules = true;
-  };
-
-  nativeBuildInputs = [
-    setuptools
-  ];
-
-  pythonImportsCheck = [ "tree_sitter" ];
-
-  meta = with lib; {
-    homepage = "https://github.com/tree-sitter/py-tree-sitter";
-    description = "Python bindings for tree-sitter";
-    license = licenses.mit;
-    maintainers = with maintainers; [ siraben ];
-    platforms = platforms.unix;
-  };
-}
diff --git a/pkgs/development/python-modules/tree-sitter/default.nix b/pkgs/development/python-modules/tree-sitter/default.nix
index cd572618a2fd8..039b9ce21cea7 100644
--- a/pkgs/development/python-modules/tree-sitter/default.nix
+++ b/pkgs/development/python-modules/tree-sitter/default.nix
@@ -1,37 +1,52 @@
 { lib
 , buildPythonPackage
-, fetchPypi
+, fetchFromGitHub
+, fetchpatch
 , pytestCheckHook
 , pythonOlder
 , setuptools
-, wheel
 }:
 
 buildPythonPackage rec {
   pname = "tree-sitter";
-  version = "0.20.4";
-  format = "pyproject";
+  version = "0.21.1";
+  pyproject = true;
 
   disabled = pythonOlder "3.7";
 
-  src = fetchPypi {
-    pname = "tree_sitter";
-    inherit version;
-    hash = "sha256-atsSPi8+VjmbvyNZkkYzyILMQO6DRIhSALygki9xO+U=";
+  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
-    wheel
   ];
 
-  # PyPI tarball doesn't contains tests and source has additional requirements
-  doCheck = false;
+  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";