python-2.7-101-optional-pydoc.patch 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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 | 6 +++++-
  8. configure.in | 5 +++++
  9. setup.py | 10 +++++++---
  10. 3 files changed, 17 insertions(+), 4 deletions(-)
  11. Index: Python-2.7.2/Makefile.pre.in
  12. ===================================================================
  13. --- Python-2.7.2.orig/Makefile.pre.in
  14. +++ Python-2.7.2/Makefile.pre.in
  15. @@ -868,7 +868,7 @@
  16. multiprocessing multiprocessing/dummy \
  17. unittest \
  18. lib-old \
  19. - curses pydoc_data $(MACHDEPS)
  20. + curses $(MACHDEPS)
  21. ifeq (@TEST_MODULES@,yes)
  22. LIBSUBDIRS += lib-tk/test lib-tk/test/test_tkinter \
  23. @@ -880,6 +880,10 @@
  24. ctypes/test distutils/tests unittest/test
  25. endif
  26. +ifeq (@PYDOC@,yes)
  27. +LIBSUBDIRS += pydoc_data
  28. +endif
  29. +
  30. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  31. @for i in $(SCRIPTDIR) $(LIBDEST); \
  32. do \
  33. Index: Python-2.7.2/configure.in
  34. ===================================================================
  35. --- Python-2.7.2.orig/configure.in
  36. +++ Python-2.7.2/configure.in
  37. @@ -2407,6 +2407,11 @@
  38. esac])
  39. fi
  40. +AC_SUBST(PYDOC)
  41. +
  42. +AC_ARG_ENABLE(pydoc,
  43. + AS_HELP_STRING([--disable-pydoc], [disable pydoc]),
  44. + [ PYDOC="${enableval}" ], [ PYDOC=yes ])
  45. AC_SUBST(TEST_MODULES)
  46. Index: Python-2.7.2/setup.py
  47. ===================================================================
  48. --- Python-2.7.2.orig/setup.py
  49. +++ Python-2.7.2/setup.py
  50. @@ -2092,6 +2092,12 @@
  51. # turn off warnings when deprecated modules are imported
  52. import warnings
  53. warnings.filterwarnings("ignore",category=DeprecationWarning)
  54. +
  55. + scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  56. + 'Lib/smtpd.py']
  57. + if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  58. + scripts += [ 'Tools/scripts/pydoc' ]
  59. +
  60. setup(# PyPI Metadata (PEP 301)
  61. name = "Python",
  62. version = sys.version.split()[0],
  63. @@ -2112,9 +2118,7 @@
  64. ext_modules=[Extension('_struct', ['_struct.c'])],
  65. # Scripts to install
  66. - scripts = ['Tools/scripts/pydoc', 'Tools/scripts/idle',
  67. - 'Tools/scripts/2to3',
  68. - 'Lib/smtpd.py']
  69. + scripts = scripts,
  70. )
  71. # --install-platlib