board/csky: fixup gdb instructions in readme.txt
[buildroot-gz.git] / package / python3 / 0019-Add-an-option-to-disable-lib2to3.patch
blob5386fd70a31af34a49827a0a577b93ccc2f181f1
1 From a42283b5bee8bfd0a6a39e6805787643d075f1a5 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Wed, 23 Dec 2015 11:48:44 +0100
4 Subject: [PATCH] Add an option to disable lib2to3
6 lib2to3 is a library to convert Python 2.x code to Python 3.x. As
7 such, it is probably not very useful on embedded system targets.
9 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
11 ---
12 Makefile.pre.in | 16 ++++++++++++----
13 configure.ac | 6 ++++++
14 setup.py | 5 +++--
15 3 files changed, 21 insertions(+), 6 deletions(-)
17 diff --git a/Makefile.pre.in b/Makefile.pre.in
18 index 83fc343..aeedad9 100644
19 --- a/Makefile.pre.in
20 +++ b/Makefile.pre.in
21 @@ -1164,7 +1164,9 @@ ifeq (@PYDOC@,yes)
22 (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
23 endif
24 -rm -f $(DESTDIR)$(BINDIR)/2to3
25 +ifeq (@LIB2TO3@,yes)
26 (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
27 +endif
28 -rm -f $(DESTDIR)$(BINDIR)/pyvenv
29 (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv)
30 if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
31 @@ -1203,7 +1205,6 @@ LIBSUBDIRS= tkinter \
32 html json http dbm xmlrpc \
33 sqlite3 \
34 logging csv wsgiref urllib \
35 - lib2to3 lib2to3/fixes lib2to3/pgen2 \
36 ctypes ctypes/macholib \
37 idlelib idlelib/Icons \
38 distutils distutils/command $(XMLLIBSUBDIRS) \
39 @@ -1250,9 +1251,6 @@ TESTSUBDIRS = tkinter/test tkinter/test/test_tkinter tkinter/test/test_ttk \
40 test/test_importlib/namespace_pkgs/module_and_namespace_package \
41 test/test_importlib/namespace_pkgs/module_and_namespace_package/a_test \
42 sqlite3/test \
43 - lib2to3/tests \
44 - lib2to3/tests/data lib2to3/tests/data/fixers \
45 - lib2to3/tests/data/fixers/myfixes \
46 ctypes/test \
47 idlelib/idle_test \
48 distutils/tests \
49 @@ -1265,6 +1263,14 @@ ifeq (@PYDOC@,yes)
50 LIBSUBDIRS += pydoc_data
51 endif
53 +ifeq (@LIB2TO3@,yes)
54 +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
55 +TESTSUBDIRS += lib2to3/tests \
56 + lib2to3/tests/data \
57 + lib2to3/tests/data/fixers \
58 + lib2to3/tests/data/fixers/myfixes
59 +endif
61 ifeq (@TEST_MODULES@,yes)
62 LIBSUBDIRS += $(TESTSUBDIRS)
63 endif
64 @@ -1363,10 +1369,12 @@ ifeq (@PYC_BUILD@,yes)
65 -d $(LIBDEST)/site-packages -f \
66 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
67 endif
68 +ifeq (@LIB2TO3@,yes)
69 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
70 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
71 -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
72 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
73 +endif
75 # Create the PLATDIR source directory, if one wasn't distributed..
76 $(srcdir)/Lib/$(PLATDIR):
77 diff --git a/configure.ac b/configure.ac
78 index eea25d4..32239d3 100644
79 --- a/configure.ac
80 +++ b/configure.ac
81 @@ -2988,6 +2988,12 @@ AC_ARG_ENABLE(test-modules,
82 AS_HELP_STRING([--disable-test-modules], [disable test modules]),
83 [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
85 +AC_SUBST(LIB2TO3)
87 +AC_ARG_ENABLE(lib2to3,
88 + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
89 + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
91 # Check for enable-ipv6
92 AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
93 AC_MSG_CHECKING([if --enable-ipv6 is specified])
94 diff --git a/setup.py b/setup.py
95 index 2a01896..be27531 100644
96 --- a/setup.py
97 +++ b/setup.py
98 @@ -2254,10 +2254,11 @@ def main():
99 import warnings
100 warnings.filterwarnings("ignore",category=DeprecationWarning)
102 - scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
103 - 'Lib/smtpd.py']
104 + scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
105 if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
106 scripts += [ 'Tools/scripts/pydoc3' ]
107 + if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
108 + scripts += [ 'Tools/scripts/2to3' ]
110 setup(# PyPI Metadata (PEP 301)
111 name = "Python",
113 2.7.4