From 63ebe5c610ff8587a73641e4139dc14a4d3e379e Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 17 Mar 2021 13:33:22 +0100 Subject: [PATCH] gnu: python: Remove unnecessary files. * gnu/packages/python.scm (python2)[arguments]: Remove files built during the test phase. (python3)[arguments]: Also remove windows binaries shipped with the sources. --- gnu/packages/python.scm | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 49d43ab008..3bb30ca011 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -294,7 +294,16 @@ (not (string-prefix? "test_support." file)))))) - (call-with-output-file "__init__.py" (const #t))))))))) + (call-with-output-file "__init__.py" (const #t)))) + (let ((libdir (string-append out "/lib/" pythonX.Y))) + (for-each + (lambda (directory) + (let ((dir (string-append libdir "/" directory))) + (when (file-exists? dir) + (delete-file-recursively dir)))) + '("email/test" "ctypes/test" "unittest/test" "tkinter/test" + "sqlite3/test" "bsddb/test" "lib-tk/test" "lib2to3/tests" + "json/tests" "distutils/tests")))))))) (add-after 'remove-tests 'rebuild-bytecode (lambda* (#:key outputs #:allow-other-keys) (let ((out (assoc-ref outputs "out"))) @@ -424,6 +433,9 @@ data types.") (substitute* "Modules/Setup" ;; Link Expat instead of embedding the bundled one. (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n")) + ;; Delete windows binaries + (for-each delete-file + (find-files "Lib/distutils/command" ".*.exe$")) #t)))) (arguments (substitute-keyword-arguments (package-arguments python-2) -- 2.30.0