guix_mirror_bot pushed a commit to branch python-team
in repository guix.

commit 6b6fea91b2ecc43aaf80980272f87fefdd18adcf
Author: Nicolas Graves <[email protected]>
AuthorDate: Wed Sep 17 17:19:27 2025 +0200

    build-system: pyproject: Normalize entry point import.
    
    The standard is using from instead of import and it indeed allows to
    avoid some side-effects in some cases, see
    
https://packaging.python.org/en/latest/specifications/entry-points/#use-for-scripts
    
    * guix/build/pyproject-build-system (create-entrypoints)
    [create-script]: Add -sP flags, improve pythonic style.
    
    * gnu/packages/video.scm (python-yewtube)[arguments]<#:phases>: Remove
    phase 'patch-script.
    
    Change-Id: I995454c774666ed474b2418c18ec36c4f53bf015
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/video.scm                | 9 ---------
 guix/build/pyproject-build-system.scm | 4 ++--
 2 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/gnu/packages/video.scm b/gnu/packages/video.scm
index 396a9f11f7..d3b1dbb9b1 100644
--- a/gnu/packages/video.scm
+++ b/gnu/packages/video.scm
@@ -6569,15 +6569,6 @@ can also directly record to WebM or MP4 if you prefer.")
           (add-before 'check 'configure-tests
             (lambda _
               (setenv "HOME" (getcwd))))
-          ;; XXX: This can happen when some side-effects happens at
-          ;; initialization. See https://codeberg.org/guix/guix/issues/1089
-          (add-before 'sanity-check 'patch-script
-            (lambda _
-              (substitute* (string-append #$output "/bin/.yt-real")
-                (("import mps_youtube as mod")
-                 "from mps_youtube.main import main")
-                (("sys\\.exit \\(mod\\.main\\.main \\(\\)\\)")
-                 "sys.exit(main())"))))
           (replace 'sanity-check
             (lambda _
               (invoke (string-append #$output "/bin/yt") "-h"))))))
diff --git a/guix/build/pyproject-build-system.scm 
b/guix/build/pyproject-build-system.scm
index 1fadd91d68..759cdc38d7 100644
--- a/guix/build/pyproject-build-system.scm
+++ b/guix/build/pyproject-build-system.scm
@@ -349,8 +349,8 @@ and return write it to PATH/NAME."
           (format port "#!~a
 # Auto-generated entry point script.
 import sys
-import ~a as mod
-sys.exit (mod.~a ())~%" interpreter module function)))
+from ~a import ~a
+sys.exit(~a())~%" interpreter module function function)))
       (chmod file-path #o755)))
 
   (let* ((site-dir (site-packages inputs outputs))

Reply via email to