summaryrefslogtreecommitdiffstats
path: root/meta-selftest
diff options
context:
space:
mode:
authorPaul Barker <pbarker@konsulko.com>2020-12-16 18:16:16 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-12-20 00:03:01 +0000
commit73d538f20743017a44cea4c20dbe09a0327cfc71 (patch)
tree2ce07b61ade0d1945a481668cceed93de937cbe1 /meta-selftest
parent55618cbd58d6784a82e773f323723be6f722232f (diff)
downloadopenembedded-core-contrib-73d538f20743017a44cea4c20dbe09a0327cfc71.tar.gz
bitbake.conf: Prevent pyc file generation in pseudo context
This also effectively reverts commit b6d30c21b0: bitbake.conf: Extend PSEUDO_IGNORE_PATHS to ${COREBASE}/meta The contents of ${COREBASE}/meta were ignored as pyc files could be generated for the contents of the lib subdirectory if python modules were imported within a pseudo context. However this doesn't protect us from pyc files being generated in the lib directories for other layers. It's far better to tell python not to produce pyc files when running under pseudo (by setting the PYTHONDONTWRITEBYTECODE variable) as this will cover any location where pyc files could possibly be created. This variable is set in FAKEROOTBASEENV so that it applies to the bitbake-worker instance for fakeroot tasks, preventing pyc files from being generated for imports in python tasks themselves. Also add a test case to ensure that pyc files are not created in tasks which are executed under pseudo. Signed-off-by: Paul Barker <pbarker@konsulko.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta-selftest')
-rw-r--r--meta-selftest/lib/pseudo_pyc_test1.py1
-rw-r--r--meta-selftest/lib/pseudo_pyc_test2.py1
-rw-r--r--meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb15
3 files changed, 17 insertions, 0 deletions
diff --git a/meta-selftest/lib/pseudo_pyc_test1.py b/meta-selftest/lib/pseudo_pyc_test1.py
new file mode 100644
index 0000000000..b59abdd536
--- /dev/null
+++ b/meta-selftest/lib/pseudo_pyc_test1.py
@@ -0,0 +1 @@
+STRING = "pseudo_pyc_test1"
diff --git a/meta-selftest/lib/pseudo_pyc_test2.py b/meta-selftest/lib/pseudo_pyc_test2.py
new file mode 100644
index 0000000000..fb67a978e0
--- /dev/null
+++ b/meta-selftest/lib/pseudo_pyc_test2.py
@@ -0,0 +1 @@
+STRING = "pseudo_pyc_test2"
diff --git a/meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb b/meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb
new file mode 100644
index 0000000000..12dc91a8f3
--- /dev/null
+++ b/meta-selftest/recipes-test/pseudo-pyc-test/pseudo-pyc-test.bb
@@ -0,0 +1,15 @@
+SUMMARY = "pseudo env test"
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+python do_compile() {
+ import pseudo_pyc_test1
+ print(pseudo_pyc_test1.STRING)
+}
+
+python do_install() {
+ import pseudo_pyc_test2
+ print(pseudo_pyc_test2.STRING)
+}