0002-Add-an-option-to-disable-pydoc.patch 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. From 7db6ccbed6dd0b47011d1dfecb040d447ccf4595 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. Upstream: N/A
  8. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  9. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  10. [ Andrey Smirnov: ported to Python 3.6 ]
  11. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
  12. [ Adam Duskett: ported to Python 3.10.0 ]
  13. Signed-off-by: Adam Duskett <aduskett@gmail.com>
  14. [ Adam Duskett: ported to Python 3.12.1 ]
  15. Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
  16. [ Vincent Fazio: ported to Python 3.13.2 ]
  17. Signed-off-by: Vincent Fazio <vfazio@gmail.com>
  18. ---
  19. Makefile.pre.in | 9 ++++++++-
  20. configure.ac | 6 ++++++
  21. 2 files changed, 14 insertions(+), 1 deletion(-)
  22. diff --git a/Makefile.pre.in b/Makefile.pre.in
  23. index b9a2ab2b02b..4360b60165a 100644
  24. --- a/Makefile.pre.in
  25. +++ b/Makefile.pre.in
  26. @@ -2275,7 +2275,9 @@ bininstall: commoninstall altbininstall
  27. -rm -f $(DESTDIR)$(BINDIR)/idle3
  28. (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
  29. -rm -f $(DESTDIR)$(BINDIR)/pydoc3
  30. +ifeq (@PYDOC@,yes)
  31. (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
  32. +endif
  33. if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
  34. rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
  35. (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
  36. @@ -2325,7 +2327,6 @@ LIBSUBDIRS= asyncio \
  37. logging \
  38. multiprocessing multiprocessing/dummy \
  39. pathlib \
  40. - pydoc_data \
  41. re \
  42. site-packages \
  43. sqlite3 \
  44. @@ -2483,6 +2484,10 @@ TESTSUBDIRS= idlelib/idle_test \
  45. COMPILEALL_OPTS=-j0
  46. +ifeq (@PYDOC@,yes)
  47. +LIBSUBDIRS += pydoc_data
  48. +endif
  49. +
  50. TEST_MODULES=@TEST_MODULES@
  51. .PHONY: libinstall
  52. @@ -2710,7 +2715,9 @@ libainstall: all scripts
  53. $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
  54. $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
  55. $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
  56. +ifeq (@PYDOC@,yes)
  57. $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
  58. +endif
  59. @if [ -s Modules/python.exp -a \
  60. "`echo $(MACHDEP) | sed 's/^\(...\).*/\1/'`" = "aix" ]; then \
  61. echo; echo "Installing support files for building shared extension modules on AIX:"; \
  62. diff --git a/configure.ac b/configure.ac
  63. index c60381f9605..583adc7e16a 100644
  64. --- a/configure.ac
  65. +++ b/configure.ac
  66. @@ -4661,6 +4661,12 @@ AS_VAR_IF([posix_threads], [stub], [
  67. AC_DEFINE([HAVE_PTHREAD_STUBS], [1], [Define if platform requires stubbed pthreads support])
  68. ])
  69. +AC_SUBST(PYDOC)
  70. +
  71. +AC_ARG_ENABLE(pydoc,
  72. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  73. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  74. +
  75. # Check for enable-ipv6
  76. AH_TEMPLATE([ENABLE_IPV6], [Define if --enable-ipv6 is specified])
  77. AC_MSG_CHECKING([if --enable-ipv6 is specified])
  78. --
  79. 2.34.1