guix_mirror_bot pushed a commit to branch rust-team
in repository guix.
commit 703bd013aff6cf12e0290aba431318fe143e7b6b
Author: Efraim Flashner <[email protected]>
AuthorDate: Tue Nov 11 14:41:33 2025 +0200
gnu: ruff: Install shell completions.
* gnu/packages/python-check.scm (ruff)[arguments]: Add a phase to
install the shell completions.
[native-inputs]: Add this-package when cross-compiling.
Change-Id: Ib9fd21d7616e49fb5cf2e7da83ca09bfeb876196
---
gnu/packages/python-check.scm | 31 ++++++++++++++++++++++++++++---
1 file changed, 28 insertions(+), 3 deletions(-)
diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index 9f73c270b2..53fbc57f03 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -1,6 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2015, 2017 Cyril Roelandt <[email protected]>
-;;; Copyright © 2015, 2019, 2020, 2021 Efraim Flashner <[email protected]>
+;;; Copyright © 2015, 2019-2021, 2025 Efraim Flashner <[email protected]>
;;; Copyright © 2016-2022 Marius Bakke <[email protected]>
;;; Copyright © 2016 宋文武 <[email protected]>
;;; Copyright © 2017 Muriithi Frederick Muriuki <[email protected]>
@@ -5017,6 +5017,10 @@ unused.")
(list
#:cargo-install-paths ''("crates/ruff")
#:install-source? #f
+ #:modules
+ '((guix build cargo-build-system)
+ (guix build utils)
+ (ice-9 match))
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'use-guix-vendored-dependencies
@@ -5043,8 +5047,29 @@ unused.")
(setenv
"CARGO_FEATURE_UNPREFIXED_MALLOC_ON_SUPPORTED_PLATFORMS" "1")
(setenv "JEMALLOC_OVERRIDE"
- (string-append jemalloc "/lib/libjemalloc.so"))))))))
- (native-inputs (list pkg-config))
+ (string-append jemalloc "/lib/libjemalloc.so")))))
+ (add-after 'install 'install-completions
+ (lambda* (#:key native-inputs #:allow-other-keys)
+ (for-each
+ (match-lambda
+ ((shell . path)
+ (mkdir-p (in-vicinity #$output (dirname path)))
+ (let ((binary
+ (if #$(%current-target-system)
+ (search-input-file native-inputs "bin/ruff")
+ (in-vicinity #$output "bin/ruff"))))
+ (with-output-to-file (in-vicinity #$output path)
+ (lambda _
+ (invoke binary "generate-shell-completion" shell))))))
+ '(("bash" . "share/bash-completion/completions/ruff")
+ ("elvish" . "share/elvish/lib/ruff")
+ ("fish" . "share/fish/vendor_completions.d/ruff.fish")
+ ("zsh" . "share/zsh/site-functions/_ruff"))))))))
+ (native-inputs
+ (append (if (%current-target-system)
+ (list this-package)
+ '())
+ (list pkg-config)))
(inputs
(cons* jemalloc
`(,zstd "lib")