gnu: python-dbusmock: Rewrite phases as a gexp.

* gnu/packages/python-xyz.scm (python-dbusmock)[arguments]: Use gexps.
This commit is contained in:
Ludovic Courtès 2023-10-13 16:31:49 +02:00
parent 9a23dd54ee
commit 4ac6999be7
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -27165,37 +27165,39 @@ for YAML and JSON.")
"1nwl0gzzds2g1w1gfxfzlgrkb5hr1rrdyn619ml25c6b1rjyfk3g")))) "1nwl0gzzds2g1w1gfxfzlgrkb5hr1rrdyn619ml25c6b1rjyfk3g"))))
(build-system python-build-system) (build-system python-build-system)
(arguments (arguments
`(#:modules ((guix build python-build-system) (list #:modules `((guix build python-build-system)
(guix build utils) (guix build utils)
(ice-9 match)) (ice-9 match))
#:phases #:phases
(modify-phases %standard-phases #~(modify-phases %standard-phases
(add-after 'unpack 'patch-paths (add-after 'unpack 'patch-paths
(lambda* (#:key inputs #:allow-other-keys) (lambda* (#:key inputs #:allow-other-keys)
(substitute* "tests/test_code.py" (substitute* "tests/test_code.py"
(("/bin/bash") (which "bash"))) (("/bin/bash")
(substitute* "dbusmock/testcase.py" (which "bash")))
(("'dbus-daemon'") (substitute* "dbusmock/testcase.py"
(string-append "'" (assoc-ref inputs "dbus") (("'dbus-daemon'")
"/bin/dbus-daemon'"))))) (string-append "'" (assoc-ref inputs "dbus")
(replace 'check "/bin/dbus-daemon'")))))
(lambda* (#:key tests? #:allow-other-keys) (replace 'check
(when tests? (lambda* (#:key tests? #:allow-other-keys)
(match (primitive-fork) (when tests?
(0 ;child process (match (primitive-fork)
(execlp "pytest" "pytest" "-vv")) (0 ;child process
(pytest-pid (execlp "pytest" "pytest" "-vv"))
(let loop () (pytest-pid
;; Reap child processes; otherwise, python-dbusmock would (let loop ()
;; waste time polling for the dbus processes it spawns to ;; Reap child processes; otherwise, python-dbusmock
;; be reaped, in vain. ;; would waste time polling for the dbus processes
(match (waitpid WAIT_ANY) ;; it spawns to be reaped, in vain.
((pid . status) (match (waitpid WAIT_ANY)
(if (= pid pytest-pid) ((pid . status)
(unless (zero? status) (if (= pid pytest-pid)
(error "`pytest' exited with status" status)) (unless (zero? status)
(loop))))))))))))) (error "`pytest' exited with status"
status))
(loop)))))))))))))
(native-inputs (native-inputs
(list dbus python-pytest which)) (list dbus python-pytest which))
(inputs (inputs