python-werkzeug: bump to version 0.11.15
[buildroot-gz.git] / package / python3 / 0019-Add-an-option-to-disable-lib2to3.patch
blobf0d4770135ec20fff6f3c2fe5f8da7cba6c96755
1 From 3c877ea9f09913586f87064b7a2b9d2b49cb05aa 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 a98ad65..3823940 100644
19 --- a/Makefile.pre.in
20 +++ b/Makefile.pre.in
21 @@ -1138,7 +1138,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 @@ -1177,7 +1179,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 @@ -1224,9 +1225,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 @@ -1239,6 +1237,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 @@ -1337,10 +1343,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 e9b6d6f..652ad88 100644
79 --- a/configure.ac
80 +++ b/configure.ac
81 @@ -2906,6 +2906,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 137911d..722308b 100644
96 --- a/setup.py
97 +++ b/setup.py
98 @@ -2221,10 +2221,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.6.4