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

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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.2/Makefile.pre.in
  11. ===================================================================
  12. --- Python-2.7.2.orig/Makefile.pre.in
  13. +++ Python-2.7.2/Makefile.pre.in
  14. @@ -862,7 +862,6 @@
  15. json \
  16. sqlite3 \
  17. logging bsddb csv importlib wsgiref \
  18. - lib2to3 lib2to3/fixes lib2to3/pgen2 \
  19. ctypes ctypes/macholib idlelib idlelib/Icons \
  20. distutils distutils/command $(XMLLIBSUBDIRS) \
  21. multiprocessing multiprocessing/dummy \
  22. @@ -875,8 +874,7 @@
  23. lib-tk/test/test_ttk test test/data \
  24. test/cjkencodings test/decimaltestdata test/xmltestdata test/subprocessdata \
  25. test/tracedmodules email/test email/test/data \
  26. - json/tests sqlite3/test bsddb/test lib2to3/tests \
  27. - lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
  28. + json/tests sqlite3/test bsddb/test \
  29. ctypes/test distutils/tests unittest/test
  30. endif
  31. @@ -884,6 +882,23 @@
  32. LIBSUBDIRS += pydoc_data
  33. endif
  34. +ifeq (@LIB2TO3@,yes)
  35. +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
  36. +ifeq (@TEST_MODULES@,yes)
  37. +LIBSUBDIRS += lib2to3/tests \
  38. + lib2to3/tests/data \
  39. + lib2to3/tests/data/fixers \
  40. + lib2to3/tests/data/fixers/myfixes
  41. +endif
  42. +endif
  43. +
  44. +ifeq (@SQLITE3@,yes)
  45. +LIBSUBDIRS += sqlite3
  46. +ifeq (@TEST_MODULES@,yes)
  47. +LIBSUBDIRS += sqlite3/test
  48. +endif
  49. +endif
  50. +
  51. libinstall: build_all $(srcdir)/Lib/$(PLATDIR)
  52. @for i in $(SCRIPTDIR) $(LIBDEST); \
  53. do \
  54. Index: Python-2.7.2/configure.in
  55. ===================================================================
  56. --- Python-2.7.2.orig/configure.in
  57. +++ Python-2.7.2/configure.in
  58. @@ -2419,6 +2419,12 @@
  59. AS_HELP_STRING([--disable-test-modules], [disable test modules]),
  60. [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
  61. +AC_SUBST(LIB2TO3)
  62. +
  63. +AC_ARG_ENABLE(lib2to3,
  64. + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
  65. + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
  66. +
  67. # Check for enable-ipv6
  68. AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
  69. AC_MSG_CHECKING([if --enable-ipv6 is specified])
  70. Index: Python-2.7.2/setup.py
  71. ===================================================================
  72. --- Python-2.7.2.orig/setup.py
  73. +++ Python-2.7.2/setup.py
  74. @@ -2093,10 +2093,11 @@
  75. import warnings
  76. warnings.filterwarnings("ignore",category=DeprecationWarning)
  77. - scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  78. - 'Lib/smtpd.py']
  79. + scripts = ['Tools/scripts/idle', 'Lib/smtpd.py']
  80. if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  81. scripts += [ 'Tools/scripts/pydoc' ]
  82. + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
  83. + scripts += [ 'Tools/scripts/2to3' ]
  84. setup(# PyPI Metadata (PEP 301)
  85. name = "Python",