2017-03-23 16:21:12 +01:00
|
|
|
From a60b0237cb8eb1899b5c4dcf71527437e79972c9 Mon Sep 17 00:00:00 2001
|
2016-01-04 19:23:28 +01:00
|
|
|
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
2017-03-23 16:21:12 +01:00
|
|
|
Date: Wed, 22 Feb 2017 17:15:31 -0800
|
2016-01-04 19:23:28 +01:00
|
|
|
Subject: [PATCH] Add an option to disable lib2to3
|
2013-05-29 10:36:57 +02:00
|
|
|
|
|
|
|
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 <thomas.petazzoni@free-electrons.com>
|
|
|
|
Signed-off-by: Samuel Martin <s.martin49@gmail.com>
|
2017-03-23 16:21:12 +01:00
|
|
|
[ Andrey Smirnov: ported to Python 3.6 ]
|
|
|
|
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
|
2013-05-29 10:36:57 +02:00
|
|
|
---
|
2016-01-04 19:23:28 +01:00
|
|
|
Makefile.pre.in | 16 ++++++++++++----
|
|
|
|
configure.ac | 6 ++++++
|
|
|
|
setup.py | 5 +++--
|
|
|
|
3 files changed, 21 insertions(+), 6 deletions(-)
|
2013-05-29 10:36:57 +02:00
|
|
|
|
2016-01-04 19:23:28 +01:00
|
|
|
diff --git a/Makefile.pre.in b/Makefile.pre.in
|
2017-03-23 16:21:12 +01:00
|
|
|
index 92315f2..8e67c91 100644
|
2014-02-18 21:40:01 +01:00
|
|
|
--- a/Makefile.pre.in
|
|
|
|
+++ b/Makefile.pre.in
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -1165,7 +1165,9 @@ ifeq (@PYDOC@,yes)
|
2013-05-29 10:36:57 +02:00
|
|
|
(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)
|
2014-02-18 21:40:01 +01:00
|
|
|
if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -1202,7 +1204,6 @@ LIBSUBDIRS= tkinter site-packages \
|
2013-05-29 10:36:57 +02:00
|
|
|
html json http dbm xmlrpc \
|
|
|
|
sqlite3 \
|
|
|
|
logging csv wsgiref urllib \
|
|
|
|
- lib2to3 lib2to3/fixes lib2to3/pgen2 \
|
2014-02-18 21:40:01 +01:00
|
|
|
ctypes ctypes/macholib \
|
|
|
|
idlelib idlelib/Icons \
|
2013-05-29 10:36:57 +02:00
|
|
|
distutils distutils/command $(XMLLIBSUBDIRS) \
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -1252,9 +1253,6 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
|
|
|
|
test/test_email test/test_email/data \
|
|
|
|
test/test_json \
|
2014-07-08 12:42:39 +02:00
|
|
|
sqlite3/test \
|
2013-05-29 10:36:57 +02:00
|
|
|
- lib2to3/tests \
|
|
|
|
- lib2to3/tests/data lib2to3/tests/data/fixers \
|
|
|
|
- lib2to3/tests/data/fixers/myfixes \
|
2014-07-08 12:42:39 +02:00
|
|
|
ctypes/test \
|
|
|
|
idlelib/idle_test \
|
|
|
|
distutils/tests \
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -1264,6 +1262,14 @@ TESTSUBDIRS= tkinter/test tkinter/test/test_tkinter \
|
|
|
|
test/test_tools test/test_warnings test/test_warnings/data \
|
|
|
|
unittest/test unittest/test/testmock
|
2013-05-29 10:36:57 +02:00
|
|
|
|
|
|
|
+ifeq (@LIB2TO3@,yes)
|
|
|
|
+LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
|
2014-02-18 21:40:01 +01:00
|
|
|
+TESTSUBDIRS += lib2to3/tests \
|
|
|
|
+ lib2to3/tests/data \
|
|
|
|
+ lib2to3/tests/data/fixers \
|
|
|
|
+ lib2to3/tests/data/fixers/myfixes
|
2013-05-29 10:36:57 +02:00
|
|
|
+endif
|
|
|
|
+
|
2014-02-18 21:40:01 +01:00
|
|
|
ifeq (@TEST_MODULES@,yes)
|
|
|
|
LIBSUBDIRS += $(TESTSUBDIRS)
|
|
|
|
endif
|
2017-03-08 00:00:29 +01:00
|
|
|
@@ -1363,10 +1369,12 @@ ifeq (@PYC_BUILD@,yes)
|
2016-01-04 19:23:28 +01:00
|
|
|
-d $(LIBDEST)/site-packages -f \
|
2013-05-29 10:36:57 +02:00
|
|
|
-x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
|
2014-02-18 21:40:01 +01:00
|
|
|
endif
|
2013-05-29 10:36:57 +02:00
|
|
|
+ifeq (@LIB2TO3@,yes)
|
|
|
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
|
|
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
|
|
|
|
-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
|
|
|
|
$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
|
|
|
|
+endif
|
|
|
|
|
2017-03-23 16:21:12 +01:00
|
|
|
python-config: $(srcdir)/Misc/python-config.in Misc/python-config.sh
|
|
|
|
# Substitution happens here, as the completely-expanded BINDIR
|
2016-01-04 19:23:28 +01:00
|
|
|
diff --git a/configure.ac b/configure.ac
|
2017-03-23 16:21:12 +01:00
|
|
|
index 654594a..b518cbe 100644
|
2016-01-04 19:23:28 +01:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -3093,6 +3093,12 @@ AC_ARG_ENABLE(test-modules,
|
2016-01-04 19:23:28 +01:00
|
|
|
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
|
2017-03-23 16:21:12 +01:00
|
|
|
index 26bf414..80ec79b 100644
|
2014-02-18 21:40:01 +01:00
|
|
|
--- a/setup.py
|
|
|
|
+++ b/setup.py
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -2279,10 +2279,11 @@ def main():
|
2013-05-29 10:36:57 +02:00
|
|
|
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",
|
2016-01-04 19:23:28 +01:00
|
|
|
--
|
2017-03-23 16:21:12 +01:00
|
|
|
2.9.3
|
2016-01-04 19:23:28 +01:00
|
|
|
|