gnu: python: Remove unnecessary installed tests.

* gnu/packages/python.scm (python-2)[arguments]: Add 'remove-tests'
phase.
This commit is contained in:
Ludovic Courtès 2016-05-10 09:03:55 +02:00
parent a8938c8858
commit 9ffe61b0ee
No known key found for this signature in database
GPG key ID: 090B11993D9AEBB5

View file

@ -201,6 +201,28 @@ (define-public python-2
(utime file circa-1980 circa-1980) (utime file circa-1980 circa-1980)
#t)) #t))
#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 (add-after 'install 'move-tk-inter
(lambda* (#:key outputs #:allow-other-keys) (lambda* (#:key outputs #:allow-other-keys)
;; When Tkinter support is built move it to a separate output so ;; When Tkinter support is built move it to a separate output so