Archived
1
0
Fork 0

gnu: python-evdev: Enable tests.

* gnu/packages/linux.scm (python-evdev): Enable tests and apply new
package style.
[source]: Use git checkout which provides tests.
[build-system]: Swap to pyproject-build-system.
[arguments]<#:test-flags>: Silent tests requiring access to /dev/uinput.
<#:phases>: Remove trailing #t from lambda.
[native-inputs]: Add python-pytest.

Change-Id: I9474459428d94eefa501458d62f24c6918958515
This commit is contained in:
Sharlatan Hellseher 2024-01-22 21:26:03 +00:00
parent 014d0541ae
commit ffc5fefce3
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5

View file

@ -79,6 +79,7 @@
;;; Copyright © 2023, 2024 Wilko Meyer <w@wmeyer.eu> ;;; Copyright © 2023, 2024 Wilko Meyer <w@wmeyer.eu>
;;; Copyright © 2023 Jaeme Sifat <jaeme@runbox.com> ;;; Copyright © 2023 Jaeme Sifat <jaeme@runbox.com>
;;; Copyright © 2024 Gabriel Wicki <gabriel@erlikon.ch> ;;; Copyright © 2024 Gabriel Wicki <gabriel@erlikon.ch>
;;; Copyright © 2024 Sharlatan Hellseher <sharlatanus@gmail.com>
;;; ;;;
;;; This file is part of GNU Guix. ;;; This file is part of GNU Guix.
;;; ;;;
@ -4399,22 +4400,33 @@ time.")
(version "1.5.0") (version "1.5.0")
(source (source
(origin (origin
(method url-fetch) (method git-fetch) ; no tests data in PyPi package
(uri (pypi-uri "evdev" version)) (uri (git-reference
(url "https://github.com/gvalkov/python-evdev")
(commit (string-append "v" version))))
(file-name (git-file-name name version))
(sha256 (sha256
(base32 "1rig85aq6k7y75m3bm7gjpd2gljspwwf8wb0vpkpcif8yxsb2csv")))) (base32 "1cbakix48zxivbznzb02w7sbxmqfaiaahhvjnjz4yif4vyrdyjli"))))
(build-system python-build-system) (build-system pyproject-build-system)
(arguments (arguments
`(#:tests? #f ;no rule for tests (list
#:phases #:test-flags
(modify-phases %standard-phases ;; Silent tests requiring access to /dev/uinput.
(add-before 'build 'fix-hard-coded-directory #~(list "-k" (string-append "not test_open"
(lambda* (#:key inputs #:allow-other-keys) " and not test_open_context"
(substitute* "setup.py" " and not test_enable_events"
(("/usr/include/linux") " and not test_abs_values"
(string-append " and not test_write"))
(assoc-ref inputs "kernel-headers") "/include/linux"))) #:phases
#t))))) #~(modify-phases %standard-phases
(add-before 'build 'fix-hard-coded-directory
(lambda* (#:key inputs #:allow-other-keys)
(substitute* "setup.py"
(("/usr/include/linux")
(string-append
(assoc-ref inputs "kernel-headers") "/include/linux"))))))))
(native-inputs
(list python-pytest))
(home-page "https://github.com/gvalkov/python-evdev") (home-page "https://github.com/gvalkov/python-evdev")
(synopsis "Bindings to the Linux input handling subsystem") (synopsis "Bindings to the Linux input handling subsystem")
(description (description