From 56dfaa6f918e47366108956cff2af253bdf0f62b Mon Sep 17 00:00:00 2001 From: John Kehayias Date: Sat, 16 Aug 2025 16:05:11 -0400 Subject: [PATCH] gnu: lensfun: Fix tools. The included tools to, e.g., update the local lens database, wouldn't work due to incorrect handling of the Python package and missing wrapping. Now, for instance, "guix shell lensfun -- lensfun-update-data" works. * gnu/packages/photo.scm (lensfun)[arguments]: Add imported-modules and modules; add the fix-egg and python-wrap phases. Use g-exps for configure-flags. Change-Id: If462dcddf91e13508253e43c015d1eb1b5fb428a --- gnu/packages/photo.scm | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/gnu/packages/photo.scm b/gnu/packages/photo.scm index 33990bc2eb559240cfcb6f62721b713dd49b8eac..d0638d5b302a4385b5395ea28a6b2a3633d76530 100644 --- a/gnu/packages/photo.scm +++ b/gnu/packages/photo.scm @@ -36,6 +36,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system meson) #:use-module (guix build-system perl) + #:use-module (guix build-system pyproject) #:use-module (guix build-system python) #:use-module (guix gexp) #:use-module (guix download) @@ -514,17 +515,41 @@ scene to produce an image that looks much like a tone-mapped image.") (base32 "1lwf3cwldvh9qfmh3w7nqqildfmxx2i5f5bn0vr8y6qc5kh7a1s9")))) (build-system cmake-build-system) (arguments - `(,@(if (any (cute string-prefix? <> (or (%current-system) - (%current-target-system))) - '("x86_64" "i686")) - ;; SSE and SSE2 are supported only on Intel processors. - '() - '(#:configure-flags '("-DBUILD_FOR_SSE=OFF" "-DBUILD_FOR_SSE2=OFF"))) - #:tests? #f)) ; There are no tests to run. + (list + #:imported-modules `(,@%cmake-build-system-modules + ,@%pyproject-build-system-modules) + #:modules '((guix build cmake-build-system) + ((guix build pyproject-build-system) #:prefix py:) + (guix build utils)) + #:configure-flags + (if (any (cute string-prefix? <> (or (%current-system) + (%current-target-system))) + '("x86_64" "i686")) + ;; SSE and SSE2 are supported only on Intel processors. + #~'() + #~'("-DBUILD_FOR_SSE=OFF" "-DBUILD_FOR_SSE2=OFF")) + #:tests? #f ; There are no tests to run. + #:phases + #~(modify-phases %standard-phases + (add-after 'unpack 'fix-egg + (lambda _ + (substitute* "apps/CMakeLists.txt" + ;; Prevent creation of Python egg. + (("\\$\\{SETUP_PY\\} install") + "${SETUP_PY} install --single-version-externally-managed --root=/")))) + (add-after 'install 'python-wrap + (lambda* (#:key inputs outputs #:allow-other-keys) + (for-each (lambda (program) + (wrap-program (search-input-file outputs program) + `("GUIX_PYTHONPATH" ":" prefix + (,(getenv "GUIX_PYTHONPATH") + ,(py:site-packages inputs outputs))))) + (list "bin/lensfun-update-data" + "bin/lensfun-add-adapter"))))))) (native-inputs (list pkg-config)) (inputs - (list glib)) + (list bash-minimal glib python)) (home-page "https://lensfun.github.io/") (synopsis "Library to correct optical lens defects with a lens database") (description "Digital photographs are not ideal. Of course, the better is