From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id sMhRJpfdU2DPOgAA0tVLHw (envelope-from ) for ; Thu, 18 Mar 2021 23:09:11 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 4BYyIpfdU2DeHAAA1q6Kng (envelope-from ) for ; Thu, 18 Mar 2021 23:09:11 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id D75D2101E2 for ; Fri, 19 Mar 2021 00:09:09 +0100 (CET) Received: from localhost ([::1]:41952 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lN1lM-0001UM-VK for larch@yhetil.org; Thu, 18 Mar 2021 19:09:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51740) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lN1lG-0001U0-8g for guix-patches@gnu.org; Thu, 18 Mar 2021 19:09:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36754) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lN1lG-00008C-0k for guix-patches@gnu.org; Thu, 18 Mar 2021 19:09:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lN1lF-00007b-Se for guix-patches@gnu.org; Thu, 18 Mar 2021 19:09:01 -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: Thu, 18 Mar 2021 23:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47214 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 47214@debbugs.gnu.org Received: via spool by 47214-submit@debbugs.gnu.org id=B47214.1616108932444 (code B ref 47214); Thu, 18 Mar 2021 23:09:01 +0000 Received: (at 47214) by debbugs.gnu.org; 18 Mar 2021 23:08:52 +0000 Received: from localhost ([127.0.0.1]:48298 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lN1ky-00006w-VL for submit@debbugs.gnu.org; Thu, 18 Mar 2021 19:08:52 -0400 Received: from lepiller.eu ([89.234.186.109]:41416) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lN1kv-00006h-N7 for 47214@debbugs.gnu.org; Thu, 18 Mar 2021 19:08:43 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id f9dcac84 for <47214@debbugs.gnu.org>; Thu, 18 Mar 2021 23:08:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:subject:message-id:in-reply-to:references:mime-version :content-type; s=dkim; bh=VN1MbdFM4NAFW3DsAvhQt5z3JKybz2eNMp5ovB UgJdY=; b=emEqftl5qTLeWiV1MZHbonEvp+d578bJ+T7dwBIKtbcgeVwhbdY+l/ z8xBfcQTwNI2aR9Fwm+2Y+uT4SJcQjGYlavHfX8IbBZ+7Pq8c8C5zqyvmL21IcJd MpmmNAl/c3lgcvLxjYfS/DkdpxDj/b9WIXx0yNA7T4JBI+e10y0u+JIL62YJicnz Y+P8Hi6vu92BO0AQW1j2mrVOeN19OLdwrFliJlFFTM2NPIwFFuQOiSBMO7hw7CVZ gi0Zfp5IUXcPQNNWa/nuw3z4yz4xHO2yNDzdUEBCSfepIQ0hz+9/PauFj1b+UdI9 VAURRh2crZbPGn2Plbn0p/lyp7cqz4Vw== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 14d17a30 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO) for <47214@debbugs.gnu.org>; Thu, 18 Mar 2021 23:08:39 +0000 (UTC) Date: Fri, 19 Mar 2021 00:08:30 +0100 From: Julien Lepiller Message-ID: <20210319000830.23926447@tachikoma.lepiller.eu> In-Reply-To: <20210317133933.5eb6d325@tachikoma.lepiller.eu> References: <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 Content-Type: multipart/mixed; boundary="MP_/BvVfmi5qYD=sir.c_HBijZC" 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616108951; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=otyqQsQ8LveNFLA/yRjFwNmUGCVe3kHtrwTpNJewRME=; b=SXTsg3v4xhM91+RER/zPl3Xe0PAsPLOEZLBrtDC4VOIJQZvF2sH5eURvZzLSzon1naBgCg 0Bqgb3XfONImFRniDvHLorANHifphUdsZ8MJGnLJbbutJEMoaRPjFBoYmouCAAvKPDruzv zhyAXpRErMr2RKxOldKJGBQWN/FVVb7yZfNuymWZnJjsE9qepeZMONnuMezUwTzGkeUuoI ijhnGXepfwb4ys4IRB0FE9ko8Wejf1HVebVXk8JhG+pWg0u/o9gKnHLWHpq8hq1hbD73yY xEVV+XwiAWLslW8aDJs5UGhYZu/2GK+Fx2R/jsY1zN2Exz0xzLof08mJS9d8Zw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616108951; a=rsa-sha256; cv=none; b=M8dTeKk9WSjdFboulgJsInSoebahfUwu1WnIe2R9K0ZBTl5OPmVpF3btsKr7euxhUhdKj+ lNYEshjxXAawLqW9NWGz6lzStHFxP7fVqM1xePjnj+X1LME7FBILZwh2e3lHvdiH4SCba0 gIX5PE6MsKkazGgkxLHPlo+SXDh1CEpuFqG71GvoNO/5K8BWm+UqY3CJ+9DXNaM5O+0OW/ o4CLvwYiO4mIKqCe2WDLtR7Kgz9+JpKdoDwQPcPu4Vyv+Js5CCj7pSlCvgV2/9g3ArhEQG lyvMoCkq47tykXi6LzXEMwoUY4NvEiax3XBpHqDYT2MqbU8Ck+L2VOVc1xUEIw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=emEqftl5; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=emEqftl5; dmarc=fail reason="SPF not aligned (relaxed)" header.from=lepiller.eu (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: D75D2101E2 X-Spam-Score: -1.31 X-Migadu-Scanner: scn0.migadu.com X-TUID: 0wdgwdJfKcnb --MP_/BvVfmi5qYD=sir.c_HBijZC Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Wed, 17 Mar 2021 13:41:02 +0100, Julien Lepiller a =C3=A9crit : > Hi Guix! >=20 > 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. >=20 > 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? >=20 > 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! I discovered other .exe in python3, so this updated patch deletes them. Since I modify the python from commencement.scm by changing a phase in python-2.7, I decided to also change the definition there to remove the offending files. I managed to build up to python-3.9 without any issue, but haven't tested building more than a handful of python packages. --MP_/BvVfmi5qYD=sir.c_HBijZC Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0001-gnu-python-Remove-unnecessary-files.patch =46rom 0d2d9a32cbbf24eadf74271b2fb1304b7a72d281 Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Wed, 17 Mar 2021 13:33:22 +0100 Subject: [PATCH 1/2] 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/commencement.scm | 9 ++++++++- gnu/packages/python.scm | 35 +++++++++++++++++++++++++++++++++-- 2 files changed, 41 insertions(+), 3 deletions(-) diff --git a/gnu/packages/commencement.scm b/gnu/packages/commencement.scm index b2921a4a48..b2b9651444 100644 --- a/gnu/packages/commencement.scm +++ b/gnu/packages/commencement.scm @@ -10,6 +10,7 @@ ;;; Copyright =C2=A9 2020 Timothy Sample ;;; Copyright =C2=A9 2020 Guy Fleury Iteriteka ;;; Copyright =C2=A9 2021 Maxim Cournoyer +;;; Copyright =C2=A9 2021 Julien Lepiller ;;; ;;; This file is part of GNU Guix. ;;; @@ -3098,7 +3099,12 @@ memoized as a function of '%current-system'." (delete-file-recursively "Modules/expat") (substitute* "Modules/Setup.dist" ;; Link Expat instead of embedding the bundled one. - (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n"))))))) + (("^#pyexpat.*") "pyexpat pyexpat.c -lexpat\n")) + ;; Delete windows binaries + (for-each delete-file + (find-files "Lib/distutils/command" ".*.exe$"= )) + (for-each delete-file + (find-files "Lib/ensurepip" ".*.whl$"))))))) (inputs `(,@(%boot0-inputs) ("expat" ,expat-sans-tests))) ;remove OpenSSL, zlib, e= tc. @@ -3129,6 +3135,7 @@ memoized as a function of '%current-system'." ('add-after unpack apply-alignmen= t-patch _)) `(modify-phases ,original-phases ,@= changes)) (_ phases))) + (delete 'remove-windows-binaries) (add-before 'configure 'disable-modules (lambda _ (substitute* "setup.py" diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 49d43ab008..da9859b11a 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -31,7 +31,7 @@ ;;; Copyright =C2=A9 2016 Dylan Jeffers ;;; Copyright =C2=A9 2016, 2017 Alex Vong ;;; Copyright =C2=A9 2016, 2017, 2018 Arun Isaac -;;; Copyright =C2=A9 2016, 2017, 2018 Julien Lepiller +;;; Copyright =C2=A9 2016, 2017, 2018, 2021 Julien Lepiller ;;; Copyright =C2=A9 2016, 2017, 2018 Tobias Geerinckx-Rice ;;; Copyright =C2=A9 2016, 2017 Thomas Danckaert ;;; Copyright =C2=A9 2017 Carlo Zancanaro @@ -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) @@ -469,6 +481,23 @@ data types.") ,@(if (hurd-system?) `((delete 'patch-regen-for-hurd)) ;regen was removed afte= r 3.5.9 '()) + (add-after 'unpack 'remove-windows-binaries + (lambda _ + ;; Delete .exe from embedded .whl (zip) files + (for-each + (lambda (whl) + (let ((dir "whl-content")) + (mkdir-p dir) + (with-directory-excursion dir + (let ((whl (string-append "../" whl))) + (invoke "unzip" whl) + (for-each delete-file + (find-files "." ".*.exe$")) + (delete-file whl) + (apply invoke "zip" "-X" whl + (find-files "." ".*" #:directories? #t)))) + (delete-file-recursively dir))) + (find-files "Lib/ensurepip" ".*.whl$")))) (add-before 'check 'set-TZDIR (lambda* (#:key inputs native-inputs #:allow-other-keys) ;; test_email requires the Olson time zone database. @@ -503,6 +532,8 @@ data types.") ,(customize-site version)))))) (native-inputs `(("tzdata" ,tzdata-for-tests) + ("unzip" ,unzip) + ("zip" ,(@ (gnu packages compression) zip)) ,@(if (%current-target-system) `(("python3" ,this-package)) '()) --=20 2.30.0 --MP_/BvVfmi5qYD=sir.c_HBijZC--