]> rtime.felk.cvut.cz Git - coffee/buildroot.git/blob - package/python3/0015-Add-an-option-to-disable-lib2to3.patch
Revert "python3: bump to 2.6.4"
[coffee/buildroot.git] / package / python3 / 0015-Add-an-option-to-disable-lib2to3.patch
1 From c2d279b4a19de7a32e8a73e320423f699d408380 Mon Sep 17 00:00:00 2001
2 From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
3 Date: Wed, 22 Feb 2017 17:15:31 -0800
4 Subject: [PATCH] Add an option to disable lib2to3
5
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.
8
9 Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
10 Signed-off-by: Samuel Martin <s.martin49@gmail.com>
11 [ Andrey Smirnov: ported to Python 3.6 ]
12 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
13 ---
14  Makefile.pre.in | 16 ++++++++++++----
15  configure.ac    |  6 ++++++
16  setup.py        |  5 +++--
17  3 files changed, 21 insertions(+), 6 deletions(-)
18
19 diff --git a/Makefile.pre.in b/Makefile.pre.in
20 index badb2af35d..931cc3ed07 100644
21 --- a/Makefile.pre.in
22 +++ b/Makefile.pre.in
23 @@ -1168,7 +1168,9 @@ ifeq (@PYDOC@,yes)
24         (cd $(DESTDIR)$(BINDIR); $(LN) -s pydoc$(VERSION) pydoc3)
25  endif
26         -rm -f $(DESTDIR)$(BINDIR)/2to3
27 +ifeq (@LIB2TO3@,yes)
28         (cd $(DESTDIR)$(BINDIR); $(LN) -s 2to3-$(VERSION) 2to3)
29 +endif
30         -rm -f $(DESTDIR)$(BINDIR)/pyvenv
31         (cd $(DESTDIR)$(BINDIR); $(LN) -s pyvenv-$(VERSION) pyvenv)
32         if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
33 @@ -1205,7 +1207,6 @@ LIBSUBDIRS=       tkinter site-packages \
34                 html json http dbm xmlrpc \
35                 sqlite3 \
36                 logging csv wsgiref urllib \
37 -               lib2to3 lib2to3/fixes lib2to3/pgen2 \
38                 ctypes ctypes/macholib \
39                 idlelib idlelib/Icons \
40                 distutils distutils/command $(XMLLIBSUBDIRS) \
41 @@ -1255,9 +1256,6 @@ TESTSUBDIRS=      tkinter/test tkinter/test/test_tkinter \
42                 test/test_email test/test_email/data \
43                 test/test_json \
44                 sqlite3/test \
45 -               lib2to3/tests \
46 -               lib2to3/tests/data lib2to3/tests/data/fixers \
47 -               lib2to3/tests/data/fixers/myfixes \
48                 ctypes/test \
49                 idlelib/idle_test \
50                 distutils/tests \
51 @@ -1267,6 +1265,14 @@ TESTSUBDIRS=     tkinter/test tkinter/test/test_tkinter \
52                 test/test_tools test/test_warnings test/test_warnings/data \
53                 unittest/test unittest/test/testmock
54  
55 +ifeq (@LIB2TO3@,yes)
56 +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
57 +TESTSUBDIRS += lib2to3/tests                   \
58 +       lib2to3/tests/data                      \
59 +       lib2to3/tests/data/fixers               \
60 +       lib2to3/tests/data/fixers/myfixes
61 +endif
62 +
63  ifeq (@TEST_MODULES@,yes)
64  LIBSUBDIRS += $(TESTSUBDIRS)
65  endif
66 @@ -1366,10 +1372,12 @@ ifeq (@PYC_BUILD@,yes)
67                 -d $(LIBDEST)/site-packages -f \
68                 -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
69  endif
70 +ifeq (@LIB2TO3@,yes)
71         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
72                 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
73         -PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
74                 $(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
75 +endif
76  
77  python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
78         # Substitution happens here, as the completely-expanded BINDIR
79 diff --git a/configure.ac b/configure.ac
80 index 1621fa1611..13b2edf8b7 100644
81 --- a/configure.ac
82 +++ b/configure.ac
83 @@ -3124,6 +3124,12 @@ AC_ARG_ENABLE(test-modules,
84         AS_HELP_STRING([--disable-test-modules], [disable test modules]),
85         [ TEST_MODULES="${enableval}" ], [ TEST_MODULES=yes ])
86  
87 +AC_SUBST(LIB2TO3)
88 +
89 +AC_ARG_ENABLE(lib2to3,
90 +       AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
91 +       [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
92 +
93  # Check for enable-ipv6
94  AH_TEMPLATE(ENABLE_IPV6, [Define if --enable-ipv6 is specified])
95  AC_MSG_CHECKING([if --enable-ipv6 is specified])
96 diff --git a/setup.py b/setup.py
97 index 94dd337fef..76429e1326 100644
98 --- a/setup.py
99 +++ b/setup.py
100 @@ -2282,10 +2282,11 @@ def main():
101      import warnings
102      warnings.filterwarnings("ignore",category=DeprecationWarning)
103  
104 -    scripts = ['Tools/scripts/idle3', 'Tools/scripts/2to3',
105 -               'Lib/smtpd.py']
106 +    scripts = ['Tools/scripts/idle3', 'Lib/smtpd.py']
107      if not '--disable-pydoc' in sysconfig.get_config_var("CONFIG_ARGS"):
108          scripts += [ 'Tools/scripts/pydoc3' ]
109 +    if not '--disable-lib2to3' in sysconfig.get_config_var("CONFIG_ARGS"):
110 +        scripts += [ 'Tools/scripts/2to3' ]
111  
112      setup(# PyPI Metadata (PEP 301)
113            name = "Python",
114 -- 
115 2.13.5
116