102-optional-2to3.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  6. ---
  7. Makefile.pre.in | 24 +++++++++++++++++-------
  8. configure.in | 6 ++++++
  9. setup.py | 5 +++--
  10. 3 files changed, 26 insertions(+), 9 deletions(-)
  11. Index: b/Makefile.pre.in
  12. ===================================================================
  13. --- a/Makefile.pre.in
  14. +++ b/Makefile.pre.in
  15. @@ -967,7 +967,6 @@
  16. json \
  17. sqlite3 \
  18. logging bsddb csv importlib wsgiref \
  19. - lib2to3 lib2to3/fixes lib2to3/pgen2 \
  20. ctypes ctypes/macholib \
  21. idlelib idlelib/Icons \
  22. distutils distutils/command $(XMLLIBSUBDIRS) \
  23. @@ -986,8 +985,6 @@
  24. json/tests \
  25. sqlite3/test \
  26. bsddb/test \
  27. - lib2to3/tests \
  28. - lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
  29. ctypes/test \
  30. idlelib/idle_test \
  31. distutils/tests \
  32. @@ -1001,6 +998,14 @@
  33. LIBSUBDIRS += pydoc_data
  34. endif
  35. +ifeq (@LIB2TO3@,yes)
  36. +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
  37. +TESTSUBDIRS += lib2to3/tests \
  38. + lib2to3/tests/data \
  39. + lib2to3/tests/data/fixers \
  40. + lib2to3/tests/data/fixers/myfixes
  41. +endif
  42. +
  43. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  44. @for i in $(SCRIPTDIR) $(LIBDEST); \
  45. do \
  46. Index: b/configure.ac
  47. ===================================================================
  48. --- a/configure.ac
  49. +++ b/configure.ac
  50. @@ -2645,6 +2645,12 @@
  51. AS_HELP_STRING([--disable-test-modules], [disable test modules]),
  52. [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
  53. +AC_SUBST(LIB2TO3)
  54. +
  55. +AC_ARG_ENABLE(lib2to3,
  56. + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
  57. + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
  58. +
  59. # Check for enable-ipv6
  60. AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
  61. AC_MSG_CHECKING([if --enable-ipv6 is specified])
  62. Index: b/setup.py
  63. ===================================================================
  64. --- a/setup.py
  65. +++ b/setup.py
  66. @@ -2212,10 +2212,11 @@
  67. import warnings
  68. warnings.filterwarnings("ignore",category=DeprecationWarning)
  69. - scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  70. - 'Lib/smtpd.py']
  71. + scripts = ['Tools/scripts/idle', 'Lib/smtpd.py']
  72. if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  73. scripts += [ 'Tools/scripts/pydoc' ]
  74. + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
  75. + scripts += [ 'Tools/scripts/2to3' ]
  76. setup(# PyPI Metadata (PEP 301)
  77. name = "Python",