Subject: [bug#49946] [PATCH 21/31] gnu: Add tree-sitter-python.

From: Pierre Langlois <[email-masked]>
Date: Mon, 9 Aug 2021 00:43:48 +0100

* gnu/packages/tree-sitter.scm (tree-sitter-python): New variable.
---
 gnu/packages/tree-sitter.scm | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm
index 9f1a30f0cc..d7c3468035 100644
--- a/gnu/packages/tree-sitter.scm
+++ b/gnu/packages/tree-sitter.scm
@@ -388,3 +388,32 @@ library.")
     (description
       "This package provides a PHP grammar for the Tree-sitter library.")
     (license license:expat)))
+
+(define-public tree-sitter-python
+  (package (inherit tree-sitter-c)
+    (name "tree-sitter-python")
+    (version "0.19.0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+              (url "https://github.com/tree-sitter/tree-sitter-python")
+              (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32
+          "04b85qxqs64x6nhbpcgrzkbilxaiwvr9yd3h065rynv7rsdg0hii"))))
+    (arguments
+     (substitute-keyword-arguments (package-arguments tree-sitter-c)
+      ((#:phases phases)
+       `(modify-phases ,phases
+         ;; The parse-example script tries to clone git repositories.
+         (add-after 'unpack 'remove-parse-example
+           (lambda _
+             (substitute* "package.json"
+               ((" && script\\/parse-examples") ""))))))))
+    (home-page "https://github.com/tree-sitter/tree-sitter-python")
+    (synopsis "Tree-sitter Python grammar")
+    (description
+      "This package provides a Python grammar for the Tree-sitter library.")
+    (license license:expat)))
--
2.32.0