guix_mirror_bot pushed a commit to branch next-master
in repository guix.

commit 0f18ca3f610aaa972e8023039a00158fcb4e10ed
Author: Giacomo Leidi <[email protected]>
AuthorDate: Sat Jan 3 01:59:09 2026 +0100

    gnu: python-pyinotify: Reduce package closure size.
    
    This Python package can be used both as a library and as a standalone
    command line application.  It does so by adding a shebang to the library
    code. Dropping this shebang prevents the build system from adding
    python-wrapper as an input, reducing package closure size from
    ~200 MiB to ~0.2 MiB.  A new python-pyinotify-cli package is added to
    allow users who desire so to use the CLI application.
    
    * gnu/packages/python-xyz.scm (python-pyinotify)[phases]{drop-shebang}:
    New phase.
    (python-pyinotify-cli): New variable.
    
    Change-Id: Ifb796d26fc6a7bedec69093f7c9bd43ada8bebac
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/python-xyz.scm | 42 +++++++++++++++++++++++++++++++++++++++---
 1 file changed, 39 insertions(+), 3 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index b1681ab540..9035526f3c 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -64,7 +64,7 @@
 ;;; Copyright © 2019, 2020 Alex Griffin <[email protected]>
 ;;; Copyright © 2019, 2020, 2021, 2022, 2023 Pierre Langlois 
<[email protected]>
 ;;; Copyright © 2019 Jacob MacDonald <[email protected]>
-;;; Copyright © 2019-2021, 2023, 2024 Giacomo Leidi 
<[email protected]>
+;;; Copyright © 2019-2021, 2023, 2024, 2026 Giacomo Leidi 
<[email protected]>
 ;;; Copyright © 2019 Wiktor Żelazny <[email protected]>
 ;;; Copyright © 2019, 2020, 2021, 2022 Tanguy Le Carrour <[email protected]>
 ;;; Copyright © 2019, 2021-2023 Mădălin Ionel Patrașcu 
<[email protected]>
@@ -26693,8 +26693,20 @@ interpreter. bpython's main features are
        (sha256
         (base32 "0qfvs1sfvlpfb10rxlivwa96mg0ibczis554s2rx32s11nynzvbk"))))
     (build-system pyproject-build-system)
-    (arguments (list #:tests? #f))      ;no tests
-    (native-inputs (list python-setuptools))
+    (arguments
+     (list
+      #:tests? #f          ;no tests
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'drop-shebang
+            (lambda _
+              ;; Dropping this shebang prevents the build system from adding
+              ;; python-wrapper as an input, reducing package closure size from
+              ;; ~200 MiB to ~0.2 MiB.
+              (substitute* "python3/pyinotify.py"
+                (("#!/usr/bin/env python") "")))))))
+    (native-inputs
+     (list python-setuptools))
     (home-page "https://github.com/seb-m/pyinotify";)
     (synopsis "Python library for monitoring inotify events")
     (description
@@ -26702,6 +26714,30 @@ interpreter. bpython's main features are
 events on Linux.")
     (license license:expat)))
 
+(define-public python-pyinotify-cli
+  (package
+    (inherit python-pyinotify)
+    (name "python-pyinotify-cli")
+    (arguments
+     (substitute-keyword-arguments (package-arguments python-pyinotify)
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (delete 'drop-shebang)
+            (add-after 'install 'install-entrypoint
+              (lambda _
+                (let ((entrypoint
+                       (string-append #$output "/lib/python"
+                                      (python-version (which "python"))
+                                      "/site-packages/pyinotify.py"))
+                      (bin (string-append #$output "/bin")))
+                  (mkdir-p bin)
+                  (invoke "chmod" "+x" entrypoint)
+                  (symlink
+                   entrypoint (string-append #$output "/bin/pyinotify")))))))))
+    (description
+     "This package provides, in addition to the @code{pyinotify} Python 
library,
+a command line application exposing the same functionality.")))
+
 (define-public python-more-itertools
   (package
     (name "python-more-itertools")

Reply via email to