1 From a83b79b964700604de386800f86e5a55f53a0e17 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Wed, 23 Dec 2015 11:47:11 +0100
4 Subject: [PATCH] Add an option to disable pydoc
6 It removes 0.5 MB of data from the target plus the pydoc script
9 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
12 Makefile.pre.in | 8 +++++++-
13 configure.ac | 5 +++++
14 setup.py | 9 +++++++--
15 3 files changed, 19 insertions(+), 3 deletions(-)
17 diff --git a/Makefile.pre.in b/Makefile.pre.in
18 index d4c771a..a98ad65 100644
21 @@ -1134,7 +1134,9 @@ bininstall: altbininstall
22 -rm -f $(DESTDIR)$(BINDIR)/idle3
23 (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
24 -rm -f $(DESTDIR)$(BINDIR)/pydoc3
26 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
28 -rm -f $(DESTDIR)$(BINDIR)/2to3
29 (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
30 -rm -f $(DESTDIR)$(BINDIR)/pyvenv
31 @@ -1184,7 +1186,7 @@ LIBSUBDIRS= tkinter \
32 multiprocessing multiprocessing/dummy \
34 venv venv/scripts venv/scripts/posix \
35 - curses pydoc_data $(MACHDEPS)
38 TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
39 test test/test_asyncio \
40 @@ -1233,6 +1235,10 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
41 test/test_importlib/import_ test/test_importlib/source \
42 unittest/test unittest/test/testmock
45 +LIBSUBDIRS += pydoc_data
48 ifeq (@TEST_MODULES@,yes)
49 LIBSUBDIRS += $(TESTSUBDIRS)
51 diff --git a/configure.ac b/configure.ac
52 index 9f3d226..e9b6d6f 100644
55 @@ -2894,6 +2894,11 @@ if test "$posix_threads" = "yes"; then
56 AC_CHECK_FUNCS(pthread_atfork)
62 + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
63 + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
65 AC_SUBST(TEST_MODULES)
67 diff --git a/setup.py b/setup.py
68 index 3feca04..137911d 100644
71 @@ -2220,6 +2220,12 @@ def main():
72 # turn off warnings when deprecated modules are imported
74 warnings.filterwarnings("ignore",category=DeprecationWarning)
76 + scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
78 + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
79 + scripts += [ 'Tools/scripts/pydoc3' ]
81 setup(# PyPI Metadata (PEP 301)
83 version = sys.version.split()[0],
84 @@ -2244,8 +2250,7 @@ def main():
85 # If you change the scripts installed here, you also need to
86 # check the PyBuildScripts command above, and change the links
87 # created by the bininstall target in Makefile.pre.in
88 - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
89 - "Tools/scripts/2to3", "Tools/scripts/pyvenv"]