diff --git a/package/pkg-python.mk b/package/pkg-python.mk index 4ded4fde83..4bf762e662 100644 --- a/package/pkg-python.mk +++ b/package/pkg-python.mk @@ -90,6 +90,14 @@ HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ --root=/ \ --single-version-externally-managed +ifeq ($(BR2_PER_PACKAGE_DIRECTORIES),y) +define PKG_PYTHON_FIXUP_SYSCONFIGDATA + find $(HOST_DIR)/lib/python* $(STAGING_DIR)/usr/lib/python* \ + -name "_sysconfigdata*.py" | xargs --no-run-if-empty \ + $(SED) "s:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/:g" +endef +endif + ################################################################################ # inner-python-package -- defines how the configuration, compilation # and installation of a Python package should be done, implements a @@ -234,6 +242,8 @@ $(2)_PYTHON_INTERPRETER = $$(HOST_DIR)/bin/$$($(2)_NEEDS_HOST_PYTHON) endif endif +$(2)_PRE_CONFIGURE_HOOKS += PKG_PYTHON_FIXUP_SYSCONFIGDATA + # # Build step. Only define it if not already defined by the package .mk # file. diff --git a/package/python/python.mk b/package/python/python.mk index 41a981e3d3..1c393b255d 100644 --- a/package/python/python.mk +++ b/package/python/python.mk @@ -240,7 +240,7 @@ HOST_PYTHON_POST_INSTALL_HOOKS += HOST_PYTHON_INSTALL_PYTHON_SYMLINK endif # Provided to other packages -PYTHON_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/ +PYTHON_PATH = $(STAGING_DIR)/usr/lib/python$(PYTHON_VERSION_MAJOR)/sysconfigdata/ $(eval $(autotools-package)) $(eval $(host-autotools-package)) diff --git a/package/python3/python3.mk b/package/python3/python3.mk index 9432f1c59e..6a12c1f0e8 100644 --- a/package/python3/python3.mk +++ b/package/python3/python3.mk @@ -253,7 +253,7 @@ HOST_PYTHON3_POST_INSTALL_HOOKS += HOST_PYTHON3_INSTALL_SYMLINK endif # Provided to other packages -PYTHON3_PATH = $(TARGET_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ +PYTHON3_PATH = $(STAGING_DIR)/usr/lib/python$(PYTHON3_VERSION_MAJOR)/ # Support for socket.AF_BLUETOOTH ifeq ($(BR2_PACKAGE_BLUEZ5_UTILS_HEADERS),y)