diff options
| author | Evgenii Klimov <eugene.dev@lipklim.org> | 2025-09-22 18:17:26 +0100 |
|---|---|---|
| committer | Liliana Marie Prikler <liliana.prikler@gmail.com> | 2025-10-01 09:04:42 +0200 |
| commit | 3435db138399cf90f5f5418227ccb03c7e9c7209 (patch) | |
| tree | 82b2d33fc58221e0c05db73f9ef4697493be6d72 /gnu | |
| parent | 28de0357ddaf7d98029f03ea1f12a77266ed059f (diff) | |
gnu: Add python-tree-sitter-grammar procedure.
* gnu/packages/tree-sitter.scm (python-tree-sitter-grammar): New procedure.
Change-Id: I07cd396305cb17e55662fff9bd4e6d847927afad
Signed-off-by: Liliana Marie Prikler <liliana.prikler@gmail.com>
Diffstat (limited to 'gnu')
| -rw-r--r-- | gnu/packages/tree-sitter.scm | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 7d48a5a4afc..e582413d906 100644 --- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -10,6 +10,7 @@ ;;; Copyright © 2024 Foundation Devices, Inc. <hello@foundation.xyz> ;;; Copyright © 2025 Andrew Wong <wongandj@icloud.com> ;;; Copyright © 2025 Nguyễn Gia Phong <mcsinyx@disroot.org> +;;; Copyright © 2025 Evgenii Klimov <eugene.dev@lipklim.org> ;;; ;;; This file is part of GNU Guix. ;;; @@ -29,6 +30,7 @@ (define-module (gnu packages tree-sitter) #:use-module ((guix licenses) #:prefix license:) #:use-module (gnu packages) + #:use-module (gnu packages check) #:use-module (gnu packages graphviz) #:use-module (gnu packages icu4c) #:use-module (gnu packages node) @@ -40,6 +42,7 @@ #:use-module (guix download) #:use-module (guix gexp) #:use-module (guix git-download) + #:use-module (guix i18n) #:use-module (guix packages) #:use-module (guix utils)) @@ -888,3 +891,24 @@ which will be used as a snippet in origin." "1r9p7hhnc1zagwxzdxhs4p6rnqs9naddkgbfymi6pbw6cyg2ccwl" "1.1.2" #:repository-url "https://github.com/tree-sitter-grammars/tree-sitter-zig")) + +(define* (python-tree-sitter-grammar pkg #:key tests?) + "Returns a package for Python bindings of a Tree-sitter grammar. PKG is a +package for a Tree-sitter grammar; its name will be used with python- prefix +to generate the package name. When TESTS? is true, tests are enabled." + (package + (inherit pkg) + (name (string-append "python-" (package-name pkg))) + (source (origin (inherit (package-source pkg)) + (snippet #f) (patches '()))) + (build-system pyproject-build-system) + (arguments (list #:tests? tests?)) + (build-system pyproject-build-system) + (native-inputs (append (if tests? + (list python-pytest + python-tree-sitter) + '()) + (list python-setuptools + python-wheel))) + (description (string-append (package-description pkg) + (P_ "\n\nThis variant provides Python bindings."))))) |
