Subject: [bug#74558] [PATCH rust-team 5/5] gnu: Add rust-libcst-1.

From: Maxim Cournoyer <[email-masked]>
Date: Thu, 28 Nov 2024 13:43:09 +0900

* gnu/packages/crates-io.scm (rust-libcst-1): New variable.

Change-Id: Ief66cbaf06a00ada6c2b497352c6143dd874cc32
---
 gnu/packages/crates-io.scm | 43 +++++++++++++++++++++++++++++++++++++-
 1 file changed, 42 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 401a20f239..e204e5df60 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -12,7 +12,7 @@
 ;;; Copyright © 2020 André Batista <[email-masked]>
 ;;; Copyright © 2020 Arun Isaac <[email-masked]>
 ;;; Copyright © 2020 Antoine Côté <[email-masked]>
-;;; Copyright © 2021, 2022, 2023 Maxim Cournoyer <[email-masked]>
+;;; Copyright © 2021-2024 Maxim Cournoyer <[email-masked]>
 ;;; Copyright © 2021 aecepoglu <[email-masked]>
 ;;; Copyright © 2021, 2022 Zheng Junjie <[email-masked]>
 ;;; Copyright © 2021 Alexandru-Sergiu Marton <[email-masked]>
@@ -39675,6 +39675,47 @@ (define-public rust-libcst-derive-1
     (description "This package provides Proc macro helpers for libcst.")
     (license license:expat)))
 
+(define-public rust-libcst-1
+  (package
+    (name "rust-libcst")
+    (version "1.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (crate-uri "libcst" version))
+       (file-name (string-append name "-" version ".tar.gz"))
+       (sha256
+        (base32 "0xdh02bz1gm9hlpz02r7mk90zk3ki74pypsama33vflck9bn0gps"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-test-flags
+       (list "--release" "--"
+             ;; The roundtrip_fixtures fail due to a missing file in the crate
+             ;; (see: https://github.com/Instagram/LibCST/issues/1249).
+             "--skip=roundtrip_fixtures")
+       #:cargo-inputs (("rust-chic" ,rust-chic-1)
+                       ("rust-libcst-derive" ,rust-libcst-derive-1)
+                       ("rust-memchr" ,rust-memchr-2)
+                       ("rust-paste" ,rust-paste-1)
+                       ("rust-peg" ,rust-peg-0.8)
+                       ("rust-pyo3" ,rust-pyo3-0.20)
+                       ("rust-regex" ,rust-regex-1)
+                       ("rust-thiserror" ,rust-thiserror-1))
+       #:cargo-development-inputs (("rust-criterion" ,rust-criterion-0.5)
+                                   ("rust-difference" ,rust-difference-2)
+                                   ("rust-itertools" ,rust-itertools-0.13)
+                                   ("rust-rayon" ,rust-rayon-1))
+       #:phases (modify-phases %standard-phases
+                  ;; Avoid keeping a reference to python-minimal in a test
+                  ;; file installed as source.
+                  (delete 'patch-source-shebangs))))
+    (native-inputs (list python-minimal))
+    (home-page "https://github.com/Instagram/LibCST")
+    (synopsis "Python parser and Concrete Syntax Tree library.")
+    (description
+     "This package provides a Python parser and Concrete Syntax Tree library.")
+    (license (list license:expat license:psfl))))
+
 (define-public rust-libdbus-sys-0.2
   (package
     (name "rust-libdbus-sys")
-- 
2.46.0