From 72200192c4b09151823a501720b9563008b98951 Mon Sep 17 00:00:00 2001 From: Thomas Petazzoni Date: Fri, 10 Jan 2014 06:39:08 +0800 Subject: [PATCH 04/12] Add an option to disable lib2to3 lib2to3 is a library to convert Python 2.x code to Python 3.x. As such, it is probably not very useful on embedded system targets. Signed-off-by: Thomas Petazzoni Signed-off-by: Samuel Martin --- Makefile.pre.in | 14 ++++++++++---- configure.ac | 6 ++++++ setup.py | 5 +++-- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/Makefile.pre.in b/Makefile.pre.in index 005e954..1f96b0a 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -1085,7 +1085,9 @@ ifeq (@PYDOC@,yes) (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3) endif -rm -f $(DESTDIR)$(BINDIR)/2to3 +ifeq (@LIB2TO3@,yes) (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3) +endif -rm -f $(DESTDIR)$(BINDIR)/pyvenv (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv) if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \ @@ -1125,7 +1127,6 @@ LIBSUBDIRS= tkinter \ html json http dbm xmlrpc \ sqlite3 \ logging csv wsgiref urllib \ - lib2to3 lib2to3/fixes lib2to3/pgen2 \ ctypes ctypes/macholib \ idlelib idlelib/Icons \ distutils distutils/command $(XMLLIBSUBDIRS) \ @@ -1165,9 +1166,6 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \ test/namespace_pkgs/project3/parent/child \ test/namespace_pkgs/module_and_namespace_package \ test/namespace_pkgs/module_and_namespace_package/a_test \ - lib2to3/tests \ - lib2to3/tests/data lib2to3/tests/data/fixers \ - lib2to3/tests/data/fixers/myfixes \ sqlite3/test idlelib/idle_test \ test/test_importlib test/test_importlib/builtin \ test/test_importlib/extension test/test_importlib/frozen \ @@ -1179,6 +1177,14 @@ ifeq (@PYDOC@,yes) LIBSUBDIRS += pydoc_data endif +ifeq (@LIB2TO3@,yes) +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2 +TESTSUBDIRS += lib2to3/tests \ + lib2to3/tests/data \ + lib2to3/tests/data/fixers \ + lib2to3/tests/data/fixers/myfixes +endif + ifeq (@TEST_MODULES@,yes) LIBSUBDIRS += $(TESTSUBDIRS) endif diff --git a/configure.ac b/configure.ac index 7bc0f37..83dfa94 100644 --- a/configure.ac +++ b/configure.ac @@ -2649,6 +2649,12 @@ AC_ARG_ENABLE(test-modules, AS_HELP_STRING([--disable-test-modules], [disable test modules]), [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ]) +AC_SUBST(LIB2TO3) + +AC_ARG_ENABLE(lib2to3, + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]), + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ]) + # Check for enable-ipv6 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified]) AC_MSG_CHECKING([if --enable-ipv6 is specified]) diff --git a/setup.py b/setup.py index 55c45eb..929296e 100644 --- a/setup.py +++ b/setup.py @@ -2185,10 +2185,11 @@ def main(): import warnings warnings.filterwarnings("ignore",category=DeprecationWarning) - scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3', - 'Lib/smtpd.py'] + scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py'] if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"): scripts += [ 'Tools/scripts/pydoc3' ] + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"): + scripts += [ 'Tools/scripts/2to3' ] setup(# PyPI Metadata (PEP 301) name = "Python", -- 1.8.3.2