aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVinicius Monego <monego@posteo.net>2025-03-02 00:23:17 +0000
committerSharlatan Hellseher <sharlatanus@gmail.com>2025-04-29 12:30:48 +0100
commitfbf766295710078b5cd2e8810459908d9f777442 (patch)
tree4f9a7981c94e6245e8a93b2514288e6ab7cde5ec
parent6ec4ed678fd9d1ead03cfb2860556dd8b17de755 (diff)
downloadguix-fbf766295710078b5cd2e8810459908d9f777442.tar.gz
guix-fbf766295710078b5cd2e8810459908d9f777442.zip
gnu: Add python-imageio-freeimage.
* gnu/packages/python-xyz.scm (python-imageio-freeimage): New variable. (python-imageio)[arguments]<#:phases>: Remove the freeimage substitution from the 'fix-source phase. Delete the 'fix-failing-tests phase, add test logic in #:test-flags instead. [inputs]: Remove freeimage. Change-Id: I842998baea1568e1d9d1328e4387d14867bd3bb2 Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
-rw-r--r--gnu/packages/python-xyz.scm68
1 files changed, 51 insertions, 17 deletions
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 99421206d2..23563e57ce 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -80,7 +80,7 @@
;;; Copyright © 2020 Josh Holland <josh@inv.alid.pw>
;;; Copyright © 2020 Yuval Kogman <nothingmuch@woobling.org>
;;; Copyright © 2020, 2022 Michael Rohleder <mike@rohleder.de>
-;;; Copyright © 2020, 2021, 2022, 2023, 2024 Vinicius Monego <monego@posteo.net>
+;;; Copyright © 2020, 2021, 2022, 2023, 2024, 2025 Vinicius Monego <monego@posteo.net>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury@disroot.org>
;;; Copyright © 2020 Hendursaga <hendursaga@yahoo.com>
;;; Copyright © 2020 Malte Frank Gerdes <malte.f.gerdes@gmail.com>
@@ -12472,6 +12472,50 @@ files. It implements generator functions for reading and writing data to and
from FFMPEG, reliably terminating the process when done.")
(license license:bsd-2)))
+(define-public python-imageio-freeimage
+ (package
+ (name "python-imageio-freeimage")
+ (version "0.1.1")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "imageio_freeimage" version))
+ (sha256
+ (base32 "1la0iv3617m52dnidhhrdaz9dpnlfqs7b83550d3jkjavv30md72"))))
+ (build-system pyproject-build-system)
+ (arguments
+ (list
+ #:tests? #f ; tests need internet and are not distributed in PyPI
+ #:phases
+ #~(modify-phases %standard-phases
+ ;; imageio_freeimage expects a copy of the library in its source
+ ;; tree. Changing this would require hacky substitutions.
+ (add-after 'install 'freeimage-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (let* ((pylib (string-append #$output "/lib/python"
+ #$(version-major+minor
+ (package-version python))
+ "/site-packages"))
+ (iofi (string-append pylib "/imageio_freeimage")))
+ (mkdir-p (string-append iofi "/_lib"))
+ (symlink (search-input-file inputs "lib/libfreeimage.so")
+ (string-append iofi "/_lib/libfreeimage.so"))))))))
+ (native-inputs (list python-poetry-core python-requests python-setuptools
+ python-wheel))
+ (inputs (list freeimage))
+ (propagated-inputs (list python-imageio))
+ (home-page "https://github.com/imageio/imageio-freeimage")
+ (synopsis "Plugin for ImageIO that wraps the FreeImage library")
+ (description
+ "This package provides a plugin for @code{ImageIO} that wraps the
+@code{FreeImage} library.")
+ ;; As a derivative work of FreeImage, imageio_freeimage is licensed under
+ ;; GPLv2 or GPLv3, and the FreeImage Public License (FIPL).
+ ;; For more information, see the LICENSE file.
+ (license
+ (list license:gpl2 license:gpl3
+ (license:non-copyleft "https://spdx.org/licenses/FreeImage.html")))))
+
(define-public python-imageio
(package
(name "python-imageio")
@@ -12486,28 +12530,18 @@ from FFMPEG, reliably terminating the process when done.")
(build-system pyproject-build-system)
(arguments
(list
- #:test-flags #~(list "-m" "not needs_internet")
+ #:test-flags #~(list "-m" "not needs_internet"
+ ;; This attempts to load libGL.so (provided by mesa)
+ ;; at the Python store path (sys.base_prefix?).
+ "-k" "not test_findlib2"
+ "--ignore" "tests/test_freeimage.py")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'fix-source
(lambda* (#:key inputs #:allow-other-keys)
- (substitute* "imageio/plugins/_freeimage.py"
- (("os\\.getenv\\(\"IMAGEIO_FREEIMAGE_LIB\".*\\)" all)
- (string-append
- "(" all " or \""
- (search-input-file inputs "lib/libfreeimage.so")
- "\")")))
(substitute* "imageio/core/util.py"
(("\"/var/tmp\"")
- "os.getenv(\"TMPDIR\", \"/tmp\")"))))
- (add-after 'unpack 'fix-failing-tests
- (lambda _
- (substitute* "tests/test_core.py"
- (("(core\\.load_lib)\\((\\[gllib\\], \\[\\])\\)"
- all fun args)
- (string-append "raises(ValueError, " fun ", " args ")")))
- (delete-file "tests/test_freeimage.py"))))))
- (inputs (list freeimage))
+ "os.getenv(\"TMPDIR\", \"/tmp\")")))))))
(propagated-inputs
(list python-imageio-ffmpeg python-numpy python-pillow python-tifffile))
(native-inputs