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

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