From patchwork Wed Mar 17 12:41:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Lepiller X-Patchwork-Id: 27896 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 5086327BC56; Wed, 17 Mar 2021 12:42:17 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id DCD5927BC55 for ; Wed, 17 Mar 2021 12:42:16 +0000 (GMT) Received: from localhost ([::1]:43352 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMVVA-0005Tz-5X for patchwork@mira.cbaines.net; Wed, 17 Mar 2021 08:42:16 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34310) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMVUx-0005Tf-A3 for guix-patches@gnu.org; Wed, 17 Mar 2021 08:42:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:58997) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lMVUw-0005M6-4e for guix-patches@gnu.org; Wed, 17 Mar 2021 08:42:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lMVUw-0003g3-0e for guix-patches@gnu.org; Wed, 17 Mar 2021 08:42:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47214] [core-updates] gnu: python: Remove unnecessary files Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 17 Mar 2021 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 47214 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 47214@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.161598488714091 (code B ref -1); Wed, 17 Mar 2021 12:42:01 +0000 Received: (at submit) by debbugs.gnu.org; 17 Mar 2021 12:41:27 +0000 Received: from localhost ([127.0.0.1]:42310 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lMVUN-0003fD-9I for submit@debbugs.gnu.org; Wed, 17 Mar 2021 08:41:27 -0400 Received: from lists.gnu.org ([209.51.188.17]:44948) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lMVUK-0003f4-Ib for submit@debbugs.gnu.org; Wed, 17 Mar 2021 08:41:26 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:34218) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMVUK-0005Pd-AK for guix-patches@gnu.org; Wed, 17 Mar 2021 08:41:24 -0400 Received: from lepiller.eu ([2a00:5884:8208::1]:34172) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMVUG-0004q9-Lw for guix-patches@gnu.org; Wed, 17 Mar 2021 08:41:24 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id a6799cc0 for ; Wed, 17 Mar 2021 12:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:mime-version:content-type; s=dkim; bh=byV qRiCk0ghfO9U6ADgatFuL9a/zn0DOEpOU7IYvB50=; b=lDYdY5MG3sE3HlHHpOR N/RhsbBfcUE9gWULubs9o1UMVnq480dh3arP+g9lBD3toqi6cmbT+tbEvFti0qnT ozlqSYHU0vqyR78YvLUQMRBNC/Vwy0WH+HcaYN93oeUDUUPhR56LqOQJHAopqdsG UTI0Qi/LWPyAmPpHYDWZGgccMo9NZfE34sBoahaiGrvRm8HkdsIaAESuNryocEla A0VTwEb4hD4EkctOBw9d/IFhHoin+NzmmxVnNH511GSFAve0k3x6Xtfw77Ap9KXL ef6fDNU6x2bWYuKfNrGJww8Tjq+iXAm57n5PHDchGav0XH2PAi49LqrpPx15enSz F+w== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id f1b7b027 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for ; Wed, 17 Mar 2021 12:41:12 +0000 (UTC) Date: Wed, 17 Mar 2021 13:41:02 +0100 From: Julien Lepiller Message-ID: <20210317133933.5eb6d325@tachikoma.lepiller.eu> X-Mailer: Claws Mail 3.17.8 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:5884:8208::1; envelope-from=julien@lepiller.eu; helo=lepiller.eu X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches 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! 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