[Buildroot] [git commit branch/next] package/pkg-python: invalidate precompiled _sysconfigdata*.pyc

Yann E. MORIN yann.morin.1998 at free.fr
Sat Aug 28 14:44:14 UTC 2021


commit: https://git.buildroot.net/buildroot/commit/?id=afde8fb8f36267e7b025c26e700f76e9bb75706f
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/next

For per-package directories, we fixup the _sysconfigdata*.py files, so
that they get proper path pointing to the current package's direcotry
structure.

However, the corresponding, pre-compiled blobs _sysconfigdata*.pyc were
left around, and thus are inconsistent with their source. They might
also be regenerated when a package would install a python module; this
regeneration would trigger the soon-to-be-introduced overwrite
detection.

This commit simply removes _sysconfigdata*.pyc files; they will anyway
be regenerated by the PYTHON{,3}_CREATE_PYC_FILES target finalize hooks.
This is an efficient way to guarantee the consistency between the source
and precompiled versions, and to not trigger the overwrite detection.

Signed-off-by: Herve Codina <herve.codina at bootlin.com>
[yann.morin.1998 at free.frs: reword the commit log]
Signed-off-by: Yann E. MORIN <yann.morin.1998 at free.fr>
---
 package/pkg-python.mk | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/pkg-python.mk b/package/pkg-python.mk
index 8b24aeb3b1..ddf9e733fd 100644
--- a/package/pkg-python.mk
+++ b/package/pkg-python.mk
@@ -108,7 +108,9 @@ define PKG_PYTHON_FIXUP_SYSCONFIGDATA
 		\(    -path '$(HOST_DIR)/lib/python*' \
 		   -o -path '$(STAGING_DIR)/usr/lib/python*' \
 		\) \
-		-name "_sysconfigdata*.py" -print0 \
+		\(    \( -name "_sysconfigdata*.pyc" -delete \) \
+		   -o \( -name "_sysconfigdata*.py" -print0 \) \
+		\) \
 	| xargs -0 --no-run-if-empty \
 		$(SED) 's:$(PER_PACKAGE_DIR)/[^/]\+/:$(PER_PACKAGE_DIR)/$($(PKG)_NAME)/:g'
 endef


More information about the buildroot mailing list