summaryrefslogtreecommitdiff
path: root/package/pkg-python.mk
diff options
context:
space:
mode:
authorYegor Yefremov <yegorslists@googlemail.com>2016-05-17 23:19:15 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2016-05-26 22:07:35 +0200
commit549bbba67f5c1656f566b08911aa553e57dc3f59 (patch)
tree4297ccc23bcc264d42ddefe6279c406fb14ae27d /package/pkg-python.mk
parent4cf16166c0fd14cafb89a8c2452fe1f21bca1d8c (diff)
python/python3: globalize *.pyc files compilation
Currently, each python package (be it the python interpreter package itself or external python modules) is responsible for compiling its .py into .pyc files. Unfortunately, this is not ideal as some packages only install .py files without compiling them into .pyc files. In this case, if the Buildroot configuration specifies to keep only the .pyc files, the .py files are removed and lost. To address this, this commit changes the logic by making the compilation of .pyc files a global operation: the python interpreter packages register a target finalize hook that is in charge of compiling all installed .py files. The *.pyc generation on a per package basis is disabled in the python-package infrastructure by passing the "--no-compile" option to setup.py. The *.pyc generation for the Python interpreter internal modules is disabled through --disable-pyc-build configure option. A small helper script is used to perform the compilation, the purpose of this script is to abort the compilation process if one of the .py file cannot be compiled. It has been provided by Samuel Martin and integrated into this commit. Signed-off-by: Yegor Yefremov <yegorslists@googlemail.com> Cc: Samuel Martin <s.martin49@gmail.com> [Thomas: - rework for python 3.5 - integrate Samuel proposal that allows to detect compilation failures.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Reviewed-by: Samuel Martin <s.martin49@gmail.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/pkg-python.mk')
-rw-r--r--package/pkg-python.mk2
1 files changed, 1 insertions, 1 deletions
diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index b7a702d0f..9725d24f9 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -253,7 +253,7 @@ ifndef $(2)_INSTALL_TARGET_CMDS
define $(2)_INSTALL_TARGET_CMDS
(cd $$($$(PKG)_BUILDDIR)/; \
$$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \
- $$($(2)_PYTHON_INTERPRETER) setup.py install \
+ $$($(2)_PYTHON_INTERPRETER) setup.py install --no-compile \
$$($$(PKG)_BASE_INSTALL_TARGET_OPTS) \
$$($$(PKG)_INSTALL_TARGET_OPTS))
endef