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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. From 57e14d395860a781d0b43b1ef3e2a4a8b04bbf80 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. ---
  12. Makefile.pre.in | 8 +++++++-
  13. configure.ac | 6 ++++++
  14. setup.py | 9 +++++++--
  15. 3 files changed, 20 insertions(+), 3 deletions(-)
  16. diff --git a/Makefile.pre.in b/Makefile.pre.in
  17. index bbc779ee6a..dd83413f17 100644
  18. --- a/Makefile.pre.in
  19. +++ b/Makefile.pre.in
  20. @@ -1373,7 +1373,9 @@ bininstall: altbininstall
  21. -rm -f $(DESTDIR)$(BINDIR)/idle3
  22. (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
  23. -rm -f $(DESTDIR)$(BINDIR)/pydoc3
  24. +ifeq (@PYDOC@,yes)
  25. (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
  26. +endif
  27. -rm -f $(DESTDIR)$(BINDIR)/2to3
  28. (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
  29. if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
  30. @@ -1423,7 +1425,7 @@ LIBSUBDIRS= tkinter site-packages \
  31. multiprocessing multiprocessing/dummy \
  32. unittest \
  33. venv venv/scripts venv/scripts/common venv/scripts/posix \
  34. - curses pydoc_data \
  35. + curses \
  36. zoneinfo
  37. TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
  38. @@ -1507,6 +1509,10 @@ ifeq (@TEST_MODULES@,yes)
  39. LIBSUBDIRS += $(TESTSUBDIRS)
  40. endif
  41. +ifeq (@PYDOC@,yes)
  42. +LIBSUBDIRS += pydoc_data
  43. +endif
  44. +
  45. libinstall: build_all $(srcdir)/Modules/xxmodule.c
  46. @for i in $(SCRIPTDIR) $(LIBDEST); \
  47. do \
  48. diff --git a/configure.ac b/configure.ac
  49. index bebad207f8..b748ad7957 100644
  50. --- a/configure.ac
  51. +++ b/configure.ac
  52. @@ -3365,6 +3365,12 @@ if test "$posix_threads" = "yes"; then
  53. AC_CHECK_FUNCS(pthread_getcpuclockid)
  54. fi
  55. +AC_SUBST(PYDOC)
  56. +
  57. +AC_ARG_ENABLE(pydoc,
  58. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  59. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  60. +
  61. AC_SUBST(TEST_MODULES)
  62. AC_ARG_ENABLE(test-modules,
  63. diff --git a/setup.py b/setup.py
  64. index 506f6107de..dcbc109c30 100644
  65. --- a/setup.py
  66. +++ b/setup.py
  67. @@ -2572,6 +2572,12 @@ def main():
  68. # turn off warnings when deprecated modules are imported
  69. import warnings
  70. warnings.filterwarnings("ignore",category=DeprecationWarning)
  71. +
  72. + scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
  73. + 'Lib/smtpd.py']
  74. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  75. + scripts += [ 'Tools/scripts/pydoc3' ]
  76. +
  77. setup(# PyPI Metadata (PEP 301)
  78. name = "Python",
  79. version = sys.version.split()[0],
  80. @@ -2596,8 +2602,7 @@ def main():
  81. # If you change the scripts installed here, you also need to
  82. # check the PyBuildScripts command above, and change the links
  83. # created by the bininstall target in Makefile.pre.in
  84. - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
  85. - "Tools/scripts/2to3"]
  86. + scripts = scripts
  87. )
  88. # --install-platlib
  89. --
  90. 2.20.1