2
1

0013-Add-an-option-to-disable-pydoc.patch 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. From a65e5d3caf8e076d531191164c23c6240461f675 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. ---
  14. Makefile.pre.in | 7 ++++++-
  15. configure.ac | 6 ++++++
  16. setup.py | 9 +++++++--
  17. 3 files changed, 19 insertions(+), 3 deletions(-)
  18. diff --git a/Makefile.pre.in b/Makefile.pre.in
  19. index c0d5511..32b3df7 100644
  20. --- a/Makefile.pre.in
  21. +++ b/Makefile.pre.in
  22. @@ -1391,7 +1391,9 @@ bininstall: altbininstall
  23. -rm -f $(DESTDIR)$(BINDIR)/idle3
  24. (cd $(DESTDIR)$(BINDIR); $(LN) -s idle$(VERSION) idle3)
  25. -rm -f $(DESTDIR)$(BINDIR)/pydoc3
  26. +ifeq (@PYDOC@,yes)
  27. (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
  28. +endif
  29. -rm -f $(DESTDIR)$(BINDIR)/2to3
  30. (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
  31. if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
  32. @@ -1442,7 +1444,6 @@ LIBSUBDIRS= asyncio \
  33. lib2to3 lib2to3/fixes lib2to3/pgen2 \
  34. logging \
  35. multiprocessing multiprocessing/dummy \
  36. - pydoc_data \
  37. site-packages \
  38. sqlite3 \
  39. tkinter \
  40. @@ -1530,6 +1531,10 @@ TESTSUBDIRS= ctypes/test \
  41. tkinter/test/test_ttk \
  42. unittest/test unittest/test/testmock
  43. +ifeq (@PYDOC@,yes)
  44. +LIBSUBDIRS += pydoc_data
  45. +endif
  46. +
  47. TEST_MODULES=@TEST_MODULES@
  48. libinstall: build_all $(srcdir)/Modules/xxmodule.c
  49. @for i in $(SCRIPTDIR) $(LIBDEST); \
  50. diff --git a/configure.ac b/configure.ac
  51. index 083a12d..9079531 100644
  52. --- a/configure.ac
  53. +++ b/configure.ac
  54. @@ -3373,6 +3373,12 @@ if test "$posix_threads" = "yes"; then
  55. AC_CHECK_FUNCS(pthread_getcpuclockid)
  56. fi
  57. +AC_SUBST(PYDOC)
  58. +
  59. +AC_ARG_ENABLE(pydoc,
  60. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  61. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  62. +
  63. # Check for enable-ipv6
  64. AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
  65. diff --git a/setup.py b/setup.py
  66. index d00d389..d23f148 100644
  67. --- a/setup.py
  68. +++ b/setup.py
  69. @@ -2721,6 +2721,12 @@ def main():
  70. # turn off warnings when deprecated modules are imported
  71. import warnings
  72. warnings.filterwarnings("ignore",category=DeprecationWarning)
  73. +
  74. + scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
  75. + 'Lib/smtpd.py']
  76. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  77. + scripts += [ 'Tools/scripts/pydoc3' ]
  78. +
  79. setup(# PyPI Metadata (PEP 301)
  80. name = "Python",
  81. version = sys.version.split()[0],
  82. @@ -2746,8 +2752,7 @@ def main():
  83. # If you change the scripts installed here, you also need to
  84. # check the PyBuildScripts command above, and change the links
  85. # created by the bininstall target in Makefile.pre.in
  86. - scripts = ["Tools/scripts/pydoc3", "Tools/scripts/idle3",
  87. - "Tools/scripts/2to3"]
  88. + scripts = scripts
  89. )
  90. # --install-platlib
  91. --
  92. 2.30.2