2
1

0014-Add-an-option-to-disable-pydoc.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. From 18a754e930e03d143d9392e49174cc370b334cdd Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Wed, 22 Feb 2017 17:07:56 -0800
  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. [ Andrey Smirnov: ported to Python 3.6 ]
  10. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
  11. [aduskett@gmail.com: Update for python 3.6.4]
  12. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  13. ---
  14. Makefile.pre.in | 8 +++++++-
  15. configure.ac | 6 ++++++
  16. setup.py | 9 +++++++--
  17. 3 files changed, 20 insertions(+), 3 deletions(-)
  18. diff --git a/Makefile.pre.in b/Makefile.pre.in
  19. index 4110fff4ac..badb2af35d 100644
  20. --- a/Makefile.pre.in
  21. +++ b/Makefile.pre.in
  22. @@ -1196,7 +1196,9 @@ bininstall: altbininstall
  23. -rm -f $(DESTDIR)$(BINDIR)/idle3
  24. (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
  25. -rm -f $(DESTDIR)$(BINDIR)/pydoc3
  26. +ifeq (@PYDOC@,yes)
  27. (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
  28. +endif
  29. -rm -f $(DESTDIR)$(BINDIR)/2to3
  30. (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
  31. -rm -f $(DESTDIR)$(BINDIR)/pyvenv
  32. @@ -1244,7 +1246,7 @@ LIBSUBDIRS= tkinter site-packages \
  33. multiprocessing multiprocessing/dummy \
  34. unittest \
  35. venv venv/scripts venv/scripts/common venv/scripts/posix \
  36. - curses pydoc_data
  37. + curses
  38. TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
  39. tkinter/test/test_ttk test \
  40. @@ -1303,6 +1305,10 @@ ifeq (@TEST_MODULES@,yes)
  41. LIBSUBDIRS += $(TESTSUBDIRS)
  42. endif
  43. +ifeq (@PYDOC@,yes)
  44. +LIBSUBDIRS += pydoc_data
  45. +endif
  46. +
  47. libinstall: build_all $(srcdir)/Modules/xxmodule.c
  48. @for i in $(SCRIPTDIR) $(LIBDEST); \
  49. do \
  50. diff --git a/configure.ac b/configure.ac
  51. index f924937fe1..1621fa1611 100644
  52. --- a/configure.ac
  53. +++ b/configure.ac
  54. @@ -3112,6 +3112,12 @@ if test "$posix_threads" = "yes"; then
  55. AC_CHECK_FUNCS(pthread_atfork)
  56. fi
  57. +AC_SUBST(PYDOC)
  58. +
  59. +AC_ARG_ENABLE(pydoc,
  60. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  61. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  62. +
  63. AC_SUBST(TEST_MODULES)
  64. AC_ARG_ENABLE(test-modules,
  65. diff --git a/setup.py b/setup.py
  66. index 29bfd174d2..94dd337fef 100644
  67. --- a/setup.py
  68. +++ b/setup.py
  69. @@ -2323,6 +2323,12 @@ def main():
  70. # turn off warnings when deprecated modules are imported
  71. import warnings
  72. warnings.filterwarnings("ignore",category=DeprecationWarning)
  73. +
  74. + scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
  75. + 'Lib/smtpd.py']
  76. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  77. + scripts += [ 'Tools/scripts/pydoc3' ]
  78. +
  79. setup(# PyPI Metadata (PEP 301)
  80. name = "Python",
  81. version = sys.version.split()[0],
  82. @@ -2347,8 +2353,7 @@ def main():
  83. # If you change the scripts installed here, you also need to
  84. # check the PyBuildScripts command above, and change the links
  85. # created by the bininstall target in Makefile.pre.in
  86. - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
  87. - "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
  88. + scripts = scripts
  89. )
  90. # --install-platlib
  91. --
  92. 2.13.5