summary refs log tree commit diff
diff options
context:
space:
mode:
authorVivien Kraus <vivien@planete-kraus.eu>2022-02-07 00:36:00 +0100
committerTobias Geerinckx-Rice <me@tobias.gr>2022-02-13 01:00:03 +0100
commitc2cd42ed11a920f481bab5e9816d156d440dcb43 (patch)
tree291ca6420e5477ed01872fea7c00d9c1e45c68b9
parent7881751d247b7f6e1d8e74f0662512da2fc93b73 (diff)
downloadguix-c2cd42ed11a920f481bab5e9816d156d440dcb43.tar.gz
gnu: Add python-pyvips.
* gnu/packages/python-science.scm (python-pyvips): New variable.
-rw-r--r--gnu/packages/image-processing.scm48
1 files changed, 48 insertions, 0 deletions
diff --git a/gnu/packages/image-processing.scm b/gnu/packages/image-processing.scm
index 272f400f67..00c8db7f34 100644
--- a/gnu/packages/image-processing.scm
+++ b/gnu/packages/image-processing.scm
@@ -19,6 +19,7 @@
 ;;; Copyright © 2021 Paul Garlick <pgarlick@tourbillion-technology.com>
 ;;; Copyright © 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Ivan Gankevich <i.gankevich@spbu.ru>
+;;; Copyright © 2022 Vivien Kraus <vivien@planete-kraus.eu>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -69,6 +70,7 @@
   #:use-module (gnu packages icu4c)
   #:use-module (gnu packages image)
   #:use-module (gnu packages imagemagick)
+  #:use-module (gnu packages libffi)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages pdf)
   #:use-module (gnu packages perl)
@@ -633,6 +635,52 @@ quickly, especially on machines with more than one CPU core.  This is primarily
 due to its architecture which automatically parallelises the image workflows.")
     (license license:lgpl2.1+)))
 
+(define-public python-pyvips
+  (package
+    (name "python-pyvips")
+    (version "2.1.16")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pyvips" version))
+       (sha256
+        (base32 "1vc1k8adldwf5is5gj6ihg4gxa15ypkfr8h7d1w4dy0m980h6k35"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'set-pkgconfigpath
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((path
+                    (list->search-path-as-string
+                     (search-path-as-list
+                      '("lib/pkgconfig" "share/pkgconfig")
+                      (map cdr inputs))
+                     ":")))
+               (substitute* "pyvips/pyvips_build.py"
+                 (("import pkgconfig")
+                  (format #f
+                          "\
+import os
+os.environ['PKG_CONFIG_PATH'] = '~a'
+import pkgconfig"
+                          path)))))))))
+    (propagated-inputs
+     (list python-cffi python-pkgconfig))
+    (inputs (list vips expat glib libgsf fftw imagemagick orc lcms openexr
+                  imath poppler cairo librsvg matio libwebp pango libtiff
+                  libjpeg-turbo libexif))
+    (native-inputs
+     (list python-cffi
+           python-pyperf
+           python-pytest
+           python-pytest-flake8
+           python-pytest-runner))
+    (home-page "https://github.com/libvips/pyvips")
+    (synopsis "Binding for the libvips image processing library using cffi.")
+    (description "This package provides python bindings to libvips.")
+    (license license:expat)))
+
 (define-public gmic
   (package
     (name "gmic")