Subject: [bug#76712] [PATCH 6/7] gnu: python-pyvips: Update to 2.2.3.

From: Vinicius Monego <[email-masked]>
Date: Mon, 3 Mar 2025 14:02:14 +0000

* gnu/packages/python-xyz.scm (python-pyvips): Update to 2.2.3.
[source]: Fetch from GitHub.
[build-system]: Use pyproject-build-system.
[arguments]<:phases>: Delete the now unnecessary 'fix-build, 'fix-paths
and custom 'check phase. Also build in API mode.
[native-inputs]: Add pkg-config, python-setuptools, python-wheel. Remove
python-pytest-flake8, python-pytest-runner.
[propagated-inputs]: Add python-pkgconfig.
* gnu/packages/python-xyz.scm (python-pyvips-for-python-scooby): Do not
delete the phase that was deleted in the parent package.

Change-Id: I8b3ac54f5b118a565f7297cf455698e690197e78
---
 gnu/packages/python-xyz.scm | 58 +++++++++----------------------------
 1 file changed, 14 insertions(+), 44 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c15671b53f..7a3dcc0c76 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -12071,56 +12071,27 @@ (define-public python-imageio
 (define-public python-pyvips
   (package
     (name "python-pyvips")
-    (version "2.2.1")
+    (version "2.2.3")
     (source
      (origin
-       (method url-fetch)
-       (uri (pypi-uri "pyvips" version))
+       (method git-fetch) ; PyPI does not include test helpers
+       (uri (git-reference
+             (url "https://github.com/libvips/pyvips")
+             (commit (string-append "v" version))))
+       (file-name (git-file-name name version))
        (sha256
-        (base32 "1dfbwwvnnsk4g2kj1pw654z9jq3mb72l1m8ma29858jpn12vn7dm"))))
-    (build-system python-build-system)
-    (arguments
-     (list #:phases
-           #~(modify-phases %standard-phases
-               ;; Maybe switch to API mode (i.e., build the C extension)?
-               ;; It is advertised as faster to start up and run.
-               ;; However, even with ‘pkg-config’ and ‘python-pkgconfig’ in
-               ;; ‘native-inputs’, the API mode build fails with:
-               ;;
-               ;;   Falling back to ABI mode. Details: unable to find pkg-config package "vips"
-               ;;
-               ;; The build doesn't actually fail without the below
-               ;; substitution, it's just slower because ‘setup.py’ tries
-               ;; (unsuccessfully) to download the Python ‘pkgconfig’ module.
-               (add-after 'unpack 'fix-build
-                 (lambda _
-                   (substitute* "setup.py"
-                     (("^( +setup_)API\\(\\)\n" _ prefix)
-                      (string-append prefix "ABI()\n")))))
-               (add-after 'unpack 'fix-paths
-                 (lambda _
-                   (substitute* "pyvips/__init__.py"
-                     (("^( +_vips_libname) = '(libvips.so.42)'"
-                       _ var libname)
-                      (format #f "~a = '~a/lib/~a'"
-                              var #$(this-package-input "vips") libname))
-                     (("^( +_gobject_libname) = '(libgobject-2.0.so.0)'"
-                       _ var libname)
-                      (format #f "~a = '~a/lib/~a'"
-                              var #$(this-package-input "glib") libname)))))
-               (replace 'check
-                 (lambda* (#:key tests? #:allow-other-keys)
-                   (when tests?
-                     (invoke "python" "setup.py" "test")))))))
+        (base32 "1ddk9njjc1kqjdmf95mwij83gjg0wg9d8qrl3abm19bmwiq7aq0h"))))
+    (build-system pyproject-build-system)
     (native-inputs
-     (list python-pyperf
+     (list pkg-config
+           python-pyperf
            python-pytest
-           python-pytest-flake8
-           python-pytest-runner))
+           python-setuptools
+           python-wheel))
     (inputs
      (list glib vips))
     (propagated-inputs
-     (list python-cffi))
+     (list python-cffi python-pkgconfig))
     (home-page "https://github.com/libvips/pyvips")
     (synopsis "Python bindings for VIPS")
     (description "The @code{pyvips} package provides Python bindings for VIPS,
@@ -39096,9 +39067,8 @@ (define python-pyvips-for-python-scooby
     (name "python-pyvips-for-python-scooby")
     (arguments
      (substitute-keyword-arguments (package-arguments python-pyvips)
-       ((#:phases phases)
+       ((#:phases phases '%standard-phases)
         #~(modify-phases #$phases
-            (delete 'fix-paths)
             ;; The checks won't succeed without VIPS.
             (delete 'check)
             (delete 'sanity-check)))))
-- 
2.48.1