123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114 |
- From 2a4b87bb00805156d40782a3197fbbf20937da6f Mon Sep 17 00:00:00 2001
- From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
- Date: Wed, 22 Feb 2017 17:15:31 -0800
- Subject: [PATCH] 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 <thomas.petazzoni@free-electrons.com>
- Signed-off-by: Samuel Martin <s.martin49@gmail.com>
- [ Andrey Smirnov: ported to Python 3.6 ]
- Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
- [ Adam Duskett: ported to Python 3.10.0 ]
- Signed-off-by: Adam Duskett <aduskett@gmail.com>
- [ Bernd Kuhls: ported to Python 3.11.4]
- Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de>
- [ Adam Duskett: ported to Python 3.12.1 ]
- Signed-off-by: Adam Duskett <adam.duskett@amarulasolutions.com>
- ---
- Makefile.pre.in | 19 ++++++++++++++-----
- configure.ac | 6 ++++++
- 2 files changed, 20 insertions(+), 5 deletions(-)
- diff --git a/Makefile.pre.in b/Makefile.pre.in
- index 401d130b804..b44ad736144 100644
- --- a/Makefile.pre.in
- +++ b/Makefile.pre.in
- @@ -2054,7 +2054,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
- if test "x$(LIPO_32BIT_FLAGS)" != "x" ; then \
- rm -f $(DESTDIR)$(BINDIR)/python3-32$(EXE); \
- (cd $(DESTDIR)$(BINDIR); $(LN) -s python$(VERSION)-32$(EXE) python3-32$(EXE)) \
- @@ -2101,7 +2103,6 @@ LIBSUBDIRS= asyncio \
- idlelib idlelib/Icons \
- importlib importlib/resources importlib/metadata \
- json \
- - lib2to3 lib2to3/fixes lib2to3/pgen2 \
- logging \
- multiprocessing multiprocessing/dummy \
- re \
- @@ -2208,10 +2209,6 @@ TESTSUBDIRS= idlelib/idle_test \
- test/test_importlib/resources/zipdata02 \
- test/test_importlib/source \
- test/test_json \
- - test/test_lib2to3 \
- - test/test_lib2to3/data \
- - test/test_lib2to3/data/fixers \
- - test/test_lib2to3/data/fixers/myfixes \
- test/test_module \
- test/test_peg_generator \
- test/test_pydoc \
- @@ -2268,6 +2265,14 @@ ifeq (@PYDOC@,yes)
- LIBSUBDIRS += pydoc_data
- endif
-
- +ifeq (@LIB2TO3@,yes)
- +LIBSUBDIRS += lib2to3 lib2to3/fixes lib2to3/pgen2
- +TESTSUBDIRS += test/test_lib2to3 \
- + test/test_lib2to3/data \
- + test/test_lib2to3/data/fixers \
- + test/test_lib2to3/data/fixers/myfixes
- +endif
- +
- TEST_MODULES=@TEST_MODULES@
-
- .PHONY: libinstall
- @@ -2351,10 +2356,12 @@ ifeq (@PYC_BUILD@,yes)
- -o 0 -o 1 -o 2 $(COMPILEALL_OPTS) -d $(LIBDEST)/site-packages -f \
- -x badsyntax $(DESTDIR)$(LIBDEST)/site-packages
- endif
- +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
-
- # bpo-21536: Misc/python-config.sh is generated in the build directory
- # from $(srcdir)Misc/python-config.sh.in.
- @@ -2480,7 +2487,9 @@ libainstall: all scripts
- $(INSTALL_SCRIPT) $(srcdir)/install-sh $(DESTDIR)$(LIBPL)/install-sh
- $(INSTALL_SCRIPT) python-config.py $(DESTDIR)$(LIBPL)/python-config.py
- $(INSTALL_SCRIPT) python-config $(DESTDIR)$(BINDIR)/python$(LDVERSION)-config
- +ifeq (@LIB2TO3@,yes)
- $(INSTALL_SCRIPT) $(SCRIPT_2TO3) $(DESTDIR)$(BINDIR)/2to3-$(VERSION)
- +endif
- $(INSTALL_SCRIPT) $(SCRIPT_IDLE) $(DESTDIR)$(BINDIR)/idle$(VERSION)
- ifeq (@PYDOC@,yes)
- $(INSTALL_SCRIPT) $(SCRIPT_PYDOC) $(DESTDIR)$(BINDIR)/pydoc$(VERSION)
- diff --git a/configure.ac b/configure.ac
- index ca226dcc5b9..9b77582560d 100644
- --- a/configure.ac
- +++ b/configure.ac
- @@ -7572,6 +7572,12 @@ PY_STDLIB_MOD([xxlimited_35], [test "$with_trace_refs" = "no"], [test "$ac_cv_fu
- # substitute multiline block, must come after last PY_STDLIB_MOD()
- AC_SUBST([MODULE_BLOCK])
-
- +AC_SUBST(LIB2TO3)
- +
- +AC_ARG_ENABLE(lib2to3,
- + AS_HELP_STRING([--disable-lib2to3], [disable lib2to3]),
- + [ LIB2TO3="${enableval}" ], [ LIB2TO3=yes ])
- +
- # generate output files
- AC_CONFIG_FILES(m4_normalize([
- Makefile.pre
- --
- 2.39.5
|