xref: /OK3568_Linux_fs/buildroot/package/python3/0021-Add-an-option-to-disable-IDLE.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1From f1b15834045d0641c43014b970721df066fa71f7 Mon Sep 17 00:00:00 2001
2From: Maxime Ripard <maxime.ripard@free-electrons.com>
3Date: Wed, 22 Feb 2017 17:45:14 -0800
4Subject: [PATCH] Add an option to disable IDLE
5
6IDLE is an IDE embedded into python, written using Tk, so it doesn't make
7much sense to have it into our build.
8
9Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
10[ Andrey Smirnov: ported to Python 3.6 ]
11Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
12[ Adam Duskett: ported to Python 3.10.0 ]
13Signed-off-by: Adam Duskett <aduskett@gmail.com>
14---
15 Makefile.pre.in | 7 ++++++-
16 configure.ac    | 6 ++++++
17 setup.py        | 5 ++++-
18 3 files changed, 16 insertions(+), 2 deletions(-)
19
20diff --git a/Makefile.pre.in b/Makefile.pre.in
21index 08c5e8a..461c5e3 100644
22--- a/Makefile.pre.in
23+++ b/Makefile.pre.in
24@@ -1389,7 +1389,9 @@ bininstall: altbininstall
25 	-rm -f $(DESTDIR)$(LIBPC)/python3-embed.pc
26 	(cd $(DESTDIR)$(LIBPC); $(LN) -s python-$(VERSION)-embed.pc python3-embed.pc)
27 	-rm -f $(DESTDIR)$(BINDIR)/idle3
28+ifeq (@IDLE@,yes)
29 	(cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
30+endif
31 	-rm -f $(DESTDIR)$(BINDIR)/pydoc3
32 ifeq (@PYDOC@,yes)
33 	(cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
34@@ -1439,7 +1441,6 @@ LIBSUBDIRS=	asyncio \
35 		ensurepip ensurepip/_bundled \
36 		html \
37 		http \
38-		idlelib idlelib/Icons \
39 		importlib importlib/metadata \
40 		json \
41 		logging \
42@@ -1552,6 +1553,10 @@ ifeq (@EXPAT@,yes)
43 LIBSUBDIRS += $(XMLLIBSUBDIRS)
44 endif
45
46+ifeq (@IDLE@,yes)
47+LIBSUBDIRS += idlelib idlelib/Icons
48+endif
49+
50 TEST_MODULES=@TEST_MODULES@
51 libinstall:	build_all $(srcdir)/Modules/xxmodule.c
52 	@for i in $(SCRIPTDIR) $(LIBDEST); \
53diff --git a/configure.ac b/configure.ac
54index e99a174..baaa743 100644
55--- a/configure.ac
56+++ b/configure.ac
57@@ -6073,6 +6073,12 @@ AC_ARG_ENABLE(lib2to3,
58 	AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
59 	[ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
60
61+AC_SUBST(IDLE)
62+
63+AC_ARG_ENABLE(idle3,
64+	AS_HELP_STRING([--disable-idle3], [disable idle3 IDE]),
65+	[ IDLE="${enableval}" ], [ IDLE=yes ])
66+
67 # generate output files
68 AC_CONFIG_FILES(Makefile.pre Misc/python.pc Misc/python-embed.pc Misc/python-config.sh)
69 AC_CONFIG_FILES([Modules/ld_so_aix], [chmod +x Modules/ld_so_aix])
70diff --git a/setup.py b/setup.py
71index e30ed52..4dff249 100644
72--- a/setup.py
73+++ b/setup.py
74@@ -2722,11 +2722,14 @@ def main():
75     import warnings
76     warnings.filterwarnings("ignore",category=DeprecationWarning)
77
78-    scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
79+    scripts = [ 'Lib/smtpd.py']
80     if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
81         scripts += [ 'Tools/scripts/pydoc3' ]
82     if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
83         scripts += [ 'Tools/scripts/2to3' ]
84+    if not '--disable-idle3' in sysconfig.get_config_var("CONFIG_ARGS"):
85+        scripts += [ 'Tools/scripts/idle3' ]
86+
87     setup(# PyPI Metadata (PEP 301)
88           name = "Python",
89           version = sys.version.split()[0],
90--
912.30.2
92
93