Browse Source

Merge pull request #9100 from jefferyto/isolate-host-python

python,python3: Better isolate host Python
lilik-openwrt-22.03
Rosen Penev 6 years ago
committed by GitHub
parent
commit
15a0606403
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 30 additions and 22 deletions
  1. +8
    -9
      lang/python/python-host.mk
  2. +2
    -2
      lang/python/python-package.mk
  3. +5
    -0
      lang/python/python/Makefile
  4. +8
    -9
      lang/python/python3-host.mk
  5. +2
    -2
      lang/python/python3-package.mk
  6. +5
    -0
      lang/python/python3/Makefile

+ 8
- 9
lang/python/python-host.mk View 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


+ 2
- 2
lang/python/python-package.mk View File

@ -125,8 +125,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), \


+ 5
- 0
lang/python/python/Makefile View File

@ -306,6 +306,11 @@ HOST_CONFIGURE_ARGS+= \
--with-ensurepip=upgrade \
CONFIG_SITE=
define Host/Configure
$(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
$(call Host/Configure/Default)
endef
define Host/Compile
$(call Host/Compile/Default,python Parser/pgen sharedmods)
endef


+ 8
- 9
lang/python/python3-host.mk View 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


+ 2
- 2
lang/python/python3-package.mk View File

@ -124,8 +124,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), \


+ 5
- 0
lang/python/python3/Makefile View File

@ -300,6 +300,11 @@ HOST_CONFIGURE_ARGS+= \
--with-ensurepip=upgrade \
CONFIG_SITE=
define Host/Configure
$(SED) 's/^ENABLE_USER_SITE = None$$$$/ENABLE_USER_SITE = False/' $(HOST_BUILD_DIR)/Lib/site.py
$(call Host/Configure/Default)
endef
define Host/Compile
+$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) python Parser/pgen
+$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR) sharedmods


Loading…
Cancel
Save