summary refs log tree commit diff
path: root/gnu/packages
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2016-05-10 09:03:55 +0200
committerLudovic Courtès <ludo@gnu.org>2016-05-10 16:50:46 +0200
commit9ffe61b0ee38b0df88868706d5918e944a626cd9 (patch)
tree9a365dcaaed20f59616e393d58573926f40e52e0 /gnu/packages
parenta8938c88580f071ce74146eef9258e3b1afe48a8 (diff)
downloadguix-9ffe61b0ee38b0df88868706d5918e944a626cd9.tar.gz
gnu: python: Remove unnecessary installed tests.
* gnu/packages/python.scm (python-2)[arguments]: Add 'remove-tests'
phase.
Diffstat (limited to 'gnu/packages')
-rw-r--r--gnu/packages/python.scm22
1 files changed, 22 insertions, 0 deletions
diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 4824ff3eaa..f09ff9694f 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -201,6 +201,28 @@
                           (utime file circa-1980 circa-1980)
                           #t))
                #t)))
+          (add-after 'install 'remove-tests
+            ;; Remove 25 MiB of unneeded unit tests.  Keep test_support.*
+            ;; because these files are used by some libraries out there.
+            (lambda* (#:key outputs #:allow-other-keys)
+              (let ((out (assoc-ref outputs "out")))
+                (match (scandir (string-append out "/lib")
+                                (lambda (name)
+                                  (string-prefix? "python" name)))
+                  ((pythonX.Y)
+                   (let ((testdir (string-append out "/lib/" pythonX.Y
+                                                 "/test")))
+                     (with-directory-excursion testdir
+                       (for-each delete-file-recursively
+                                 (scandir testdir
+                                          (match-lambda
+                                            ((or "." "..") #f)
+                                            (file
+                                             (not
+                                              (string-prefix? "test_support."
+                                                              file))))))
+                       (call-with-output-file "__init__.py" (const #t))
+                       #t)))))))
           (add-after 'install 'move-tk-inter
             (lambda* (#:key outputs #:allow-other-keys)
               ;; When Tkinter support is built move it to a separate output so