python-2.7-102-optional-2to3.patch 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. Add an option to disable lib2to3
  2. lib2to3 is a library to convert Python 2.x code to Python 3.x. As
  3. such, it is probably not very useful on embedded system targets.
  4. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  5. ---
  6. Makefile.pre.in | 24 +++++++++++++++++-------
  7. configure.in | 6 ++++++
  8. setup.py | 5 +++--
  9. 3 files changed, 26 insertions(+), 9 deletions(-)
  10. Index: Python-2.7.1/Makefile.pre.in
  11. ===================================================================
  12. --- Python-2.7.1.orig/Makefile.pre.in
  13. +++ Python-2.7.1/Makefile.pre.in
  14. @@ -856,9 +856,7 @@
  15. encodings compiler hotshot \
  16. email email/mime \
  17. json \
  18. - sqlite3 \
  19. logging bsddb csv importlib wsgiref \
  20. - lib2to3 lib2to3/fixes lib2to3/pgen2 \
  21. ctypes ctypes/macholib idlelib idlelib/Icons \
  22. distutils distutils/command $(XMLLIBSUBDIRS) \
  23. multiprocessing multiprocessing/dummy \
  24. @@ -872,12 +870,7 @@
  25. test/decimaltestdata test/xmltestdata \
  26. test/tracedmodules \
  27. email/test email/test/data \
  28. - sqlite3/test \
  29. bsddb/test \
  30. - lib2to3/tests \
  31. - lib2to3/tests/data \
  32. - lib2to3/tests/data/fixers \
  33. - lib2to3/tests/data/fixers/myfixes \
  34. ctypes/test distutils/tests \
  35. unittest/test
  36. endif
  37. @@ -886,6 +879,23 @@
  38. LIBSUBDIRS += pydoc_data
  39. endif
  40. +ifeq (@LIB2TO3@,yes)
  41. +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
  42. +ifeq (@TEST_MODULES@,yes)
  43. +LIBSUBDIRS += lib2to3/tests \
  44. + lib2to3/tests/data \
  45. + lib2to3/tests/data/fixers \
  46. + lib2to3/tests/data/fixers/myfixes
  47. +endif
  48. +endif
  49. +
  50. +ifeq (@SQLITE3@,yes)
  51. +LIBSUBDIRS += sqlite3
  52. +ifeq (@TEST_MODULES@,yes)
  53. +LIBSUBDIRS += sqlite3/test
  54. +endif
  55. +endif
  56. +
  57. libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
  58. @for i in $(SCRIPTDIR) $(LIBDEST); \
  59. do \
  60. Index: Python-2.7.1/configure.in
  61. ===================================================================
  62. --- Python-2.7.1.orig/configure.in
  63. +++ Python-2.7.1/configure.in
  64. @@ -2404,6 +2404,12 @@
  65. AS_HELP_STRING([--disable-test-modules], [disable test modules]),
  66. [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
  67. +AC_SUBST(LIB2TO3)
  68. +
  69. +AC_ARG_ENABLE(lib2to3,
  70. + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
  71. + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
  72. +
  73. # Check for enable-ipv6
  74. AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
  75. AC_MSG_CHECKING([if --enable-ipv6 is specified])
  76. Index: Python-2.7.1/setup.py
  77. ===================================================================
  78. --- Python-2.7.1.orig/setup.py
  79. +++ Python-2.7.1/setup.py
  80. @@ -2073,10 +2073,11 @@
  81. import warnings
  82. warnings.filterwarnings("ignore",category=DeprecationWarning)
  83. - scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  84. - 'Lib/smtpd.py']
  85. + scripts = ['Tools/scripts/idle', 'Lib/smtpd.py']
  86. if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  87. scripts += [ 'Tools/scripts/pydoc' ]
  88. + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
  89. + scripts += [ 'Tools/scripts/2to3' ]
  90. setup(# PyPI Metadata (PEP 301)
  91. name = "Python",