From ffc5fefce370f5fc01091869e13fdf525be1e0c0 Mon Sep 17 00:00:00 2001 From: Sharlatan Hellseher Date: Mon, 22 Jan 2024 21:26:03 +0000 Subject: [PATCH] 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 --- gnu/packages/linux.scm | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 78d317e369..271c5c0162 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -79,6 +79,7 @@ ;;; Copyright © 2023, 2024 Wilko Meyer ;;; Copyright © 2023 Jaeme Sifat ;;; Copyright © 2024 Gabriel Wicki +;;; Copyright © 2024 Sharlatan Hellseher ;;; ;;; This file is part of GNU Guix. ;;; @@ -4399,22 +4400,33 @@ time.") (version "1.5.0") (source (origin - (method url-fetch) - (uri (pypi-uri "evdev" version)) + (method git-fetch) ; no tests data in PyPi package + (uri (git-reference + (url "https://github.com/gvalkov/python-evdev") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) (sha256 - (base32 "1rig85aq6k7y75m3bm7gjpd2gljspwwf8wb0vpkpcif8yxsb2csv")))) - (build-system python-build-system) + (base32 "1cbakix48zxivbznzb02w7sbxmqfaiaahhvjnjz4yif4vyrdyjli")))) + (build-system pyproject-build-system) (arguments - `(#:tests? #f ;no rule for tests - #:phases - (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"))) - #t))))) + (list + #:test-flags + ;; Silent tests requiring access to /dev/uinput. + #~(list "-k" (string-append "not test_open" + " and not test_open_context" + " and not test_enable_events" + " and not test_abs_values" + " and not test_write")) + #:phases + #~(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") (synopsis "Bindings to the Linux input handling subsystem") (description