2017-09-19 00:34:41 +02:00
|
|
|
From 2c2afc80831c518e5daf3df6c9e4c4ac0a7be001 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 16:33:22 -0800
|
2016-01-04 19:23:28 +01:00
|
|
|
Subject: [PATCH] Add infrastructure to disable the build of certain extensions
|
2013-05-29 10:36:57 +02:00
|
|
|
|
|
|
|
Some of the extensions part of the Python core have dependencies on
|
|
|
|
external libraries (sqlite, tk, etc.) or are relatively big and not
|
|
|
|
necessarly always useful (CJK codecs for example). By extensions, we
|
|
|
|
mean part of Python modules that are written in C and therefore
|
|
|
|
compiled to binary code.
|
|
|
|
|
|
|
|
Therefore, we introduce a small infrastructure that allows to disable
|
|
|
|
some of those extensions. This can be done inside the configure.ac by
|
|
|
|
adding values to the DISABLED_EXTENSIONS variable (which is a
|
|
|
|
word-separated list of extensions).
|
|
|
|
|
|
|
|
The implementation works as follow :
|
|
|
|
|
|
|
|
* configure.ac defines a DISABLED_EXTENSIONS variable, which is
|
|
|
|
substituted (so that when Makefile.pre is generated from
|
|
|
|
Makefile.pre.in, the value of the variable is substituted). For
|
|
|
|
now, this DISABLED_EXTENSIONS variable is empty, later patches will
|
|
|
|
use it.
|
|
|
|
|
|
|
|
* Makefile.pre.in passes the DISABLED_EXTENSIONS value down to the
|
|
|
|
variables passed in the environment when calling the setup.py
|
|
|
|
script that actually builds and installs those extensions.
|
|
|
|
|
|
|
|
* setup.py is modified so that the existing "disabled_module_list" is
|
|
|
|
filled with those pre-disabled extensions listed in
|
|
|
|
DISABLED_EXTENSIONS.
|
|
|
|
|
|
|
|
Patch ported to python2.7 by Maxime Ripard <ripard@archos.com>, and
|
|
|
|
then extended by Thomas Petazzoni
|
|
|
|
<thomas.petazzoni@free-electrons.com>.
|
|
|
|
|
|
|
|
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.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 | 6 +++++-
|
|
|
|
configure.ac | 2 ++
|
2017-03-23 16:21:12 +01:00
|
|
|
setup.py | 6 +++++-
|
|
|
|
3 files changed, 12 insertions(+), 2 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-09-19 00:34:41 +02:00
|
|
|
index b38bd79121..4ce917ab8d 100644
|
2014-02-18 21:40:01 +01:00
|
|
|
--- a/Makefile.pre.in
|
|
|
|
+++ b/Makefile.pre.in
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
@@ -196,6 +196,8 @@ FILEMODE= 644
|
2013-05-29 10:36:57 +02:00
|
|
|
# configure script arguments
|
|
|
|
CONFIG_ARGS= @CONFIG_ARGS@
|
|
|
|
|
|
|
|
+# disabled extensions
|
|
|
|
+DISABLED_EXTENSIONS= @DISABLED_EXTENSIONS@
|
|
|
|
|
|
|
|
# Subdirectories with code
|
|
|
|
SRCDIRS= @SRCDIRS@
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
@@ -609,6 +611,7 @@ sharedmods: $(BUILDPYTHON) pybuilddir.txt Modules/_math.o
|
2014-02-18 21:40:01 +01:00
|
|
|
esac; \
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
echo "$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
2014-02-18 21:40:01 +01:00
|
|
|
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
2013-05-29 10:36:57 +02:00
|
|
|
+ DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
$(PYTHON_FOR_BUILD) $(srcdir)/setup.py $$quiet build"; \
|
|
|
|
$(RUNSHARED) CC='$(CC)' LDSHARED='$(BLDSHARED)' OPT='$(OPT)' \
|
|
|
|
_TCLTK_INCLUDES='$(TCLTK_INCLUDES)' _TCLTK_LIBS='$(TCLTK_LIBS)' \
|
|
|
|
@@ -1508,7 +1511,8 @@ libainstall: @DEF_MAKE_RULE@ python-config
|
2014-02-18 21:40:01 +01:00
|
|
|
# Install the dynamically loadable modules
|
2013-05-29 10:36:57 +02:00
|
|
|
# This goes into $(exec_prefix)
|
|
|
|
sharedinstall: sharedmods
|
2014-02-18 21:40:01 +01:00
|
|
|
- $(RUNSHARED) $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
|
|
|
+ $(RUNSHARED) DISABLED_EXTENSIONS="$(DISABLED_EXTENSIONS)" \
|
|
|
|
+ $(PYTHON_FOR_BUILD) $(srcdir)/setup.py install \
|
2013-05-29 10:36:57 +02:00
|
|
|
--prefix=$(prefix) \
|
|
|
|
--install-scripts=$(BINDIR) \
|
2014-02-18 21:40:01 +01:00
|
|
|
--install-platlib=$(DESTSHARED) \
|
2016-01-04 19:23:28 +01:00
|
|
|
diff --git a/configure.ac b/configure.ac
|
2017-09-19 00:34:41 +02:00
|
|
|
index 5f87c4db5a..d5ee2aedfb 100644
|
2014-02-18 21:40:01 +01:00
|
|
|
--- a/configure.ac
|
|
|
|
+++ b/configure.ac
|
python3: bump to 3.7.0
Other changes include:
- Refreshing all necessary patches for 3.7.0
- Add a hash for the license file.
- Python no longer has it's own internal libffi, as such, host-libffi
is now required to build host-python3, and is added as a
dependency.
- Drop PYTHON3_LIBTOOL_PATCH = NO, since there is no longer any
internal libffi copy that was causing the libtool patching process
to fail.
- A new core module "uuid" is now is added in the Config.in file, and
relies on util-linux's uuid library.
- Also, a new patch: 0030-Fix-cross-compiling-the-uuid-module.patch
is required to fix compiling the uuid module, because the include
directory search path for uuid.h is hardcoded to /usr/include/uuid,
which causes an "unsafe for cross-compilation" error during
compiling if the host pc has uuid headers installed.
- 0031-Add-an-option-to-disable-uuid-module.patch is added to allow
disabling the Python3 UUID module, so that when
BR2_PACKAGE_PYTHON3_UUID is disabled by the UUID library is
present, the uuid Python module is not built, as expected.
- 0032-fix-building-on-older-distributions.patch is added to change
os.replace by os.rename in the update_file.py script to fix
building on older Linux distributions that have older versions of
python that don't include os.replace.
os.rename acts in the same way as os.replace, but is cross-platform
compatible. Because Buildroot is guaranteed to be built in a POSIX
environment, it is safe to change replace to rename.
Tested on CentOS6 and Fedora28, All test results passed:
br-arm-full [1/6]: OK
br-arm-cortex-a9-glibc [2/6]: OK
br-arm-cortex-m4-full [3/6]: SKIPPED
br-x86-64-musl [4/6]: OK
br-arm-full-static [5/6]: SKIPPED
armv5-ctng-linux-gnueabi [6/6]: OK
6 builds, 2 skipped, 0 build failed, 0 legal-info failed
Signed-off-by: Adam Duskett <aduskett@gmail.com>
[Thomas:
- remove PYTHON3_LIBTOOL_PATCH = NO
- improve the solution in patch 0030-Fix-cross-compiling-the-uuid-module
- add patch 0031-Add-an-option-to-disable-uuid-module]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
2018-07-20 18:10:21 +02:00
|
|
|
@@ -2902,6 +2902,8 @@ LIBS="$withval $LIBS"
|
2013-05-29 10:36:57 +02:00
|
|
|
|
2015-04-26 14:26:36 +02:00
|
|
|
PKG_PROG_PKG_CONFIG
|
2013-05-29 10:36:57 +02:00
|
|
|
|
|
|
|
+AC_SUBST(DISABLED_EXTENSIONS)
|
|
|
|
+
|
|
|
|
# Check for use of the system expat library
|
|
|
|
AC_MSG_CHECKING(for --with-system-expat)
|
|
|
|
AC_ARG_WITH(system_expat,
|
2016-01-04 19:23:28 +01:00
|
|
|
diff --git a/setup.py b/setup.py
|
2017-09-19 00:34:41 +02:00
|
|
|
index fe477974bd..86643ae8bf 100644
|
2014-02-18 21:40:01 +01:00
|
|
|
--- a/setup.py
|
|
|
|
+++ b/setup.py
|
2017-03-23 16:21:12 +01:00
|
|
|
@@ -43,7 +43,11 @@ host_platform = get_platform()
|
2014-02-18 21:40:01 +01:00
|
|
|
COMPILED_WITH_PYDEBUG = ('--with-pydebug' in sysconfig.get_config_var("CONFIG_ARGS"))
|
2013-05-29 10:36:57 +02:00
|
|
|
|
|
|
|
# This global variable is used to hold the list of modules to be disabled.
|
|
|
|
-disabled_module_list = []
|
|
|
|
+try:
|
|
|
|
+ disabled_module_list = sysconfig.get_config_var("DISABLED_EXTENSIONS").split(" ")
|
|
|
|
+except KeyError:
|
|
|
|
+ disabled_module_list = list()
|
2017-03-23 16:21:12 +01:00
|
|
|
+
|
2013-05-29 10:36:57 +02:00
|
|
|
|
|
|
|
def add_dir_to_list(dirlist, dir):
|
|
|
|
"""Add the directory 'dir' to the list 'dirlist' (after any relative
|
2016-01-04 19:23:28 +01:00
|
|
|
--
|
2017-09-19 00:34:41 +02:00
|
|
|
2.13.5
|
2016-01-04 19:23:28 +01:00
|
|
|
|