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 ms0.migadu.com with LMTPS id aNlCF8mbu2COaAEAgWs5BA (envelope-from ) for ; Sat, 05 Jun 2021 17:44:09 +0200 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 iO+TEsmbu2DlOAAA1q6Kng (envelope-from ) for ; Sat, 05 Jun 2021 15:44:09 +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 137E427D56 for ; Sat, 5 Jun 2021 17:44:07 +0200 (CEST) Received: from localhost ([::1]:53676 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpYT0-0006gf-8T for larch@yhetil.org; Sat, 05 Jun 2021 11:44:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41224) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpYSw-0006gW-VX for guix-patches@gnu.org; Sat, 05 Jun 2021 11:44:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:38375) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lpYSw-0001cB-P0 for guix-patches@gnu.org; Sat, 05 Jun 2021 11:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lpYSw-0007T4-HF for guix-patches@gnu.org; Sat, 05 Jun 2021 11:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47251] [core-updates] [patch] gnu: python: Enable optimizations. Resent-From: Julien Lepiller Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 05 Jun 2021 15:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47251 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 47251@debbugs.gnu.org Received: via spool by 47251-submit@debbugs.gnu.org id=B47251.162290781628664 (code B ref 47251); Sat, 05 Jun 2021 15:44:02 +0000 Received: (at 47251) by debbugs.gnu.org; 5 Jun 2021 15:43:36 +0000 Received: from localhost ([127.0.0.1]:49921 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpYSM-0007S4-Ie for submit@debbugs.gnu.org; Sat, 05 Jun 2021 11:43:36 -0400 Received: from lepiller.eu ([89.234.186.109]:43714) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lpYSI-0007Rt-OT for 47251@debbugs.gnu.org; Sat, 05 Jun 2021 11:43:25 -0400 Received: from lepiller.eu (localhost [127.0.0.1]) by lepiller.eu (OpenSMTPD) with ESMTP id 100955a8; Sat, 5 Jun 2021 15:43:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=lepiller.eu; h=date:from :to:cc:subject:message-id:in-reply-to:references:mime-version :content-type; s=dkim; bh=6L8Ipg9t7Z0mIWWjTRGF9cXm5R3wOf/Ci5GiUT fDnKY=; b=gB1ch4tQfITa2yeR5zeIIArHTH/eWxoCXzPFSyTKauTf1nutkdYTrP AL6qnJLM05RJT71vmW7JYNErIkRBqhS35Wbk2XoF54DTu8O8YwYmtuoUFucwRAzr tUSENCZRnebmaG5NubW5zG43IHxnN8JEZKnlVsq+xGG0xA4gJTtzO2au48432Qla lsgreGcm7JzBZGDAQIMqJMdhnuPl3M6o34c4u5wj3tnOAqNnlWLaeiLK8YUIPzjb tmTUeT8prtotIG5+wM35plXbXm13eJCV0Y8eNOf2sL/92IgDbm7wae2E7J4HM7vR phfGewSwKoUdk3zUxjoHWKFg/E+PVDJg== Received: by lepiller.eu (OpenSMTPD) with ESMTPSA id 50600f67 (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256:NO); Sat, 5 Jun 2021 15:43:18 +0000 (UTC) Date: Sat, 5 Jun 2021 17:43:08 +0200 From: Julien Lepiller Message-ID: <20210605174308.57c4a324@tachikoma.lepiller.eu> In-Reply-To: <875yyvwa6f.fsf@gnu.org> References: <20210319001622.1c19ad41@tachikoma.lepiller.eu> <87r1jva3rj.fsf@gnu.org> <20210603040635.3b6c7d12@tachikoma.lepiller.eu> <875yyvwa6f.fsf@gnu.org> 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_/U.7iQ6r20E2CVBYnfV6TrmN" 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=1622907848; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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=Dn84OByZBgDpX1tuIDI0sIq2W6AisArP/Odbg1Tb0mc=; b=axsz8BqnSvk3ilp7LaWoYU1Qao5iGwEEADjrylGP8KVB0pJS9t6zgQaA6uLRoHZhYGmuFo Twa+jxy2XOWH8gthN3k6JJRdWnSx+KS9UA0X6Wq8afPPvEQCjv31f8kF/OtLlkQ4CDksek 2dOLMBql1T7zDWd7/oQ8tYu2q4WBsADu8bidUOKutJqESxQQAq6xSgVCT9EnEX8SpByBVq hJVESuLWlmcNHQOVri0grAuncUc6Zp8Tt94MdiGbk2ZDagKege3ZIJaGHWWZ+m46BaUfQ+ lEmOX+5WJ6+NIC0EGlrtyLuXZjLfGjTT3QrZ7oJEItxDPzAePTzPQmTh5j9cxQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1622907848; a=rsa-sha256; cv=none; b=LgcgVxOOHDPCOZif63ngru4HmCJjVydJWdt63Dl++D8lIVnhWcsHlpB6DVXprxW0sWAcVB gbwg7wkaRbzvjEQTvSOtAZnNqJyGUf0jpsnC+aqczdYoIM6xvpYwPyOT1xj/VgmjRMa3ti Yh+FTwaEIoxBznLccrP1B9lYsDD3P2DSz8q3o9LFgBnaSxNvd2syxc89mJIDGecmDJAn5X swyS+1XTzogj58k5CzvCDZLAS2OneLUVc55GHqFSvIzY+xdW/duKlPyg1PrzPNDSK+jfK3 4yYpT9BH3jAniw8moieNrrRMGwEOzGZG+GIOm7YWRF2k/qt8BwQ+j0psh4LDcA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=gB1ch4tQ; 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.33 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=lepiller.eu header.s=dkim header.b=gB1ch4tQ; 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: 137E427D56 X-Spam-Score: -1.33 X-Migadu-Scanner: scn0.migadu.com X-TUID: vNPQuHg3tumb --MP_/U.7iQ6r20E2CVBYnfV6TrmN Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Le Thu, 03 Jun 2021 11:48:40 +0200, Ludovic Court=C3=A8s a =C3=A9crit : > Hi, >=20 > Julien Lepiller skribis: >=20 > > But I noticed another file gained a lot of weight: > > lib/python3.9/config-3.9-x86_64-linux-gnu/libpython3.9.a weighs > > 39MB, whereas on master (for 3.8.2) it weighs 6MB. Here is what > > size has to say: =20 >=20 > Yeah, the .o files in there likely contain serialized GIMPLE, as a > result of compiling with =E2=80=98-flto=E2=80=99. >=20 > How about removing *.a altogether in a separate patch? Or moving it > to a =E2=80=9Cstatic=E2=80=9D output? This would be consistent with what= =E2=80=99s done in > other packages. >=20 > Thanks, > Ludo=E2=80=99. Right, this is a good idea. I wrote the attached patches to: enable optimizations, prevent building and installing the static library and to install idle to a separate output, as it is not required in general. With the patch from https://issues.guix.gnu.org/47214, python 3.9 on coreupdates is ~1.7x faster than python 3.8 on master, and is ~25MB smaller than 3.8 on master (I haven't measured the speedup for python2, and it is ~10MB smaller with these changes than on master). --MP_/U.7iQ6r20E2CVBYnfV6TrmN Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0002-gnu-python-Enable-optimizations.patch >From 0c45d6e82a5f4d140840aef6b0de321122b6c4df Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 18 Mar 2021 23:41:40 +0100 Subject: [PATCH 2/4] gnu: python: Enable optimizations. As a result, python execution time of scripts is decreased by 6 to 40%. gnu/packages/python (python-2.7)[arguments]: Add configure and make flags to optimize the resulting python. --- gnu/packages/python.scm | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 0f20f8e7d3..031904dff6 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -184,7 +184,10 @@ "--with-system-expat" ;for XML support "--with-system-ffi" ;build ctypes "--with-ensurepip=install" ;install pip and setuptools + "--with-computed-gotos" ;main interpreter loop optimization + "--with-lto" ;increase size by 20MB, but 15% speedup "--enable-unicode=ucs4" + "--enable-optimizations" ;; Prevent the installed _sysconfigdata.py from retaining a reference ;; to coreutils. @@ -198,8 +201,10 @@ "ac_cv_file__dev_ptmx=no" "ac_cv_file__dev_ptc=no") '()) + "CFLAGS=-fno-semantic-interposition" (string-append "LDFLAGS=-Wl,-rpath=" - (assoc-ref %outputs "out") "/lib")) + (assoc-ref %outputs "out") "/lib" + " -fno-semantic-interposition")) ;; With no -j argument tests use all available cpus, so provide one. #:make-flags (list (string-append -- 2.31.1 --MP_/U.7iQ6r20E2CVBYnfV6TrmN Content-Type: text/x-patch Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename=0003-gnu-python-Do-not-install-static-libraries.patch =46rom 1faeb01becd558f0f4eec16ff32df9dbf1adda7f Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 3 Jun 2021 22:10:09 +0200 Subject: [PATCH 3/4] gnu: python: Do not install static libraries. This is something Fedora already does since 2010, so it should be safe, and saves a lot of space. * gnu/packages/patches/python-2.7-no-static-lib.patch: New file. * gnu/packages/patches/python-3-no-static-lib.patch: New file. * gnu/local.mk (dist_patch_DATA): Add them. * gnu/packages/python.scm (python-2.7, python-3): Use them. --- gnu/local.mk | 2 + .../patches/python-2.7-no-static-lib.patch | 70 +++++++++++++++++ .../patches/python-3-no-static-lib.patch | 75 +++++++++++++++++++ gnu/packages/python.scm | 6 +- 4 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 gnu/packages/patches/python-2.7-no-static-lib.patch create mode 100644 gnu/packages/patches/python-3-no-static-lib.patch diff --git a/gnu/local.mk b/gnu/local.mk index d5a832146e..8370ac12e2 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1551,11 +1551,13 @@ dist_patch_DATA =3D \ %D%/packages/patches/python-2.7-site-prefixes.patch \ %D%/packages/patches/python-2.7-source-date-epoch.patch \ %D%/packages/patches/python-2.7-CVE-2021-3177.patch \ + %D%/packages/patches/python-2.7-no-static-lib.patch \ %D%/packages/patches/python-3-arm-alignment.patch \ %D%/packages/patches/python-3-deterministic-build-info.patch \ %D%/packages/patches/python-3-search-paths.patch \ %D%/packages/patches/python-3-fix-tests.patch \ %D%/packages/patches/python-3-hurd-configure.patch \ + %D%/packages/patches/python-3-no-static-lib.patch \ %D%/packages/patches/python-CVE-2018-14647.patch \ %D%/packages/patches/python-CVE-2020-26116.patch \ %D%/packages/patches/python-aionotify-0.2.0-py3.8.patch \ diff --git a/gnu/packages/patches/python-2.7-no-static-lib.patch b/gnu/pack= ages/patches/python-2.7-no-static-lib.patch new file mode 100644 index 0000000000..02529989be --- /dev/null +++ b/gnu/packages/patches/python-2.7-no-static-lib.patch @@ -0,0 +1,70 @@ +From 92e2dcace7a3c02289b314238c5f18caec659ff1 Mon Sep 17 00:00:00 2001 +From: Julien Lepiller +Date: Sat, 5 Jun 2021 12:41:47 +0200 +Subject: [PATCH] No static lib. + +This patch is adapted from Fedora. The original patch did not apply +because of whitespace changes. + +00111 # +Patch the Makefile.pre.in so that the generated Makefile doesn't try to bu= ild +a libpythonMAJOR.MINOR.a (bug 550692): +Downstream only: not appropriate for upstream +--- + Makefile.pre.in | 26 +------------------------- + 1 file changed, 1 insertion(+), 25 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 6239fc3..948f196 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -486,7 +486,7 @@ coverage-report: regen-grammar +=20 +=20 + # Build the interpreter +-$(BUILDPYTHON): Modules/python.o $(LIBRARY) $(LDLIBRARY) ++$(BUILDPYTHON): Modules/python.o $(LDLIBRARY) + $(LINKCC) $(LDFLAGS) $(LINKFORSHARED) -o $@ \ + Modules/python.o \ + $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) $(LDLAST) +@@ -527,18 +527,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_ma= th.o + _TCLTK_INCLUDES=3D'$(TCLTK_INCLUDES)' _TCLTK_LIBS=3D'$(TCLTK_LIBS)' \ + $(PY_BUILD_ENVIRON) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build +=20 +-# Build static library +-# avoid long command lines, same as LIBRARY_OBJS +-$(LIBRARY): $(LIBRARY_OBJS) +- -rm -f $@ +- $(AR) $(ARFLAGS) $@ Modules/getbuildinfo.o +- $(AR) $(ARFLAGS) $@ $(PARSER_OBJS) +- $(AR) $(ARFLAGS) $@ $(OBJECT_OBJS) +- $(AR) $(ARFLAGS) $@ $(PYTHON_OBJS) +- $(AR) $(ARFLAGS) $@ $(MODULE_OBJS) $(SIGNAL_OBJS) +- $(AR) $(ARFLAGS) $@ $(MODOBJS) +- $(RANLIB) $@ +- + libpython$(VERSION).so: $(LIBRARY_OBJS) + if test $(INSTSONAME) !=3D $(LDLIBRARY); then \ + $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MOD= LIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \ +@@ -1216,18 +1204,6 @@ libainstall: @DEF_MAKE_RULE@ python-config + else true; \ + fi; \ + done +- @if test -d $(LIBRARY); then :; else \ +- if test "$(PYTHONFRAMEWORKDIR)" =3D no-framework; then \ +- if test "$(SO)" =3D .dll; then \ +- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ +- else \ +- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- $(RANLIB) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- fi; \ +- else \ +- echo Skip install of $(LIBRARY) - use make frameworkinstall; \ +- fi; \ +- fi + $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c + $(INSTALL_DATA) Modules/python.o $(DESTDIR)$(LIBPL)/python.o + $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.= c.in +--=20 +2.31.1 + diff --git a/gnu/packages/patches/python-3-no-static-lib.patch b/gnu/packag= es/patches/python-3-no-static-lib.patch new file mode 100644 index 0000000000..b44dbc976c --- /dev/null +++ b/gnu/packages/patches/python-3-no-static-lib.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: David Malcolm +Date: Mon, 18 Jan 2010 17:59:07 +0000 +Subject: [PATCH] 00111: Don't try to build a libpythonMAJOR.MINOR.a +MIME-Version: 1.0 +Content-Type: text/plain; charset=3DUTF-8 +Content-Transfer-Encoding: 8bit + +Downstream only: not appropriate for upstream. + +See https://bugzilla.redhat.com/show_bug.cgi?id=3D556092 + +Co-authored-by: David Malcolm +Co-authored-by: Bohuslav Kabrda +Co-authored-by: Matej Stuchlik +Co-authored-by: Robert Kuska +Co-authored-by: Charalampos Stratakis +Co-authored-by: Miro Hron=C4=8Dok +--- + Makefile.pre.in | 21 ++------------------- + 1 file changed, 2 insertions(+), 19 deletions(-) + +diff --git a/Makefile.pre.in b/Makefile.pre.in +index 0c3981c132..5587422ec7 100644 +--- a/Makefile.pre.in ++++ b/Makefile.pre.in +@@ -589,7 +589,7 @@ clinic: check-clean-src $(srcdir)/Modules/_blake2/blak= e2s_impl.c + $(PYTHON_FOR_REGEN) $(srcdir)/Tools/clinic/clinic.py --make --srcdir $(s= rcdir) +=20 + # Build the interpreter +-$(BUILDPYTHON): Programs/python.o $(LIBRARY) $(LDLIBRARY) $(PY3LIBRARY) $= (EXPORTSYMS) ++$(BUILDPYTHON): Programs/python.o $(LDLIBRARY) $(PY3LIBRARY) $(EXPORTSYMS) + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/python.o $(= BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) +=20 + platform: $(BUILDPYTHON) pybuilddir.txt +@@ -637,12 +637,6 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_ma= th.o + _TCLTK_INCLUDES=3D'$(TCLTK_INCLUDES)' _TCLTK_LIBS=3D'$(TCLTK_LIBS)' \ + $(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build +=20 +- +-# Build static library +-$(LIBRARY): $(LIBRARY_OBJS) +- -rm -f $@ +- $(AR) $(ARFLAGS) $@ $(LIBRARY_OBJS) +- + libpython$(LDVERSION).so: $(LIBRARY_OBJS) $(DTRACE_OBJS) + if test $(INSTSONAME) !=3D $(LDLIBRARY); then \ + $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MOD= LIBS) $(SHLIBS) $(LIBC) $(LIBM); \ +@@ -724,7 +718,7 @@ Makefile Modules/config.c: Makefile.pre \ + @echo "The Makefile was updated, you may need to re-run make." +=20 +=20 +-Programs/_testembed: Programs/_testembed.o $(LIBRARY) $(LDLIBRARY) $(PY3L= IBRARY) $(EXPORTSYMS) ++Programs/_testembed: Programs/_testembed.o $(LDLIBRARY) $(PY3LIBRARY) $(E= XPORTSYMS) + $(LINKCC) $(PY_CORE_LDFLAGS) $(LINKFORSHARED) -o $@ Programs/_testembed.= o $(BLDLIBRARY) $(LIBS) $(MODLIBS) $(SYSLIBS) +=20 + #########################################################################= ### +@@ -1652,17 +1646,6 @@ libainstall: @DEF_MAKE_RULE@ python-config + else true; \ + fi; \ + done +- @if test -d $(LIBRARY); then :; else \ +- if test "$(PYTHONFRAMEWORKDIR)" =3D no-framework; then \ +- if test "$(SHLIB_SUFFIX)" =3D .dll; then \ +- $(INSTALL_DATA) $(LDLIBRARY) $(DESTDIR)$(LIBPL) ; \ +- else \ +- $(INSTALL_DATA) $(LIBRARY) $(DESTDIR)$(LIBPL)/$(LIBRARY) ; \ +- fi; \ +- else \ +- echo Skip install of $(LIBRARY) - use make frameworkinstall; \ +- fi; \ +- fi + $(INSTALL_DATA) Modules/config.c $(DESTDIR)$(LIBPL)/config.c + $(INSTALL_DATA) Programs/python.o $(DESTDIR)$(LIBPL)/python.o + $(INSTALL_DATA) $(srcdir)/Modules/config.c.in $(DESTDIR)$(LIBPL)/config.= c.in diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 031904dff6..4ac4b7c23c 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -150,7 +150,8 @@ "python-2.7-source-date-epoch.patch" "python-2.7-adjust-tests.patch" "python-cross-compile.patch" - "python-2.7-CVE-2021-3177.patch")) + "python-2.7-CVE-2021-3177.patch" + "python-2.7-no-static-lib.patch")) (modules '((guix build utils))) (snippet '(begin @@ -418,7 +419,8 @@ data types.") "python-3-deterministic-build-info.patch" "python-3-fix-tests.patch" "python-3-hurd-configure.patch" - "python-3-search-paths.patch")) + "python-3-search-paths.patch" + "python-3-no-static-lib.patch")) (sha256 (base32 "10vdf46q5ldnzkprm8pldvr5a9hrdpxjv7mpzgdw6vj3cl318nhc")) --=20 2.31.1 --MP_/U.7iQ6r20E2CVBYnfV6TrmN Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0004-gnu-python-Move-idle-to-a-separate-output.patch >From c650ac48be47b373c6c8c0b3495f30d9fe21e68b Mon Sep 17 00:00:00 2001 From: Julien Lepiller Date: Thu, 3 Jun 2021 22:14:14 +0200 Subject: [PATCH 4/4] gnu: python: Move idle to a separate output. idle is a programming environment that is not useful for building packages, but it is still useful for end users. This saves 5MB in the default output. * gnu/packages/python.scm (python-2.7)[outputs]: Add `idle'. [arguments]: Move idle files in the new output. (wrap-python): Do not wrap idle since it is in a different output. --- gnu/packages/python.scm | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm index 4ac4b7c23c..72e05552d8 100644 --- a/gnu/packages/python.scm +++ b/gnu/packages/python.scm @@ -176,7 +176,8 @@ "Lib/test/test_subprocess.py")) #t)))) (outputs '("out" - "tk")) ;tkinter; adds 50 MiB to the closure + "tk" ;tkinter; adds 50 MiB to the closure + "idle")) ;programming environment; weighs 5MB (build-system gnu-build-system) (arguments `(#:test-target "test" @@ -357,6 +358,27 @@ (install-file tkinter.so target) (delete-file tkinter.so))))) #t))) + (add-after 'install 'move-idle + (lambda* (#:key outputs #:allow-other-keys) + ;; when idle is built, move it to a separate output to save some + ;; space (5MB) + (let ((out (assoc-ref outputs "out")) + (idle (assoc-ref outputs "idle"))) + (when idle + (for-each + (lambda (file) + (let ((target (string-append idle "/bin/" (basename file)))) + (install-file file (dirname target)) + (delete-file file))) + (find-files (string-append out "/bin") "^idle")) + (match (find-files out "^idlelib$" #:directories? #t) + ((idlelib) + (let* ((len (string-length out)) + (target (string-append idle "/" + (string-drop idlelib len) + "/site-packages"))) + (mkdir-p (dirname target)) + (rename-file idlelib target)))))))) (add-after 'install 'install-sitecustomize.py ,(customize-site version))))) (inputs @@ -620,8 +642,8 @@ for more information."))) (lambda (old new) (symlink (string-append python old) (string-append bin "/" new))) - `("python3" ,"pydoc3" ,"idle3" ,"pip3") - `("python" ,"pydoc" ,"idle" ,"pip")) + `("python3" ,"pydoc3" ,"pip3") + `("python" ,"pydoc" ,"pip")) ;; python-config outputs search paths based upon its location, ;; use a bash wrapper to avoid changing its outputs. (let ((bash (string-append (assoc-ref %build-inputs "bash") -- 2.31.1 --MP_/U.7iQ6r20E2CVBYnfV6TrmN--