gnu: python-dbusmock: Update to 0.25.0 and reap terminated processes.

It was reported by abrenon and zimoun in #guix that python-dbusmock would fail
to build on their systems.

* gnu/packages/python-xyz.scm (python-dbusmock)
[imported-modules, modules]: New arguments.
[native-inputs]: Use new style.
[phases]{check}: Override phase to run it via a dumb init that can handle
signals and reap dead processes correctly.  This prevents test suite failures
in some cases (though it is still unknown why it was working on some systems
and not on others before the change).
This commit is contained in:
Maxim Cournoyer 2022-01-18 10:02:11 -05:00
parent 5ed33b0d05
commit 719deaa881
No known key found for this signature in database
GPG key ID: 1260E46482E63562

View file

@ -52,7 +52,7 @@
;;; Copyright © 2018, 2019, 2020, 2021 Nicolas Goaziou <mail@nicolasgoaziou.fr>
;;; Copyright © 2018 Oleg Pykhalov <go.wigust@gmail.com>
;;; Copyright © 2018, 2019, 2021 Clément Lassieur <clement@lassieur.org>
;;; Copyright © 2018, 2019, 2020, 2021 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2018, 2019, 2020, 2021, 2022 Maxim Cournoyer <maxim.cournoyer@gmail.com>
;;; Copyright © 2018 Luther Thompson <lutheroto@gmail.com>
;;; Copyright © 2018 Vagrant Cascadian <vagrant@debian.org>
;;; Copyright © 2015, 2018 Pjotr Prins <pjotr.guix@thebird.nl>
@ -24101,17 +24101,23 @@ (define-public python-pykwalify
(define-public python-dbusmock
(package
(name "python-dbusmock")
(version "0.24.1")
(version "0.25.0")
(source
(origin
(method url-fetch)
(uri (pypi-uri "python-dbusmock" version))
(sha256
(base32
"0kvjwn5sdp3rqcbclvxljkmk988l12dvppzfn3ldy3jxbyyn1mjn"))))
"1nwl0gzzds2g1w1gfxfzlgrkb5hr1rrdyn619ml25c6b1rjyfk3g"))))
(build-system python-build-system)
(arguments
'(#:phases
`(#:imported-modules (,@%python-build-system-modules
(guix build syscalls))
#:modules ((guix build python-build-system)
(guix build syscalls)
(guix build utils)
(ice-9 match))
#:phases
(modify-phases %standard-phases
(add-after 'unpack 'patch-paths
(lambda* (#:key inputs #:allow-other-keys)
@ -24120,11 +24126,26 @@ (define-public python-dbusmock
(substitute* "dbusmock/testcase.py"
(("'dbus-daemon'")
(string-append "'" (assoc-ref inputs "dbus")
"/bin/dbus-daemon'"))))))))
"/bin/dbus-daemon'")))))
(replace 'check
(lambda* (#:key tests? #:allow-other-keys)
(when tests?
(match (primitive-fork)
(0 ;child process
(set-child-subreaper!)
;; Use tini so that signals are properly handled and
;; doubly-forked processes get reaped; otherwise,
;; python-dbusmock would waste time polling for the dbus
;; processes it spawns to be reaped, in vain.
(execlp "tini" "--" "pytest" "-vv"))
(pid
(match (waitpid pid)
((_ . status)
(unless (zero? status)
(error "`pytest' exited with status"
status))))))))))))
(native-inputs
(list ;; For tests.
dbus ; for dbus-daemon
python-nose which))
(list dbus python-pytest tini which))
(inputs
(list dbus))
(propagated-inputs