summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiacomo Leidi <therewasa@fishinthecalculator.me>2026-01-03 01:59:09 +0100
committerRutherther <rutherther@ditigal.xyz>2026-01-25 21:23:09 +0100
commit03fd94c43731e8acf60b28ebf705adeedcc25061 (patch)
tree698a0ae6d6294a8d30577724852c9f23dfbdddc6
parentd94936546a34de98d139c7d94c822298e2a9bec8 (diff)
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 <sharlatanus@gmail.com> Signed-off-by: Rutherther <rutherther@ditigal.xyz>
-rw-r--r--gnu/packages/python-xyz.scm42
1 files changed, 39 insertions, 3 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 4a2851ea2e7..5b763e23090 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -64,7 +64,7 @@
64;;; Copyright © 2019, 2020 Alex Griffin <a@ajgrf.com> 64;;; Copyright © 2019, 2020 Alex Griffin <a@ajgrf.com>
65;;; Copyright © 2019, 2020, 2021, 2022, 2023 Pierre Langlois <pierre.langlois@gmx.com> 65;;; Copyright © 2019, 2020, 2021, 2022, 2023 Pierre Langlois <pierre.langlois@gmx.com>
66;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com> 66;;; Copyright © 2019 Jacob MacDonald <jaccarmac@gmail.com>
67;;; Copyright © 2019-2021, 2023, 2024 Giacomo Leidi <therewasa@fishinthecalculator.me> 67;;; Copyright © 2019-2021, 2023, 2024, 2026 Giacomo Leidi <therewasa@fishinthecalculator.me>
68;;; Copyright © 2019 Wiktor Żelazny <wzelazny@vurv.cz> 68;;; Copyright © 2019 Wiktor Żelazny <wzelazny@vurv.cz>
69;;; Copyright © 2019, 2020, 2021, 2022 Tanguy Le Carrour <tanguy@bioneland.org> 69;;; Copyright © 2019, 2020, 2021, 2022 Tanguy Le Carrour <tanguy@bioneland.org>
70;;; Copyright © 2019, 2021-2023 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de> 70;;; Copyright © 2019, 2021-2023 Mădălin Ionel Patrașcu <madalinionel.patrascu@mdc-berlin.de>
@@ -26693,8 +26693,20 @@ interpreter. bpython's main features are
26693 (sha256 26693 (sha256
26694 (base32 "0qfvs1sfvlpfb10rxlivwa96mg0ibczis554s2rx32s11nynzvbk")))) 26694 (base32 "0qfvs1sfvlpfb10rxlivwa96mg0ibczis554s2rx32s11nynzvbk"))))
26695 (build-system pyproject-build-system) 26695 (build-system pyproject-build-system)
26696 (arguments (list #:tests? #f)) ;no tests 26696 (arguments
26697 (native-inputs (list python-setuptools)) 26697 (list
26698 #:tests? #f ;no tests
26699 #:phases
26700 #~(modify-phases %standard-phases
26701 (add-after 'unpack 'drop-shebang
26702 (lambda _
26703 ;; Dropping this shebang prevents the build system from adding
26704 ;; python-wrapper as an input, reducing package closure size from
26705 ;; ~200 MiB to ~0.2 MiB.
26706 (substitute* "python3/pyinotify.py"
26707 (("#!/usr/bin/env python") "")))))))
26708 (native-inputs
26709 (list python-setuptools))
26698 (home-page "https://github.com/seb-m/pyinotify") 26710 (home-page "https://github.com/seb-m/pyinotify")
26699 (synopsis "Python library for monitoring inotify events") 26711 (synopsis "Python library for monitoring inotify events")
26700 (description 26712 (description
@@ -26702,6 +26714,30 @@ interpreter. bpython's main features are
26702events on Linux.") 26714events on Linux.")
26703 (license license:expat))) 26715 (license license:expat)))
26704 26716
26717(define-public python-pyinotify-cli
26718 (package
26719 (inherit python-pyinotify)
26720 (name "python-pyinotify-cli")
26721 (arguments
26722 (substitute-keyword-arguments (package-arguments python-pyinotify)
26723 ((#:phases phases #~%standard-phases)
26724 #~(modify-phases #$phases
26725 (delete 'drop-shebang)
26726 (add-after 'install 'install-entrypoint
26727 (lambda _
26728 (let ((entrypoint
26729 (string-append #$output "/lib/python"
26730 (python-version (which "python"))
26731 "/site-packages/pyinotify.py"))
26732 (bin (string-append #$output "/bin")))
26733 (mkdir-p bin)
26734 (invoke "chmod" "+x" entrypoint)
26735 (symlink
26736 entrypoint (string-append #$output "/bin/pyinotify")))))))))
26737 (description
26738 "This package provides, in addition to the @code{pyinotify} Python library,
26739a command line application exposing the same functionality.")))
26740
26705(define-public python-more-itertools 26741(define-public python-more-itertools
26706 (package 26742 (package
26707 (name "python-more-itertools") 26743 (name "python-more-itertools")