python,python3: add host python pip install support
authorAlexandru Ardelean <redacted>
Wed, 19 Jul 2017 07:19:10 +0000 (10:19 +0300)
committerAlexandru Ardelean <redacted>
Wed, 19 Jul 2017 13:50:25 +0000 (16:50 +0300)
To install Python packages host side, that
may be needed for a build.

The intent, is to try to reduce host-side Python
packages being installed via LEDE/OpenWrt build system.
Because those seem like a pain to maintain.

The idea is adapted from Yousong's `python-packages`
package.

Signed-off-by: Alexandru Ardelean <redacted>
lang/python/python/files/python-host.mk
lang/python/python/files/python-package.mk
lang/python/python3/files/python3-host.mk
lang/python/python3/files/python3-package.mk

index 17e0758dd7e009dc7dd2676c5bc4e46c6e577996..f20dbdeabded81dabe2d79a71f761fda568b9b2a 100644 (file)
@@ -60,6 +60,19 @@ define Build/Compile/HostPyRunHost
        )
 endef
 
+# Note: I shamelessly copied this from Yousong's logic (from python-packages);
+HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
+define host_python_pip_install
+       $(HOST_PYTHON_PIP) install \
+               --root=$(1) \
+               --prefix=$(2) \
+               --ignore-installed \
+               $(3)
+endef
+
+define host_python_pip_install_host
+$(call host_python_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+endef
 
 # $(1) => build subdir
 # $(2) => additional arguments to setup.py
index 1b82352c1fb4d1c47487ec510c104677f951164e..9c231f6ecfa0f8c8edc74ab3baa40fd85e4b634f 100644 (file)
@@ -126,6 +126,9 @@ define Build/Compile/PyMod
 endef
 
 define PyBuild/Compile/Default
+       $(foreach pkg,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS),
+               $(call host_python_pip_install_host,$(pkg))
+       )
        $(call Build/Compile/PyMod,, \
                install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
                --single-version-externally-managed \
index 487aada30fa7a648f1ab66d95c2f612d7d5b6d48..96bbc19ccca7477d154896edebdc1891cad13b45 100644 (file)
@@ -60,6 +60,19 @@ define Build/Compile/HostPy3RunHost
        )
 endef
 
+# Note: I shamelessly copied this from Yousong's logic (from python-packages);
+HOST_PYTHON3_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON3_VERSION)
+define host_python3_pip_install
+       $(HOST_PYTHON3_PIP) install \
+               --root=$(1) \
+               --prefix=$(2) \
+               --ignore-installed \
+               $(3)
+endef
+
+define host_python3_pip_install_host
+$(call host_python3_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+endef
 
 # $(1) => build subdir
 # $(2) => additional arguments to setup.py
index 22ee527a1c126757e0cdd731ae64345ff9c82477..93b14fac23b25ade106bf2ea55ec1a2b0d362278 100644 (file)
@@ -126,6 +126,9 @@ define Build/Compile/Py3Mod
 endef
 
 define Py3Build/Compile/Default
+       $(foreach pkg,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS),
+               $(call host_python3_pip_install_host,$(pkg))
+       )
        $(call Build/Compile/Py3Mod,, \
                install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
                --single-version-externally-managed \
git clone https://git.99rst.org/PROJECT