pkg-python: ignore user site-packages directory
PATCH 1/1 pkg-python: ignore user site-packages directory
From: Yegor Yefremov <[email protected]>
According to PEP 370 Python will also search for the packages in the user site-packages directory. This can affect build reproducibility.
The solution is to use PYTHONNOUSERSITE=1 for all Python packages, i.e. both host and target variants.
--- package/pkg-python.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
package/pkg-python.mk +6 -2
@@ -32,6 +32,7 @@ PKG_PYTHON_DISTUTILS_ENV = \ LDFLAGS="$(TARGET_LDFLAGS)" \ LDSHARED="$(TARGET_CROSS)gcc -shared" \ PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \ + PYTHONNOUSERSITE=1 \ _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \ _python_sysroot=$(STAGING_DIR) \ _python_prefix=/usr \
@@ -48,7 +49,8 @@ PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS = \ # Host distutils-based packages HOST_PKG_PYTHON_DISTUTILS_ENV = \ - PATH=$(BR_PATH) + PATH=$(BR_PATH) \ + PYTHONNOUSERSITE=1 HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \ --prefix=$(HOST_DIR)/usr
@@ -58,6 +60,7 @@ PKG_PYTHON_SETUPTOOLS_ENV = \ _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \ PATH=$(BR_PATH) \ PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \ + PYTHONNOUSERSITE=1 \ _python_sysroot=$(STAGING_DIR) \ _python_prefix=/usr \ _python_exec_prefix=/usr
@@ -76,7 +79,8 @@ PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS = \ # Host setuptools-based packages HOST_PKG_PYTHON_SETUPTOOLS_ENV = \ - PATH=$(BR_PATH) + PATH=$(BR_PATH) \ + PYTHONNOUSERSITE=1 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ --prefix=$(HOST_DIR)/usr
Signature · 1 line
2.11.0
PATCH 1/1 pkg-python: ignore user site-packages directory
Quoted 7 lines · On Thu, Apr 6, 2017 at 8:46 PM, <[email protected]> wrote:
From: Yegor Yefremov <[email protected]>
According to PEP 370 Python will also search for the packages in the user site-packages directory. This can affect build reproducibility.
The solution is to use PYTHONNOUSERSITE=1 for all Python packages, i.e. both host and target variants.
I've built a rather basic BR configuration with Python 2.7 and experienced no problems.
@Anton: could you test the patch and let us know, whether it fixes your issue?
Yegor
Quoted 48 lines
Signed-off-by Yegor Yefremov <[email protected]>--- package/pkg-python.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)package/pkg-python.mk +6
-3@@ -32,6 +32,7 @@ PKG_PYTHON_DISTUTILS_ENV = \ LDFLAGS="$(TARGET_LDFLAGS)" \ LDSHARED="$(TARGET_CROSS)gcc -shared" \ PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \ + PYTHONNOUSERSITE=1 \ _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \ _python_sysroot=$(STAGING_DIR) \ _python_prefix=/usr \@@ -48,7 +49,8 @@ PKG_PYTHON_DISTUTILS_INSTALL_STAGING_OPTS = \ # Host distutils-based packages HOST_PKG_PYTHON_DISTUTILS_ENV = \ - PATH=$(BR_PATH) + PATH=$(BR_PATH) \ + PYTHONNOUSERSITE=1 HOST_PKG_PYTHON_DISTUTILS_INSTALL_OPTS = \ --prefix=$(HOST_DIR)/usr@@ -58,6 +60,7 @@ PKG_PYTHON_SETUPTOOLS_ENV = \ _PYTHON_SYSCONFIGDATA_NAME="$(PKG_PYTHON_SYSCONFIGDATA_NAME)" \ PATH=$(BR_PATH) \ PYTHONPATH="$(if $(BR2_PACKAGE_PYTHON3),$(PYTHON3_PATH),$(PYTHON_PATH))" \ + PYTHONNOUSERSITE=1 \ _python_sysroot=$(STAGING_DIR) \ _python_prefix=/usr \ _python_exec_prefix=/usr@@ -76,7 +79,8 @@ PKG_PYTHON_SETUPTOOLS_INSTALL_STAGING_OPTS = \ # Host setuptools-based packages HOST_PKG_PYTHON_SETUPTOOLS_ENV = \ - PATH=$(BR_PATH) + PATH=$(BR_PATH) \ + PYTHONNOUSERSITE=1 HOST_PKG_PYTHON_SETUPTOOLS_INSTALL_OPTS = \ --prefix=$(HOST_DIR)/usr --2.11.0
Thomas Petazzoni
AppliedPATCH 1/1 pkg-python: ignore user site-packages directory
In reply to yegorslists at googlemail.comHello,
Quoted 5 lines · yegorslists at googlemail.com
From: Yegor Yefremov <[email protected]>
According to PEP 370 Python will also search for the packages in the user site-packages directory. This can affect build reproducibility.
Quoted 7 lines
The solution is to use PYTHONNOUSERSITE=1 for all Python packages, i.e. both host and target variants.
Signed-off-by Yegor Yefremov <[email protected]>--- package/pkg-python.mk | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH 1/1 pkg-python: ignore user site-packages directory
In reply to yegorslists at googlemail.comQuoted 10 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"yegorslists" == yegorslists <[email protected]> writes:
From: Yegor Yefremov <[email protected]> According to PEP 370 Python will also search for the packages in the user site-packages directory. This can affect build reproducibility.
The solution is to use PYTHONNOUSERSITE=1 for all Python packages, i.e. both host and target variants.
Signed-off-by Yegor Yefremov <[email protected]>
Committed to 2017.02.x, thanks.
Signature · 1 line
Bye, Peter Korsgaard