python3-101-optional-pydoc.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 | 8 +++++++-
  8. configure.ac | 5 +++++
  9. setup.py | 9 +++++++--
  10. 3 files changed, 19 insertions(+), 3 deletions(-)
  11. Index: cpython/Makefile.pre.in
  12. ===================================================================
  13. --- cpython.orig/Makefile.pre.in
  14. +++ cpython/Makefile.pre.in
  15. @@ -952,7 +952,9 @@
  16. -rm -f $(DESTDIR)$(BINDIR)/idle3
  17. (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
  18. -rm -f $(DESTDIR)$(BINDIR)/pydoc3
  19. +ifeq (@PYDOC@,yes)
  20. (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
  21. +endif
  22. -rm -f $(DESTDIR)$(BINDIR)/2to3
  23. (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
  24. -rm -f $(DESTDIR)$(BINDIR)/pyvenv
  25. @@ -991,7 +993,7 @@
  26. multiprocessing multiprocessing/dummy \
  27. unittest \
  28. venv venv/scripts venv/scripts/posix \
  29. - curses pydoc_data $(MACHDEPS)
  30. + curses $(MACHDEPS)
  31. ifeq (@TEST_MODULES@,yes)
  32. LIBSUBDIRS += tkinter/test tkinter/test/test_tkinter \
  33. @@ -1034,6 +1036,10 @@
  34. unittest unittest/test unittest/test/testmock
  35. endif
  36. +ifeq (@PYDOC@,yes)
  37. +LIBSUBDIRS += pydoc_data
  38. +endif
  39. +
  40. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  41. @for i in $(SCRIPTDIR) $(LIBDEST); \
  42. do \
  43. Index: cpython/configure.ac
  44. ===================================================================
  45. --- cpython.orig/configure.ac
  46. +++ cpython/configure.ac
  47. @@ -2448,6 +2448,11 @@
  48. esac])
  49. fi
  50. +AC_SUBST(PYDOC)
  51. +
  52. +AC_ARG_ENABLE(pydoc,
  53. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  54. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  55. AC_SUBST(TEST_MODULES)
  56. Index: cpython/setup.py
  57. ===================================================================
  58. --- cpython.orig/setup.py
  59. +++ cpython/setup.py
  60. @@ -2123,6 +2123,12 @@
  61. # turn off warnings when deprecated modules are imported
  62. import warnings
  63. warnings.filterwarnings("ignore",category=DeprecationWarning)
  64. +
  65. + scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
  66. + 'Lib/smtpd.py']
  67. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  68. + scripts += [ 'Tools/scripts/pydoc3' ]
  69. +
  70. setup(# PyPI Metadata (PEP 301)
  71. name = "Python",
  72. version = sys.version.split()[0],
  73. @@ -2147,8 +2153,7 @@
  74. # If you change the scripts installed here, you also need to
  75. # check the PyBuildScripts command above, and change the links
  76. # created by the bininstall target in Makefile.pre.in
  77. - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
  78. - "Tools/scripts/2to3", "Tools/scripts/pyvenv"]
  79. + scripts = scripts,
  80. )
  81. # --install-platlib