GNU bug report logs -
#76354
[PATCH] gnu: Add python-imageio-freeimage.
Previous Next
Reported by: Vinicius Monego <monego <at> posteo.net>
Date: Sun, 16 Feb 2025 23:44:01 UTC
Severity: normal
Tags: patch
Done: Sharlatan Hellseher <sharlatanus <at> gmail.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 76354 in the body.
You can then email your comments to 76354 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Sun, 16 Feb 2025 23:44:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Vinicius Monego <monego <at> posteo.net>
:
New bug report received and forwarded. Copy sent to
guix-patches <at> gnu.org
.
(Sun, 16 Feb 2025 23:44:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/python-xyz.scm (python-imageio-freeimage): New variable.
(python-imageio)[arguments]: Remove the freeimage substitution from the
'fix-source phase.
[inputs]: Remove freeimage.
Change-Id: I842998baea1568e1d9d1328e4387d14867bd3bb2
---
This patch is intended to clear transitive dependencies on openexr <at> 2 and freeimage via imageio, which includes a freeimage plugin. Imageio has around ~100 packages to rebuild.
Freeimage last release was back in 2018, it is unknown to me whether it is still maintained and it may contain known and unpatched vulnerabilities (guix lint -c cve freeimage). OpenEXR 2 was also abandoned in favor of OpenEXR 3.
It seems that Debian has a patch to make freeimage work with OpenEXR 3. I may have a look at this later.
I noticed that imageio made a separate package for freeimage due to license concerns but I thought it would be a good fit for Guix for the reasons aforementioend.
Anyway, freeimage is slowly being deprecated in imageio: https://github.com/imageio/imageio/issues/892
gnu/packages/python-xyz.scm | 51 +++++++++++++++++++++++++++++++------
1 file changed, 43 insertions(+), 8 deletions(-)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index bb0ab777d5..0a9d0e02b0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -80,7 +80,7 @@
;;; Copyright © 2020 Josh Holland <josh <at> inv.alid.pw>
;;; Copyright © 2020 Yuval Kogman <nothingmuch <at> woobling.org>
;;; Copyright © 2020, 2022 Michael Rohleder <mike <at> rohleder.de>
-;;; Copyright © 2020, 2021, 2022, 2023, 2024 Vinicius Monego <monego <at> posteo.net>
+;;; Copyright © 2020, 2021, 2022, 2023, 2024, 2025 Vinicius Monego <monego <at> posteo.net>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury <at> disroot.org>
;;; Copyright © 2020 Hendursaga <hendursaga <at> yahoo.com>
;;; Copyright © 2020 Malte Frank Gerdes <malte.f.gerdes <at> gmail.com>
@@ -11892,6 +11892,48 @@ (define-public python-imageio-ffmpeg
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:gplv2 license:gplv3 license:non-copyleft))))
+
(define-public python-imageio
(package
(name "python-imageio")
@@ -11911,12 +11953,6 @@ (define-public python-imageio
#~(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\")"))))
@@ -11927,7 +11963,6 @@ (define-public python-imageio
all fun args)
(string-append "raises(ValueError, " fun ", " args ")")))
(delete-file "tests/test_freeimage.py"))))))
- (inputs (list freeimage))
(propagated-inputs
(list python-imageio-ffmpeg python-numpy python-pillow python-tifffile))
(native-inputs
base-commit: b4dc8eb4adff9d824ff7df704e134964b3b47396
--
2.48.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Mon, 17 Feb 2025 00:02:03 GMT)
Full text and
rfc822 format available.
Message #8 received at 76354 <at> debbugs.gnu.org (full text, mbox):
* gnu/packages/python-xyz.scm (python-imageio-freeimage): New variable.
(python-imageio)[arguments]: Remove the freeimage substitution from the
'fix-source phase.
[inputs]: Remove freeimage.
Change-Id: I842998baea1568e1d9d1328e4387d14867bd3bb2
---
Fixed license list. No other changes.
gnu/packages/python-xyz.scm | 53 +++++++++++++++++++++++++++++++------
1 file changed, 45 insertions(+), 8 deletions(-)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index bb0ab777d5..d59cedb179 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -80,7 +80,7 @@
;;; Copyright © 2020 Josh Holland <josh <at> inv.alid.pw>
;;; Copyright © 2020 Yuval Kogman <nothingmuch <at> woobling.org>
;;; Copyright © 2020, 2022 Michael Rohleder <mike <at> rohleder.de>
-;;; Copyright © 2020, 2021, 2022, 2023, 2024 Vinicius Monego <monego <at> posteo.net>
+;;; Copyright © 2020, 2021, 2022, 2023, 2024, 2025 Vinicius Monego <monego <at> posteo.net>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury <at> disroot.org>
;;; Copyright © 2020 Hendursaga <hendursaga <at> yahoo.com>
;;; Copyright © 2020 Malte Frank Gerdes <malte.f.gerdes <at> gmail.com>
@@ -11892,6 +11892,50 @@ (define-public python-imageio-ffmpeg
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")
@@ -11911,12 +11955,6 @@ (define-public python-imageio
#~(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\")"))))
@@ -11927,7 +11965,6 @@ (define-public python-imageio
all fun args)
(string-append "raises(ValueError, " fun ", " args ")")))
(delete-file "tests/test_freeimage.py"))))))
- (inputs (list freeimage))
(propagated-inputs
(list python-imageio-ffmpeg python-numpy python-pillow python-tifffile))
(native-inputs
base-commit: b4dc8eb4adff9d824ff7df704e134964b3b47396
--
2.48.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Tue, 18 Feb 2025 17:27:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 76354 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
> (python-imageio)[arguments]: Remove the freeimage substitution from the
> 'fix-source phase.
--8<---------------cut here---------------start------------->8---
(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"))))))
--8<---------------cut here---------------end--------------->8---
It looks the whole [arguments] block may be removed and skip test
logic applied in #:test-flags as the package uses python-pytest e.g.
"--ignore=tests/test_freeimage.py" or "-k not <test-name>".
--8<---------------cut here---------------start------------->8---
+ #:tests? #f ; tests need internet and are not distributed in PyPI
--8<---------------cut here---------------end--------------->8---
Maybe install from Git?
<https://github.com/imageio/imageio-freeimage/blob/master/tests/test_freeimage.py>
the only one tests file which does not require urllib or requrests.
--8<---------------cut here---------------start------------->8---
(symlink (search-input-file inputs "lib/libfreeimage.so")
--8<---------------cut here---------------end--------------->8---
Maybe swap to #$(this-package-input "<package>") instead?
---
Oleg
[signature.asc (application/pgp-signature, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Sun, 02 Mar 2025 00:24:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 76354 <at> debbugs.gnu.org (full text, mbox):
* 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
---
gnu/packages/python-xyz.scm | 68 +++++++++++++++++++++++++++----------
1 file changed, 51 insertions(+), 17 deletions(-)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index c15671b53f..d3b42f7631 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -80,7 +80,7 @@
;;; Copyright © 2020 Josh Holland <josh <at> inv.alid.pw>
;;; Copyright © 2020 Yuval Kogman <nothingmuch <at> woobling.org>
;;; Copyright © 2020, 2022 Michael Rohleder <mike <at> rohleder.de>
-;;; Copyright © 2020, 2021, 2022, 2023, 2024 Vinicius Monego <monego <at> posteo.net>
+;;; Copyright © 2020, 2021, 2022, 2023, 2024, 2025 Vinicius Monego <monego <at> posteo.net>
;;; Copyright © 2020 Guy Fleury Iteriteka <gfleury <at> disroot.org>
;;; Copyright © 2020 Hendursaga <hendursaga <at> yahoo.com>
;;; Copyright © 2020 Malte Frank Gerdes <malte.f.gerdes <at> gmail.com>
@@ -12014,6 +12014,50 @@ (define-public python-imageio-ffmpeg
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")
@@ -12028,28 +12072,18 @@ (define-public python-imageio
(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
base-commit: e7b87dcde25b5ef278441d6ea42a7f662fe6d53f
--
2.48.1
Information forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Sun, 02 Mar 2025 00:36:01 GMT)
Full text and
rfc822 format available.
Message #17 received at 76354 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
> It looks the whole [arguments] block may be removed and skip test
> logic applied in #:test-flags as the package uses python-pytest e.g.
> "--ignore=tests/test_freeimage.py" or "-k not <test-name>".
Done, but I had to keep the TMPDIR substitution.
> Maybe install from Git?
> https://github.com/imageio/imageio-freeimage/blob/master/tests/test_freeimage.py
> the only one tests file which does not require urllib or requrests.
I tried, but most tests run imageio's downloader under the hood. IIRC
only 2 tests pass by default. Then I got to a point where some tests
pass in the build environment preserved by -K but still don't pass in
the build run. I eventually gave up on it as a few other tests were
still failing.
> Maybe swap to #$(this-package-input "<package>") instead?
Wasn't search-input-file preferred to not break package transformation?
I skipped this change in v3.
[Message part 2 (text/html, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Sun, 02 Mar 2025 00:37:02 GMT)
Full text and
rfc822 format available.
Message #20 received at 76354 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi,
> It looks the whole [arguments] block may be removed and skip test
> logic applied in #:test-flags as the package uses python-pytest e.g.
> "--ignore=tests/test_freeimage.py" or "-k not <test-name>".
Done, but I had to keep the TMPDIR substitution.
> Maybe install from Git?
> https://github.com/imageio/imageio-freeimage/blob/master/tests/test_freeimage.py
> the only one tests file which does not require urllib or requrests.
I tried, but most tests run imageio's downloader under the hood. IIRC
only 2 tests pass by default. Then I got to a point where some tests
pass in the build environment preserved by -K but still don't pass in
the build run. I eventually gave up on it as a few other tests were
still failing.
> Maybe swap to #$(this-package-input "<package>") instead?
Wasn't search-input-file preferred to not break package transformation?
I skipped this change in v3.
Vinicius
[Message part 2 (text/html, inline)]
Information forwarded
to
guix-patches <at> gnu.org
:
bug#76354
; Package
guix-patches
.
(Mon, 07 Apr 2025 11:31:01 GMT)
Full text and
rfc822 format available.
Message #23 received at 76354 <at> debbugs.gnu.org (full text, mbox):
Hello,
Maybe this v3 can be pushed to python-team along with a version update
to python-imageio and python-scikit-image? cc python-team
I couldn't apply all suggestions, but maybe someone else could try to
improve the package. QA also did not pick up this issue apparently.
Vinicius
Reply sent
to
Sharlatan Hellseher <sharlatanus <at> gmail.com>
:
You have taken responsibility.
(Tue, 29 Apr 2025 12:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Vinicius Monego <monego <at> posteo.net>
:
bug acknowledged by developer.
(Tue, 29 Apr 2025 12:08:02 GMT)
Full text and
rfc822 format available.
Message #28 received at 76354-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi Vinicius,
Sorry for delay and thanks for v3!
I've successfully built all first level dependent packages and have 100+
is ok to push directly to master.
--8<---------------cut here---------------start------------->8---
> ./pre-inst-env guix build -P1 python-imageio-freeimage -P1 python-imageio
guix build: computing dependents of package python-imageio-freeimage <at> 0.1.1...
guix build: computing dependents of package python-imageio <at> 2.36.1...
/gnu/store/m8h67ckjs0b1hvqv036cdgp78ih9hnb5-python-imageio-freeimage-0.1.1
/gnu/store/5mqdqyz0z11qxd4dyslic8axrslbwdvb-python-imageio-2.36.1
/gnu/store/v67jqcb3bhh205x7gl4rls9mxcy9payb-python-fanc-0.9.28
/gnu/store/dv2fcfci3hx86fjnzgl9wlxm83n1fbnw-python-pims-0.7
/gnu/store/8zdznsmbxpp4krxh15vkg7b8ddxvnpdk-python-clingraph-1.1.2
/gnu/store/vjq7ibv82p9gp02klhkr7wsjilbnrhck-python-pyvista-0.44.2
/gnu/store/0di2vw749n6v8b6vv47vwzcynlyy8l2j-python-scikit-image-0.23.2
/gnu/store/m8h67ckjs0b1hvqv036cdgp78ih9hnb5-python-imageio-freeimage-0.1.1
/gnu/store/70bj97fm6wib8krh33jlgi5vkn2lqvn4-python-matplotx-0.3.10
--8<---------------cut here---------------end--------------->8---
Pushed to maseter as fbf766295710078b5cd2e8810459908d9f777442.
--
Oleg
[signature.asc (application/pgp-signature, inline)]
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 28 May 2025 11:24:17 GMT)
Full text and
rfc822 format available.
This bug report was last modified 22 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.