From patchwork Fri Feb 18 14:39:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Langlois X-Patchwork-Id: 37322 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id ED13527BBEA; Fri, 18 Feb 2022 14:44:20 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 76E6527BBE9 for ; Fri, 18 Feb 2022 14:44:20 +0000 (GMT) Received: from localhost ([::1]:35496 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nL4Ud-00012v-KN for patchwork@mira.cbaines.net; Fri, 18 Feb 2022 09:44:19 -0500 Received: from eggs.gnu.org ([209.51.188.92]:43268) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nL4RT-0005Qg-II for guix-patches@gnu.org; Fri, 18 Feb 2022 09:41:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:59920) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1nL4RT-0005Q3-8j for guix-patches@gnu.org; Fri, 18 Feb 2022 09:41:03 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1nL4RT-0008Ub-6t for guix-patches@gnu.org; Fri, 18 Feb 2022 09:41:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#49946] [PATCH v4 05/31] gnu: Add tree-sitter-cli. Resent-From: Pierre Langlois Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 18 Feb 2022 14:41:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49946 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49946@debbugs.gnu.org Cc: Pierre Langlois Received: via spool by 49946-submit@debbugs.gnu.org id=B49946.164519521232427 (code B ref 49946); Fri, 18 Feb 2022 14:41:03 +0000 Received: (at 49946) by debbugs.gnu.org; 18 Feb 2022 14:40:12 +0000 Received: from localhost ([127.0.0.1]:53780 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL4Qd-0008Qr-EH for submit@debbugs.gnu.org; Fri, 18 Feb 2022 09:40:12 -0500 Received: from mout.gmx.net ([212.227.17.22]:57453) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1nL4QT-0008NR-RV for 49946@debbugs.gnu.org; Fri, 18 Feb 2022 09:40:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1645195195; bh=2zNsGflsbIMeCw5Z/VXAGLuxeE6NQq36yK7lwf07oGM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=ZtUzl5JJjVDSv2FjVtMpCH+cdwWhtOAS5VmeUddqULtI3ezmgX5T2zvRkPrBybefZ xkqGbrl5oaHxCeHc9RJAvjyb/V9IcmShtP1v9MAmaQursdTHRSTJD8a8+CKExXikWL MZilXfOa/WMh3Wq7J4qV/Qtn49gHgxFjTH8hvUvo= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from localhost.localdomain ([82.69.64.142]) by mail.gmx.net (mrgmx104 [212.227.17.174]) with ESMTPSA (Nemesis) id 1Mw9QC-1oAh4h2fkC-00s6c5; Fri, 18 Feb 2022 15:39:55 +0100 From: Pierre Langlois Date: Fri, 18 Feb 2022 14:39:22 +0000 Message-Id: <20220218143948.28989-5-pierre.langlois@gmx.com> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220218143948.28989-1-pierre.langlois@gmx.com> References: <877d9s2qa9.fsf@gmx.com> <20220218143948.28989-1-pierre.langlois@gmx.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:g+q2+EGMD6PzKSnAVnvmJRETCXRQdlobPrR3Fou5pREa35lDJEX oRFxcrt5Vzf9dQBjypA51PC/FMpULzX0NrvVQzkIVLI9IB/a9Dc0Mo5YooQP5aZiTSBWSXf t0UZSVAj1RjLBl2qPspXMu4t8dEbxlu16LOgF8fWe8mQx3l55u2SEIAGDQtjLlBiPhURBIP eHJ3PSBIYj6xqNtgXkvnQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:D4YhnqBy4eE=:xyXF/oGpI88uBV4K2E4ybi E0nZHY7Q9niNqSyQJ2FhohEGHr38QsoI00CXzpShW/rC+lmbSMTAU2WrEmkMMD2QddvGKSJOo A1TDF25phRWmV4Bcu+VItze3akndXeskt88yjyxQhN1v4s3/7OWkLIINcbyf8xJwh/nJoO0Mt oQBGxGBEYyC9e9CbkIvveH4/LrYbRpUODjfIpm8Z4bxXVTNfNib1w0Ik+rFKM1WMHWfgFaqhA xOLXU9ktzn3LAQ83pN7XwI0/Qm697uhZ1cG3Cp21Kdh96PqJAX579rabqXoKVDlUmSC86cEd+ mE49bxcsEVNSN2UyrlZocCzDTGCrBRc9MuXtKILkOoXGduLrb23S2C3ZCwB0SlsAE1urjvLr+ mOyKrC/+AIOs5I18YCIWEDiFT1kxvF42F92V+8F+pjC8SNtApT6NoNjJ1bH1zAvx5bITqtOu2 L1h9ykUSAITJn/y+P70OVVKUZR81hhLO1M16c+w9k4ERexh1bD8Scj8HcFkUcp3XJuE7jV1eJ Vhn4hncWPiGUQ8cLFc4MpV/SuypJ8WRnr8wgwWaZvqEDv6+E/fEASUz7z076MzT6FUAfOi0v2 n9ZRspcNsaZFSwv8xfzE7jwuce9tM0wD7Cr9eean97SSJ1Q4zYGwpySNrtMNHsVLvXC6C0zNo C4uoFTWFaxtUkwTMCvdt9nBHfLNQN8rwjGVoZQOgVXx6ziWdtnfiRjTAcDVaJGWvMFX5n/bi6 B7lFMV3003FPepqPGFrGaIxmUtm1AtM7VKA3Ok+Q0xzzlshhw7zk06BV9/+60z0z9YqtvoQKV w9OkJc0BoCWZYVhb7Gdfyb9+JkIBFz8vguzE0FMAwThvgz84EtssZ2vRJWmW9X1OUJz62oVFw iXAX/Y0fduXCFh1gAugIQ0BCV9GDrO/UawLRKmUk19nLMvew+uPMwQB1ZtIDTrYDyA3Rn2xfe dsdp4SoWwnnhAAGygprE0NMq1W+Ekv+mGCQ9XiKXm0EgxYDnqpCyC2jSm5WZdxm2ot19ZFPTe 54ZYipRIAQwI9KN4j2zC8CPxmfkQzVoI9irWMx3BynfC7DMO0FcD+VE/5vWzTIXX82JO3rDZm n/3ILToSk1rfcs= X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/tree-sitter.scm (tree-sitter-cli): New variable. --- gnu/packages/tree-sitter.scm | 66 ++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) -- 2.34.0 diff --git a/gnu/packages/tree-sitter.scm b/gnu/packages/tree-sitter.scm index 10a3a6e57c..cbf8ecdc6c 100644 --- a/gnu/packages/tree-sitter.scm +++ b/gnu/packages/tree-sitter.scm @@ -19,10 +19,13 @@ (define-module (gnu packages tree-sitter) #:use-module (guix gexp) #:use-module ((guix licenses) #:prefix license:) + #:use-module (guix build-system cargo) #:use-module (guix build-system gnu) #:use-module (guix git-download) #:use-module (guix packages) #:use-module (guix utils) + #:use-module (gnu packages crates-graphics) + #:use-module (gnu packages crates-io) #:use-module (gnu packages icu4c)) (define-public tree-sitter @@ -81,3 +84,66 @@ (define-public tree-sitter This package includes the @code{libtree-sitter} runtime library.") (license license:expat))) + +(define-public tree-sitter-cli + (package (inherit tree-sitter) + (name "tree-sitter-cli") + (build-system cargo-build-system) + (arguments + `(;; Running test requires downloading fixtures, see the + ;; script/fetch-fixtures script. + #:tests? #f + ;; FIXME: Installing the sources for the tree-sitter Rust bindings + ;; doesn't work out of the box due to tree-sitter having multiple + ;; Rust packages in the same repository (bindings and CLI). + #:install-source? #f + #:cargo-inputs + (("rust-ansi-term" ,rust-ansi-term-0.12) + ("rust-anyhow" ,rust-anyhow-1) + ("rust-atty" ,rust-atty-0.2) + ("rust-clap" ,rust-clap-2) + ("rust-difference" ,rust-difference-2) + ("rust-dirs" ,rust-dirs-3) + ("rust-html-escape" ,rust-html-escape-0.2) + ("rust-libloading" ,rust-libloading-0.7) + ("rust-rustc-hash" ,rust-rustc-hash-1) + ("rust-serde" ,rust-serde-1) + ("rust-smallbitvec" ,rust-smallbitvec-2) + ("rust-spin" ,rust-spin-0.7) + ("rust-thiserror" ,rust-thiserror-1) + ("rust-tiny-http" ,rust-tiny-http-0.8) + ("rust-toml" ,rust-toml-0.5) + ("rust-walkdir" ,rust-walkdir-2) + ("rust-webbrowser" ,rust-webbrowser-0.5) + ("rust-which" ,rust-which-4)) + #:cargo-development-inputs + (("rust-pretty-assertions" ,rust-pretty-assertions-0.7)) + #:phases + (modify-phases %standard-phases + (add-after 'unpack 'delete-cargo.lock + (lambda _ (delete-file "Cargo.lock"))) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin")) + (lib (string-append out "/lib"))) + (mkdir-p bin) + (install-file "target/release/tree-sitter" bin))))))) + (synopsis "Incremental parsing system for programming tools") + (description "Tree-sitter is a parser generator tool and an incremental +parsing library. It can build a concrete syntax tree for a source file and +efficiently update the syntax tree as the source file is edited. + +Tree-sitter aims to be: + +@enumerate +@item General enough to parse any programming language. +@item Fast enough to parse on every keystroke in a text editor. +@item Robust enough to provide useful results even in the presence of syntax +errors. +@item Dependency-free so that the runtime library (which is written in pure C) +can be embedded in any application. +@end enumerate + +This package includes the @command{tree-sitter} command-line tool.") + (license license:expat)))