Subject: [bug#37722] [PATCH] python-build-system: Fix build of packages without sbin directory.

From: Jonathan Frederickson <[email-masked]>
Date: Sat, 12 Oct 2019 18:54:04 -0400

Prior to this change, some packages (at least Ansible for example) would fail
to build with an error like:

starting phase `wrap'
find-files: /gnu/store/va1qkgv1qwv1hy6iynzjafqshakqkjs7-ansible-2.8.1/sbin: No
such file or directory

That directory in the store contained a 'bin' directory, but not an 'sbin
directory, and 'find-files' throws an error in that case.

* guix/build/python-build-system.scm (list-of-files): Handle case in which
  directory passed as argument does not exist.
---
 guix/build/python-build-system.scm | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 09bd8465c8..15c7d2e613 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -188,9 +188,11 @@ when running checks after installing the package."
 
 (define* (wrap #:key inputs outputs #:allow-other-keys)
   (define (list-of-files dir)
-    (find-files dir (lambda (file stat)
-                      (and (eq? 'regular (stat:type stat))
-                           (not (wrapper? file))))))
+    (if (not (directory-exists? dir))
+        '()
+        (find-files dir (lambda (file stat)
+                          (and (eq? 'regular (stat:type stat))
+                               (not (wrapper? file)))))))
 
   (define bindirs
     (append-map (match-lambda
-- 
2.23.0