gnu: rapid-photo-downloader: Switch to pyproject, enable tests.

* gnu/packages/photo.scm (rapid-photo-downloader):
[source]: Switch to git-fetch.
[build-system]: Switch to pyproject-build-system.
[arguments]<#:test-flags>: Ignore failing tests.
<#:phases>: Refresh them. Add phase 'configure-check. Rename phase
'wrap.
[native-inputs]: Add python-pytest, python-setuptools.
[inputs]: Remove python-pyxdg, python-dateutil, python-rawkit,
python-requests, python-colorlog, python-pyprind.
[description]: Improve style.

Change-Id: I8828710bb42da5a8c064f6aa0184a854aab95f74
Modified-by: Sharlatan Hellseher <sharlatanus@gmail.com>
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Nicolas Graves 2025-10-03 23:26:07 +02:00 committed by Sharlatan Hellseher
parent 764e967f2d
commit 55b89f5e8c
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -88,6 +88,7 @@
#:use-module (gnu packages pkg-config)
#:use-module (gnu packages popt)
#:use-module (gnu packages python)
#:use-module (gnu packages python-build)
#:use-module (gnu packages python-xyz)
#:use-module (gnu packages python-web)
#:use-module (gnu packages qt)
@ -109,18 +110,71 @@
(package
(name "rapid-photo-downloader")
(version "0.9.36")
(source (origin
(method url-fetch)
(uri (string-append "https://launchpad.net/rapid/pyqt/"
version "/+download/" name "-"
version ".tar.gz"))
(sha256
(base32
"1r354y20rkjp034mjbmgk7zd39yxd89yqrbdlx5im4xvw8z3dp53"))))
(build-system python-build-system)
(native-inputs (list file gobject-introspection intltool))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/damonlynch/rapid-photo-downloader")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256
(base32 "1x4hgsxyn6nf12whwmmaxh447n88diix5wazcwv4hqm6mip8hnbw"))))
(build-system pyproject-build-system)
(arguments
(list
#:test-flags
#~(list
;; XXX: KeyError: Preference key 'Extension' is invalid.
"-k" (string-join (list "not testLargePrefList"
"testPrefImageList"
"testPrefVideoList"
"testSequencesList"
"testBadDTConversion")
" and not ")
;; XXX: Test data is corrupted, and substitute* doesn't work
;; for binary data: ModuleNotFoundError: No module named 'viewutils'
"--ignore=test_proximity.py"
;; XXX: No tests are collected here.
"--ignore=test_thumbnail.py")
#:phases
#~(modify-phases %standard-phases
(add-after 'unpack 'patch-libmediainfo
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "raphodo/metadata/metadatavideo.py"
(("libmediainfo.so.0" lib)
(search-input-file inputs (string-append "lib/" lib))))))
(add-before 'check 'configure-check
(lambda _
(setenv "XDG_DATA_HOME" (getcwd))
(chdir "raphodo/tests")
(substitute* "test_generatenameconfig.py"
(("generatename\\.convert")
"raphodo.generatename.convert")
(("([^.])(generatenameconfig\\.)" _ before module)
(string-append before "raphodo." module))
(("import (generatename|generatenameconfig)" _ module)
(string-append "import raphodo." module)))
(substitute* "test_thumbnail.py"
(("from (cache|interprocess|rpdfile|utilities)" _ module)
(string-append "from raphodo." module)))))
(add-after 'wrap 'wrap-more
(lambda* (#:key inputs #:allow-other-keys)
(wrap-program (string-append #$output
"/bin/rapid-photo-downloader")
`("PATH" ":" prefix
(,(dirname (search-input-file inputs "bin/exiftool"))))
`("GI_TYPELIB_PATH" ":" prefix
(,(getenv "GI_TYPELIB_PATH")))
`("GUIX_PYTHONPATH" ":" prefix
(,(getenv "GUIX_PYTHONPATH")))))))))
(native-inputs
(list file
intltool
gobject-introspection
python-pytest
python-setuptools))
(inputs
(list bash-minimal ;for wrap-program
(list bash-minimal ;for wrap-program
gdk-pixbuf
gexiv2
gst-libav
@ -128,58 +182,29 @@
gst-plugins-good
gstreamer
libgudev
libmediainfo
libnotify
perl-image-exiftool
python-arrow
libmediainfo
udisks
python-babel
python-colorlog
python-colour
python-dateutil
python-easygui
python-gphoto2
python-psutil
python-pygobject
python-pymediainfo
python-pymediainfo
python-pyprind
python-pyqt
python-pyxdg
python-pyzmq
python-rawkit
python-requests
python-show-in-file-manager
python-pyqt
python-pygobject
python-gphoto2
python-pyzmq
python-tornado
python-psutil
python-arrow
python-easygui
python-colour
python-pymediainfo
python-sortedcontainers
python-tenacity
python-tornado
udisks))
(arguments
(list
#:tests? #f ;no test suite
#:phases
#~(modify-phases %standard-phases
(add-after 'install 'wrap
(lambda* (#:key inputs #:allow-other-keys)
(let ((path (string-join
(list (string-append
(assoc-ref inputs "perl-image-exiftool")
"/bin"))
":"))
(gi-typelib-path (getenv "GI_TYPELIB_PATH"))
(python-path (getenv "GUIX_PYTHONPATH")))
(wrap-program (string-append #$output
"/bin/rapid-photo-downloader")
`("PATH" ":" prefix (,path))
`("GI_TYPELIB_PATH" ":" prefix (,gi-typelib-path))
`("GUIX_PYTHONPATH" ":" prefix (,python-path))))))
;; The program fails to load in the build environment, with an
;; assertion error on 'Path(data_home).is_dir()'.
(delete 'sanity-check))))
(home-page "https://www.damonlynch.net/rapid/")
perl-image-exiftool))
(home-page "https://github.com/damonlynch/rapid-photo-downloader")
(synopsis "Import photos and videos from cameras, phones and memory cards")
(description "Import photos and videos from cameras, phones and memory
cards and generate meaningful file and folder names.")
(description
"This package provides tools to import photos and videos from cameras,
phones and memory cards and generate meaningful file and folder names.")
(license license:gpl2+)))
(define-public libraw