0018-Add-an-option-to-disable-pydoc.patch 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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
  5. It removes 0.5 MB of data from the target plus the pydoc script
  6. itself.
  7. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  8. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  9. ---
  10. Makefile.pre.in | 8 +++++++-
  11. configure.ac | 5 +++++
  12. setup.py | 9 +++++++--
  13. 3 files changed, 19 insertions(+), 3 deletions(-)
  14. diff --git a/Makefile.pre.in b/Makefile.pre.in
  15. index d4c771a..a98ad65 100644
  16. --- a/Makefile.pre.in
  17. +++ b/Makefile.pre.in
  18. @@ -1134,7 +1134,9 @@ bininstall: altbininstall
  19. -rm -f $(DESTDIR)$(BINDIR)/idle3
  20. (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
  21. -rm -f $(DESTDIR)$(BINDIR)/pydoc3
  22. +ifeq (@PYDOC@,yes)
  23. (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
  24. +endif
  25. -rm -f $(DESTDIR)$(BINDIR)/2to3
  26. (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
  27. -rm -f $(DESTDIR)$(BINDIR)/pyvenv
  28. @@ -1184,7 +1186,7 @@ LIBSUBDIRS= tkinter \
  29. multiprocessing multiprocessing/dummy \
  30. unittest \
  31. venv venv/scripts venv/scripts/posix \
  32. - curses pydoc_data $(MACHDEPS)
  33. + curses $(MACHDEPS)
  34. TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
  35. test test/test_asyncio \
  36. @@ -1233,6 +1235,10 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
  37. test/test_importlib/import_ test/test_importlib/source \
  38. unittest/test unittest/test/testmock
  39. +ifeq (@PYDOC@,yes)
  40. +LIBSUBDIRS += pydoc_data
  41. +endif
  42. +
  43. ifeq (@TEST_MODULES@,yes)
  44. LIBSUBDIRS += $(TESTSUBDIRS)
  45. endif
  46. diff --git a/configure.ac b/configure.ac
  47. index 9f3d226..e9b6d6f 100644
  48. --- a/configure.ac
  49. +++ b/configure.ac
  50. @@ -2894,6 +2894,11 @@ if test "$posix_threads" = "yes"; then
  51. AC_CHECK_FUNCS(pthread_atfork)
  52. fi
  53. +AC_SUBST(PYDOC)
  54. +
  55. +AC_ARG_ENABLE(pydoc,
  56. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  57. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  58. AC_SUBST(TEST_MODULES)
  59. diff --git a/setup.py b/setup.py
  60. index 3feca04..137911d 100644
  61. --- a/setup.py
  62. +++ b/setup.py
  63. @@ -2220,6 +2220,12 @@ def main():
  64. # turn off warnings when deprecated modules are imported
  65. import warnings
  66. warnings.filterwarnings("ignore",category=DeprecationWarning)
  67. +
  68. + scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
  69. + 'Lib/smtpd.py']
  70. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  71. + scripts += [ 'Tools/scripts/pydoc3' ]
  72. +
  73. setup(# PyPI Metadata (PEP 301)
  74. name = "Python",
  75. version = sys.version.split()[0],
  76. @@ -2244,8 +2250,7 @@ def main():
  77. # If you change the scripts installed here, you also need to
  78. # check the PyBuildScripts command above, and change the links
  79. # created by the bininstall target in Makefile.pre.in
  80. - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
  81. - "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
  82. + scripts = scripts,
  83. )
  84. # --install-platlib
  85. --
  86. 2.6.4