python,python3: Update host pip[3] install functions
authorJeffery To <jeffery.to@gmail.com>
Wed, 29 May 2019 13:45:16 +0000 (21:45 +0800)
committerJeffery To <jeffery.to@gmail.com>
Wed, 29 May 2019 13:45:16 +0000 (21:45 +0800)
* Add --cache-dir option to set the pip cache to a directory in
$(DL_DIR), instead of pip's default (build user's ~/.cache/pip),
fixes #9066

* Add --disable-pip-version-check option, since the version check only
prints a message saying a new version is available

* Combine host_python_pip_install and host_python_pip_install_host into
Build/Compile/HostPy[3]PipInstall

* Remove --root and --prefix options, since this function is only used
to install packages to host Python's default site-packages directory
(setting these may serve to confuse pip)

* Pass all of $(HOST_PYTHON[3]_PACKAGE_BUILD_DEPENDS) to the function,
since pip can handle multiple arguments/packages

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
lang/python/python-host.mk
lang/python/python-package.mk
lang/python/python3-host.mk
lang/python/python3-package.mk

index eb58c557ef9b5b62e9208976bb016f58ae4da1ee..44ecbbf8d65c6e25a53aa3306c5016d940a04e4d 100644 (file)
@@ -71,16 +71,15 @@ 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
-       $(call host_python_settings) \
-       $(HOST_PYTHON_PIP) install \
-               --root=$(1) \
-               --prefix=$(2) \
-               $(3)
-endef
 
-define host_python_pip_install_host
-$(call host_python_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+# $(1) => packages to install
+define Build/Compile/HostPyPipInstall
+       $(call host_python_settings) \
+       $(HOST_PYTHON_PIP) \
+               --disable-pip-version-check \
+               --cache-dir "$(DL_DIR)/pip-cache" \
+               install \
+               $(1)
 endef
 
 # $(1) => build subdir
index c594f614ed34c240fe027f1da4e91eff2fe5d07c..dd3fdf75a426e45b00e4588d22423126607dfbd0 100644 (file)
@@ -121,8 +121,8 @@ PYTHON_PKG_SETUP_ARGS ?= --single-version-externally-managed
 PYTHON_PKG_SETUP_VARS ?=
 
 define PyBuild/Compile/Default
-       $(foreach pkg,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS),
-               $(call host_python_pip_install_host,$(pkg))
+       $(if $(HOST_PYTHON_PACKAGE_BUILD_DEPENDS),
+               $(call Build/Compile/HostPyPipInstall,$(HOST_PYTHON_PACKAGE_BUILD_DEPENDS))
        )
        $(call Build/Compile/PyMod, \
                $(PYTHON_PKG_SETUP_DIR), \
index 71ae09362548d6cfa61b2534c2a475ed0f96eb91..403d0d282122f5557466c22e4f26fd6dc1cbae92 100644 (file)
@@ -71,16 +71,15 @@ 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
-       $(call host_python3_settings) \
-       $(HOST_PYTHON3_PIP) install \
-               --root=$(1) \
-               --prefix=$(2) \
-               $(3)
-endef
 
-define host_python3_pip_install_host
-$(call host_python3_pip_install,$(STAGING_DIR_HOSTPKG),"",$(1))
+# $(1) => packages to install
+define Build/Compile/HostPy3PipInstall
+       $(call host_python3_settings) \
+       $(HOST_PYTHON3_PIP) \
+               --disable-pip-version-check \
+               --cache-dir "$(DL_DIR)/pip-cache" \
+               install \
+               $(1)
 endef
 
 # $(1) => build subdir
index 4a3dddd6439bb867d69d5340157e0ab2aeac5b5e..3bea6ede5961d30a6b83c0e076364dc87d1f5397 100644 (file)
@@ -120,8 +120,8 @@ PYTHON3_PKG_SETUP_ARGS ?= --single-version-externally-managed
 PYTHON3_PKG_SETUP_VARS ?=
 
 define Py3Build/Compile/Default
-       $(foreach pkg,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS),
-               $(call host_python3_pip_install_host,$(pkg))
+       $(if $(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS),
+               $(call Build/Compile/HostPy3PipInstall,$(HOST_PYTHON3_PACKAGE_BUILD_DEPENDS))
        )
        $(call Build/Compile/Py3Mod, \
                $(PYTHON3_PKG_SETUP_DIR), \