guix_mirror_bot pushed a commit to branch master
in repository guix.

commit 4b82c01243f955f9ab657ade00ba03fdc5142370
Author: Nicolas Graves <[email protected]>
AuthorDate: Thu Oct 23 22:08:20 2025 +0200

    gnu: python-magic: Switch to pyproject.
    
    * gnu/packages/python-xyz.scm (python-magic):
    [source]<modules, snippet>: Move them in phases.
    [build-system]: Switch to pyproject-build-system.
    [arguments]<#:test-backend, #:test-flags>: Run tests.
    <#:phases>: Remove 'check phase replacement.  Import phase 'fix-tests
    from [source].  Improve style of phase 'hard-code-path-to-libmagic.
    [native-inputs]: Add python-setuptools.
    [description]: Improve style.
    
    Change-Id: I0496e7e3b6f800e8358c133066e366ee144a24b3
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/python-xyz.scm | 65 +++++++++++++++++++--------------------------
 1 file changed, 28 insertions(+), 37 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index bc8dc1baef..d4cfbfd187 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -21857,49 +21857,40 @@ for Python inspired by modern web development.")
        (uri (git-reference (url home-page) (commit version)))
        (file-name (git-file-name name version))
        (sha256
-        (base32
-         "1x11kfn4g244fia9a7y4ly8dqv5zsxfg3l5azc54dl6gkp2bk7vx"))
-       (modules '((guix build utils)))
-       ;; Adjust expected output for [email protected].
-       (snippet #~(substitute* "test/libmagic_test.py"
-                    (("PDF document, version 1\\.2, 2 pages")
-                     "PDF document, version 1.2, 2 page(s)")))))
-    (build-system python-build-system)
+        (base32 "1x11kfn4g244fia9a7y4ly8dqv5zsxfg3l5azc54dl6gkp2bk7vx"))))
+    (build-system pyproject-build-system)
     (arguments
-     '(#:phases (modify-phases %standard-phases
-                  ;; Replace a specific method call with a hard-coded
-                  ;; path to the necessary libmagic.so file in the
-                  ;; store.  If we don't do this, then the method call
-                  ;; will fail to find the libmagic.so file, which in
-                  ;; turn will cause any application using
-                  ;; python-magic to fail.
-                  (add-before 'build 'hard-code-path-to-libmagic
-                    (lambda* (#:key inputs #:allow-other-keys)
-                      (let ((magic (search-input-file inputs 
"/lib/libmagic.so")))
-                        (substitute* "magic/loader.py"
-                          (("find_library\\('magic'\\)")
-                           (string-append "'" magic "'"))))))
-                  (replace 'check
-                    (lambda* (#:key tests? #:allow-other-keys)
-                      ;; The test suite mandates this variable.
-                      (setenv "LC_ALL" "C.UTF-8")
-                      (if tests?
-                          (with-directory-excursion "test"
-                            (invoke "python" "./libmagic_test.py"))
-                          (format #t "test suite not run~%")))))))
-    (native-inputs
-     (list which))
+     (list
+      #:test-backend #~'custom
+      #:test-flags #~(list "test/libmagic_test.py")
+      #:phases
+      #~(modify-phases %standard-phases
+          (add-after 'unpack 'fix-tests
+            (lambda _
+              ;; Adjust expected output for [email protected].
+              (substitute* "test/libmagic_test.py"
+                (("PDF document, version 1\\.2, 2 pages")
+                 "PDF document, version 1.2, 2 page(s)"))))
+          ;; Replace a specific method call with a hard-coded path to the
+          ;; necessary libmagic.so file in the store.
+          (add-before 'build 'hard-code-path-to-libmagic
+            (lambda* (#:key inputs #:allow-other-keys)
+              (substitute* "magic/loader.py"
+                (("find_library\\('magic'\\)")
+                 (format #f "~s"
+                         (search-input-file inputs "lib/libmagic.so")))))))))
+    (native-inputs (list which python-setuptools))
     (inputs
      ;; python-magic needs to be able to find libmagic.so.
      (list file))
     (synopsis "File type identification using libmagic")
     (description
-     "This module uses ctypes to access the libmagic file type
-identification library.  It makes use of the local magic database and
-supports both textual and MIME-type output.  Note that this module and
-the python-file module both provide a \"magic.py\" file; these two
-modules, which are different and were developed separately, both serve
-the same purpose: to provide Python bindings for libmagic.")
+     "This module uses ctypes to access the libmagic file type identification
+library.  It makes use of the local magic database and supports both textual
+and MIME-type output.  Note that this module and the python-file module both
+provide a \"magic.py\" file; these two modules, which are different and were
+developed separately, both serve the same purpose: to provide Python bindings
+for libmagic.")
     (license license:expat)))
 
 (define-public s3cmd

Reply via email to