summary refs log tree commit diff
diff options
context:
space:
mode:
authorHartmut Goebel <h.goebel@crazy-compilers.com>2016-10-07 17:17:00 +0200
committerHartmut Goebel <h.goebel@crazy-compilers.com>2016-11-15 17:37:46 +0100
commitb002f964bb3d69c77856ea7dcadfe82383050512 (patch)
tree9cde4d9dfad71aa7982ff72d8deef091ffad6963
parenta2ff4f0240f0fac484836bb8ffb2f86917369666 (diff)
downloadguix-b002f964bb3d69c77856ea7dcadfe82383050512.tar.gz
guix: python-build-system: Delete .egg-info file created in phase check.
* guix/build/python-build-system.scm (check): Delete .egg-info dirs
  which did not exist prior to calling setup.py but afterwards.
-rw-r--r--guix/build/python-build-system.scm10
1 files changed, 9 insertions, 1 deletions
diff --git a/guix/build/python-build-system.scm b/guix/build/python-build-system.scm
index 22c4f7d38a..310ba8aa2e 100644
--- a/guix/build/python-build-system.scm
+++ b/guix/build/python-build-system.scm
@@ -69,7 +69,15 @@
 (define* (check #:key tests? test-target use-setuptools? #:allow-other-keys)
   "Run the test suite of a given Python package."
   (if tests?
-    (call-setuppy test-target '() use-setuptools?)
+      ;; Running `setup.py test` creates an additional .egg-info directory in
+      ;; build/lib in some cases, e.g. if the source is in a sub-directory
+      ;; (given with `package_dir`). This will by copied to the output, too,
+      ;; so we need to remove.
+      (let ((before (find-files "build" "\\.egg-info$" #:directories? #t)))
+        (call-setuppy test-target '() use-setuptools?)
+        (let* ((after (find-files "build" "\\.egg-info$" #:directories? #t))
+               (inter (lset-difference eqv? after before)))
+          (for-each delete-file-recursively inter)))
     #t))
 
 (define (get-python-version python)