2
1

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: b/Makefile.pre.in
  12. ===================================================================
  13. --- a/Makefile.pre.in
  14. +++ b/Makefile.pre.in
  15. @@ -1103,7 +1103,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. @@ -1154,7 +1156,7 @@
  26. multiprocessing multiprocessing/dummy \
  27. unittest \
  28. venv venv/scripts venv/scripts/posix \
  29. - curses pydoc_data $(MACHDEPS)
  30. + curses $(MACHDEPS)
  31. TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
  32. test test/test_asyncio \
  33. @@ -1198,6 +1200,10 @@
  34. test/test_importlib/import_ test/test_importlib/source \
  35. unittest/test unittest/test/testmock
  36. +ifeq (@PYDOC@,yes)
  37. +LIBSUBDIRS += pydoc_data
  38. +endif
  39. +
  40. ifeq (@TEST_MODULES@,yes)
  41. LIBSUBDIRS += $(TESTSUBDIRS)
  42. endif
  43. Index: b/configure.ac
  44. ===================================================================
  45. --- a/configure.ac
  46. +++ b/configure.ac
  47. @@ -2675,6 +2675,11 @@
  48. AC_CHECK_FUNCS(pthread_atfork)
  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: b/setup.py
  57. ===================================================================
  58. --- a/setup.py
  59. +++ b/setup.py
  60. @@ -2200,6 +2200,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. @@ -2224,8 +2230,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