all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [bug#47214] [core-updates] gnu: python: Remove unnecessary files
@ 2021-03-17 12:41 Julien Lepiller
  2021-03-17 19:22 ` Efraim Flashner
  2021-03-18 23:08 ` Julien Lepiller
  0 siblings, 2 replies; 7+ messages in thread
From: Julien Lepiller @ 2021-03-17 12:41 UTC (permalink / raw)
  To: 47214

[-- Attachment #1: Type: text/plain, Size: 884 bytes --]

Hi Guix!

this patch (going to core-updates) removes files from the output of
python2 and python3, in an attempt to save some space. First, I noticed
that python3 shipped windows binaries in its source distribution and
installs them to the output, in lib/python3.8/distutils/command/*.exe,
lib/python3.8/site-packages/*.exe and
lib/python3.8/site-packages/pip/_vendor/distlib/*.exe. I remove them
from the snippet, so they should not be installed anymore.

I also noticed that python installs files that were built during the
test phase, so I remove them, but we need to check they are not
actually needed. Other distros ship them in a separate package, so
maybe we could have a separate test output if this is causing issues?

I haven't yet tested the patch, because it needs to rebuild part of the
bootstrap chain. I'll report progress and update my patch depending
on the results!

[-- Attachment #2: 0001-gnu-python-Remove-unnecessary-files.patch --]
[-- Type: text/x-patch, Size: 2238 bytes --]

From 63ebe5c610ff8587a73641e4139dc14a4d3e379e Mon Sep 17 00:00:00 2001
From: Julien Lepiller <julien@lepiller.eu>
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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-06-11  1:02 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-17 12:41 [bug#47214] [core-updates] gnu: python: Remove unnecessary files Julien Lepiller
2021-03-17 19:22 ` Efraim Flashner
2021-03-18 23:08 ` Julien Lepiller
2021-03-19 12:27   ` Ludovic Courtès
2021-06-03  1:56     ` Julien Lepiller
2021-06-03  9:46       ` Ludovic Courtès
2021-06-11  1:01         ` bug#47214: " Julien Lepiller

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.