0017-Add-an-option-to-disable-pydoc.patch 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From 52463745b6c46a46a6f2e2bc17983bb3f7bdac6e Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 7 Mar 2017 22:27:34 +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 | 6 +++++-
  11. configure.ac | 5 +++++
  12. setup.py | 10 +++++++---
  13. 3 files changed, 17 insertions(+), 4 deletions(-)
  14. diff --git a/Makefile.pre.in b/Makefile.pre.in
  15. index 280cc4e..84d5fc6 100644
  16. --- a/Makefile.pre.in
  17. +++ b/Makefile.pre.in
  18. @@ -1052,7 +1052,7 @@ LIBSUBDIRS= lib-tk site-packages \
  19. multiprocessing multiprocessing/dummy \
  20. unittest \
  21. lib-old \
  22. - curses pydoc_data $(MACHDEPS)
  23. + curses $(MACHDEPS)
  24. TESTSUBDIRS = lib-tk/test lib-tk/test/test_tkinter \
  25. lib-tk/test/test_ttk test test/audiodata test/capath test/data \
  26. @@ -1075,6 +1075,10 @@ ifeq (@TEST_MODULES@,yes)
  27. LIBSUBDIRS += $(TESTSUBDIRS)
  28. endif
  29. +ifeq (@PYDOC@,yes)
  30. +LIBSUBDIRS += pydoc_data
  31. +endif
  32. +
  33. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  34. @for i in $(SCRIPTDIR) $(LIBDEST); \
  35. do \
  36. diff --git a/configure.ac b/configure.ac
  37. index a1a35f6..8bab160 100644
  38. --- a/configure.ac
  39. +++ b/configure.ac
  40. @@ -2805,6 +2805,11 @@ if test "$posix_threads" = "yes"; then
  41. AC_CHECK_FUNCS(pthread_atfork)
  42. fi
  43. +AC_SUBST(PYDOC)
  44. +
  45. +AC_ARG_ENABLE(pydoc,
  46. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  47. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  48. AC_SUBST(TEST_MODULES)
  49. diff --git a/setup.py b/setup.py
  50. index 9a5c2b8..69771e2 100644
  51. --- a/setup.py
  52. +++ b/setup.py
  53. @@ -2233,6 +2233,12 @@ def main():
  54. # turn off warnings when deprecated modules are imported
  55. import warnings
  56. warnings.filterwarnings("ignore",category=DeprecationWarning)
  57. +
  58. + scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  59. + 'Lib/smtpd.py']
  60. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  61. + scripts += [ 'Tools/scripts/pydoc' ]
  62. +
  63. setup(# PyPI Metadata (PEP 301)
  64. name = "Python",
  65. version = sys.version.split()[0],
  66. @@ -2253,9 +2259,7 @@ def main():
  67. ext_modules=[Extension('_struct', ['_struct.c'])],
  68. # Scripts to install
  69. - scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
  70. - 'Tools/scripts/2to3',
  71. - 'Lib/smtpd.py']
  72. + scripts = scripts,
  73. )
  74. # --install-platlib
  75. --
  76. 2.7.4