2
1

0018-Add-an-option-to-disable-lib2to3.patch 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. From d7f419246681e12f05e2eefc79286959c6aa18ab Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  3. Date: Tue, 7 Mar 2017 22:27:49 +0100
  4. Subject: [PATCH] Add an option to disable lib2to3
  5. lib2to3 is a library to convert Python 2.x code to Python 3.x. As
  6. such, it is probably not very useful on embedded system targets.
  7. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
  8. Signed-off-by: Samuel Martin <s.martin49@gmail.com>
  9. [Peter: update for 2.7.16]
  10. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  11. ---
  12. Makefile.pre.in | 11 ++++++++---
  13. configure.ac | 6 ++++++
  14. setup.py | 5 +++--
  15. 3 files changed, 17 insertions(+), 5 deletions(-)
  16. diff --git a/Makefile.pre.in b/Makefile.pre.in
  17. index d3ba1aeb4e..0e15b6d6f4 100644
  18. --- a/Makefile.pre.in
  19. +++ b/Makefile.pre.in
  20. @@ -1055,7 +1055,6 @@ LIBSUBDIRS= lib-tk site-packages \
  21. json \
  22. sqlite3 \
  23. logging bsddb csv importlib wsgiref \
  24. - lib2to3 lib2to3/fixes lib2to3/pgen2 \
  25. ctypes ctypes/macholib \
  26. idlelib idlelib/Icons \
  27. distutils distutils/command $(XMLLIBSUBDIRS) \
  28. @@ -1075,8 +1074,6 @@ TESTSUBDIRS = lib-tk/test lib-tk/test/test_tkinter \
  29. json/tests \
  30. sqlite3/test \
  31. bsddb/test \
  32. - lib2to3/tests \
  33. - lib2to3/tests/data lib2to3/tests/data/fixers lib2to3/tests/data/fixers/myfixes \
  34. ctypes/test \
  35. idlelib/idle_test \
  36. distutils/tests \
  37. @@ -1090,6 +1087,14 @@ ifeq (@PYDOC@,yes)
  38. LIBSUBDIRS += pydoc_data
  39. endif
  40. +ifeq (@LIB2TO3@,yes)
  41. +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
  42. +TESTSUBDIRS += lib2to3/tests \
  43. + lib2to3/tests/data \
  44. + lib2to3/tests/data/fixers \
  45. + lib2to3/tests/data/fixers/myfixes
  46. +endif
  47. +
  48. libinstall: build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
  49. @for i in $(SCRIPTDIR) $(LIBDEST); \
  50. do \
  51. diff --git a/configure.ac b/configure.ac
  52. index 2ed4119478..a2810ab8ed 100644
  53. --- a/configure.ac
  54. +++ b/configure.ac
  55. @@ -2846,6 +2846,12 @@ AC_ARG_ENABLE(test-modules,
  56. AS_HELP_STRING([--disable-test-modules], [disable test modules]),
  57. [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
  58. +AC_SUBST(LIB2TO3)
  59. +
  60. +AC_ARG_ENABLE(lib2to3,
  61. + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
  62. + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
  63. +
  64. # Check for enable-ipv6
  65. AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
  66. AC_MSG_CHECKING([if --enable-ipv6 is specified])
  67. diff --git a/setup.py b/setup.py
  68. index 49f810f72e..9130819454 100644
  69. --- a/setup.py
  70. +++ b/setup.py
  71. @@ -2278,10 +2278,11 @@ def main():
  72. import warnings
  73. warnings.filterwarnings("ignore",category=DeprecationWarning)
  74. - scripts = ['Tools/scripts/idle', 'Tools/scripts/2to3',
  75. - 'Lib/smtpd.py']
  76. + scripts = ['Tools/scripts/idle', 'Lib/smtpd.py']
  77. if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
  78. scripts += [ 'Tools/scripts/pydoc' ]
  79. + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
  80. + scripts += [ 'Tools/scripts/2to3' ]
  81. setup(# PyPI Metadata (PEP 301)
  82. name = "Python",
  83. --
  84. 2.11.0