2
1

0003-Add-an-option-to-disable-pydoc.patch 2.8 KB

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