[PATCH] gnu: Add glymur

  • Done
  • quality assurance status badge
Details
2 participants
  • Ludovic Courtès
  • Sharlatan Hellseher
Owner
unassigned
Submitted by
Sharlatan Hellseher
Severity
normal

Debbugs page

Sharlatan Hellseher wrote 3 years ago
(address . guix-patches@gnu.org)
CAO+9K5r_1zaU7G_z+h2+M=zxXptGv4WJv4s0Bi0uBf-NRtFtoQ@mail.gmail.com
Hi Guix team!
This package contains Python interface to OpenJEPEG and LibTIFF which
requires some tweaks to let it find system library.
It's goes as one of the SunPy dependence I've started packing.
Toggle quote (1 lines)
> ./pre-inst-env guix build python-glymur --rounds=2 --check
successfully built
/gnu/store/r77vwchzhhfi40xlmffwxyjpa4x8wxzv-python-glymur-0.10.1.drv
successfully built
/gnu/store/r77vwchzhhfi40xlmffwxyjpa4x8wxzv-python-glymur-0.10.1.drv
/gnu/store/nx10j711hps4glkxfw17gx0np1wnz1vh-python-glymur-0.10.1
--
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.
From 776f0ce0a22c83809d9a3dc4752180580e3632df Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Sat, 2 Jul 2022 21:28:39 +0100
Subject: [PATCH] gnu: Add glymur

* gnu/packages/python-xyz.scm (python-glymur): New variable.
---
gnu/packages/python-xyz.scm | 74 ++++++++++++++++++++++++++++++++++++-
1 file changed, 73 insertions(+), 1 deletion(-)

Toggle diff (94 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 1d43049776..994045645d 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -94,7 +94,7 @@
;;; Copyright © 2020, 2021 Zheng Junjie <873216071@qq.com>
;;; Copyright © 2020 EuAndreh <eu@euandre.org>
;;; Copyright © 2021, 2022 Morgan Smith <Morgan.J.Smith@outlook.com>
-;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2021, 2022 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; Copyright © 2021 Ellis Kenyő <me@elken.dev>
;;; Copyright © 2021 LibreMiami <packaging-guix@libremiami.org>
;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
@@ -912,6 +912,78 @@ (define-public python-pyprind
of a loop structure or other iterative computation.")
(license license:bsd-3)))
+(define-public python-glymur
+ (package
+ (name "python-glymur")
+ (version "0.10.1")
+ (source
+ (origin
+ (method git-fetch) ; no tests data in PyPi package
+ (uri (git-reference
+ (url "https://github.com/quintusdias/glymur")
+ (commit (string-append "v" version))))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1cq9r8vzwvds1kasy5gc2rxw034jh9l43rraps1n739072pfz6qg"))))
+ (build-system python-build-system)
+ (arguments
+ (list
+ #:phases
+ #~(modify-phases %standard-phases
+ (add-after 'unpack 'patch-library-locations
+ (lambda _
+ ;; XXX: It's a workaround for Python inability to find the
+ ;; .so libraries with ctypes.util.find_library()
+ (substitute* '("glymur/config.py")
+ (("path = find_library\\(libname\\)")
+ (string-append
+ "if libname == \"openjp2\":\n"
+ " path = \""
+ #$(this-package-input "openjpeg") "/lib/libopenjp2.so\"\n"
+ " elif libname == \"tiff\":\n"
+ " path = \""
+ #$(this-package-input "libtiff") "/lib/libtiff.so\"\n"
+ " elif libname == \"c\":\n"
+ " path = \""
+ #$(this-package-input "glibc") "/lib/libc.so.6\"\n")))))
+ ;; TODO: implement as a feature of python-build-system (PEP-621,
+ ;; PEP-631, PEP-660)
+ (replace 'build
+ (lambda _
+ (setenv "SETUPTOOLS_SCM_PRETEND_VERSION" #$version)
+ ;; ZIP does not support timestamps before 1980.
+ (setenv "SOURCE_DATE_EPOCH" "315532800")
+ (invoke "python" "-m" "build" "--wheel" "--no-isolation" ".")))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((whl (car (find-files "dist" "\\.whl$"))))
+ (invoke "pip" "--no-cache-dir" "--no-input"
+ "install" "--no-deps" "--prefix" #$output whl))))
+ (replace 'check
+ (lambda* (#:key tests? #:allow-other-keys)
+ (when tests?
+ ;; Failing test due to inability of
+ ;; ctypes.util.find_library() to determine library path,
+ ;; which is patched above.
+ (delete-file "tests/test_config.py")
+ (invoke "python" "-m" "pytest" "-vv" "tests")))))))
+ (native-inputs
+ (list python-pypa-build python-pytest))
+ (inputs
+ (list openjpeg ; glymur/lib/openjp2.py
+ libtiff ; glymur/lib/tiff.py
+ glibc))
+ (propagated-inputs
+ (list python-lxml
+ python-numpy
+ python-packaging))
+ (home-page "https://github.com/quintusdias/glymur")
+ (synopsis "Python interface to OpenJPEG and LibTIFF")
+ (description
+ "This package provides Python interface to the OpenJPEG library which
+allows one to read and write JPEG 2000 files")
+ (license license:expat)))
+
(define-public python-gphoto2
(package
(name "python-gphoto2")
--
2.36.1
Ludovic Courtès wrote 3 years ago
(name . Sharlatan Hellseher)(address . sharlatanus@gmail.com)(address . 56364-done@debbugs.gnu.org)
874jzrs1xr.fsf@gnu.org
Hi,

Sharlatan Hellseher <sharlatanus@gmail.com> skribis:

Toggle quote (7 lines)
> From 776f0ce0a22c83809d9a3dc4752180580e3632df Mon Sep 17 00:00:00 2001
> From: Sharlatan Hellseher <sharlatanus@gmail.com>
> Date: Sat, 2 Jul 2022 21:28:39 +0100
> Subject: [PATCH] gnu: Add glymur
>
> * gnu/packages/python-xyz.scm (python-glymur): New variable.

Applied with the changes below: in this case ‘search-input-file’ is an
improvement IMO because it ensures that the file you’re looking for
(“libopenjp2.so”, etc.) actually exists. Also it allows us to refer to
the ‘glibc’ package that implicitly provided rather than add a
dependency on an extra ‘glibc’ variant.

Thanks!

Ludo’.
Toggle diff (40 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 76491631ae..3f4867ece0 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -931,7 +931,7 @@ (define-public python-glymur
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-library-locations
- (lambda _
+ (lambda* (#:key inputs #:allow-other-keys)
;; XXX: It's a workaround for Python inability to find the
;; .so libraries with ctypes.util.find_library()
(substitute* '("glymur/config.py")
@@ -939,13 +939,13 @@ (define-public python-glymur
(string-append
"if libname == \"openjp2\":\n"
" path = \""
- #$(this-package-input "openjpeg") "/lib/libopenjp2.so\"\n"
+ (search-input-file inputs "/lib/libopenjp2.so") "\"\n"
" elif libname == \"tiff\":\n"
" path = \""
- #$(this-package-input "libtiff") "/lib/libtiff.so\"\n"
+ (search-input-file inputs "/lib/libtiff.so") "\"\n"
" elif libname == \"c\":\n"
" path = \""
- #$(this-package-input "glibc") "/lib/libc.so.6\"\n")))))
+ (search-input-file inputs "/lib/libc.so.6") "\"\n")))))
;; TODO: implement as a feature of python-build-system (PEP-621,
;; PEP-631, PEP-660)
(replace 'build
@@ -971,8 +971,7 @@ (define-public python-glymur
(list python-pypa-build python-pytest))
(inputs
(list openjpeg ; glymur/lib/openjp2.py
- libtiff ; glymur/lib/tiff.py
- glibc))
+ libtiff)) ; glymur/lib/tiff.py
(propagated-inputs
(list python-lxml
python-numpy
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 56364@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 56364
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help