101-optional-pydoc.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. Add an option to disable pydoc
  2. It removes 0.5 MB of data from the target plus the pydoc script
  3. itself.
  4. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  5. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  6. ---
  7. Makefile.pre.in | 6 +++++-
  8. configure.in | 5 +++++
  9. setup.py | 10 +++++++---
  10. 3 files changed, 17 insertions(+), 4 deletions(-)
  11. Index: b/Makefile.pre.in
  12. ===================================================================
  13. --- a/Makefile.pre.in
  14. +++ b/Makefile.pre.in
  15. @@ -974,7 +974,7 @@
  16. multiprocessing multiprocessing/dummy \
  17. unittest \
  18. lib-old \
  19. - curses pydoc_data $(MACHDEPS)
  20. + curses $(MACHDEPS)
  21. TESTSUBDIRS = lib-tk/test lib-tk/test/test_tkinter \
  22. lib-tk/test/test_ttk test test/audiodata test/capath test/data \
  23. @@ -997,6 +997,10 @@
  24. LIBSUBDIRS += $(TESTSUBDIRS)
  25. endif
  26. +ifeq (@PYDOC@,yes)
  27. +LIBSUBDIRS += pydoc_data
  28. +endif
  29. +
  30. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  31. @for i in $(SCRIPTDIR) $(LIBDEST); \
  32. do \
  33. Index: b/configure.ac
  34. ===================================================================
  35. --- a/configure.ac
  36. +++ b/configure.ac
  37. @@ -2633,6 +2633,11 @@
  38. AC_CHECK_FUNCS(pthread_atfork)
  39. fi
  40. +AC_SUBST(PYDOC)
  41. +
  42. +AC_ARG_ENABLE(pydoc,
  43. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  44. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  45. AC_SUBST(TEST_MODULES)
  46. Index: b/setup.py
  47. ===================================================================
  48. --- a/setup.py
  49. +++ b/setup.py
  50. @@ -2211,6 +2211,12 @@
  51. # turn off warnings when deprecated modules are imported
  52. import warnings
  53. warnings.filterwarnings("ignore",category=DeprecationWarning)
  54. +
  55. + scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  56. + 'Lib/smtpd.py']
  57. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  58. + scripts += [ 'Tools/scripts/pydoc' ]
  59. +
  60. setup(# PyPI Metadata (PEP 301)
  61. name = "Python",
  62. version = sys.version.split()[0],
  63. @@ -2231,9 +2237,7 @@
  64. ext_modules=[Extension('_struct', ['_struct.c'])],
  65. # Scripts to install
  66. - scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
  67. - 'Tools/scripts/2to3',
  68. - 'Lib/smtpd.py']
  69. + scripts = scripts,
  70. )
  71. # --install-platlib