From c3810c131761922ae8c046840c78430c4125f16e Mon Sep 17 00:00:00 2001 From: "Arnout Vandecappelle (Essensium/Mind)" Date: Wed, 16 Feb 2022 21:32:58 +0100 Subject: [PATCH] package/pkg-python.mk: refactor build/install opts The python package infrastructure defines a number of helper variables that are used to construct the build and install commands. However, there are still a few parts (setup.py and its argument) that are set explicitly in _BUILD_CMDS and _INSTALL_CMDS. This creates problems if we want to add another setup type that does not use setup.py. Therefore, move the setup.py part into the helper variables as well. Since this means that the variable becomes a full command rather than just options, rename them to _BUILD_CMD and _INSTALL_CMD. While we're at it, also clean up the whitespace in the definition of these variables. They were aligned on = at some point, but that alignment was already broken. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- package/pkg-python.mk | 45 ++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 22 deletions(-) diff --git a/package/pkg-python.mk b/package/pkg-python.mk index 02df061a19..61f0dd6ec2 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -130,27 +130,27 @@ endif # Distutils ifeq ($$($(2)_SETUP_TYPE),distutils) ifeq ($(4),target) -$(2)_BASE_ENV = $$(PKG_PYTHON_DISTUTILS_ENV) -$(2)_BASE_BUILD_TGT = build -$(2)_BASE_BUILD_OPTS = $$(PKG_PYTHON_DISTUTILS_BUILD_OPTS) -$(2)_BASE_INSTALL_TARGET_OPTS = $$(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS) -$(2)_BASE_INSTALL_STAGING_OPTS = $$(PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS) +$(2)_BASE_ENV = $$(PKG_PYTHON_DISTUTILS_ENV) +$(2)_BASE_BUILD_CMD = setup.py build +$(2)_BASE_BUILD_OPTS = $$(PKG_PYTHON_DISTUTILS_BUILD_OPTS) +$(2)_BASE_INSTALL_TARGET_CMD = setup.py install --no-compile $$(PKG_PYTHON_DISTUTILS_INSTALL_TARGET_OPTS) +$(2)_BASE_INSTALL_STAGING_CMD = setup.py install $$(PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS) else $(2)_BASE_ENV = $$(HOST_PKG_PYTHON_DISTUTILS_ENV) -$(2)_BASE_BUILD_TGT = build -$(2)_BASE_INSTALL_OPTS = $$(HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS) +$(2)_BASE_BUILD_CMD = setup.py build +$(2)_BASE_INSTALL_CMD = setup.py install $$(HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS) endif # Setuptools else ifeq ($$($(2)_SETUP_TYPE),setuptools) ifeq ($(4),target) -$(2)_BASE_ENV = $$(PKG_PYTHON_SETUPTOOLS_ENV) -$(2)_BASE_BUILD_TGT = build -$(2)_BASE_INSTALL_TARGET_OPTS = $$(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS) -$(2)_BASE_INSTALL_STAGING_OPTS = $$(PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS) +$(2)_BASE_ENV = $$(PKG_PYTHON_SETUPTOOLS_ENV) +$(2)_BASE_BUILD_CMD = setup.py build +$(2)_BASE_INSTALL_TARGET_CMD = setup.py install --no-compile $$(PKG_PYTHON_SETUPTOOLS_INSTALL_TARGET_OPTS) +$(2)_BASE_INSTALL_STAGING_CMD = setup.py install $$(PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS) else -$(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV) -$(2)_BASE_BUILD_TGT = build -$(2)_BASE_INSTALL_OPTS = $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS) +$(2)_BASE_ENV = $$(HOST_PKG_PYTHON_SETUPTOOLS_ENV) +$(2)_BASE_BUILD_CMD = setup.py build +$(2)_BASE_INSTALL_CMD = setup.py install $$(HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS) endif else $$(error "Invalid $(2)_SETUP_TYPE. Valid options are 'distutils' or 'setuptools'") @@ -186,8 +186,8 @@ ifndef $(2)_BUILD_CMDS define $(2)_BUILD_CMDS (cd $$($$(PKG)_BUILDDIR)/; \ $$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \ - $$($(2)_PYTHON_INTERPRETER) setup.py \ - $$($$(PKG)_BASE_BUILD_TGT) \ + $$($(2)_PYTHON_INTERPRETER) \ + $$($$(PKG)_BASE_BUILD_CMD) \ $$($$(PKG)_BASE_BUILD_OPTS) $$($$(PKG)_BUILD_OPTS)) endef endif @@ -200,8 +200,9 @@ ifndef $(2)_INSTALL_CMDS define $(2)_INSTALL_CMDS (cd $$($$(PKG)_BUILDDIR)/; \ $$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \ - $$($(2)_PYTHON_INTERPRETER) setup.py install \ - $$($$(PKG)_BASE_INSTALL_OPTS) $$($$(PKG)_INSTALL_OPTS)) + $$($(2)_PYTHON_INTERPRETER) \ + $$($$(PKG)_BASE_INSTALL_CMD) \ + $$($$(PKG)_INSTALL_OPTS)) endef endif @@ -213,8 +214,8 @@ ifndef $(2)_INSTALL_TARGET_CMDS define $(2)_INSTALL_TARGET_CMDS (cd $$($$(PKG)_BUILDDIR)/; \ $$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \ - $$($(2)_PYTHON_INTERPRETER) setup.py install --no-compile \ - $$($$(PKG)_BASE_INSTALL_TARGET_OPTS) \ + $$($(2)_PYTHON_INTERPRETER) \ + $$($$(PKG)_BASE_INSTALL_TARGET_CMD) \ $$($$(PKG)_INSTALL_TARGET_OPTS)) endef endif @@ -227,8 +228,8 @@ ifndef $(2)_INSTALL_STAGING_CMDS define $(2)_INSTALL_STAGING_CMDS (cd $$($$(PKG)_BUILDDIR)/; \ $$($$(PKG)_BASE_ENV) $$($$(PKG)_ENV) \ - $$($(2)_PYTHON_INTERPRETER) setup.py install \ - $$($$(PKG)_BASE_INSTALL_STAGING_OPTS) \ + $$($(2)_PYTHON_INTERPRETER) \ + $$($$(PKG)_BASE_INSTALL_STAGING_CMD) \ $$($$(PKG)_INSTALL_STAGING_OPTS)) endef endif