summaryrefslogtreecommitdiff
path: root/meta-phosphor/classes
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2020-03-06 00:27:37 +0300
committerAndrew Geissler <geissonator@yahoo.com>2020-03-10 15:23:10 +0300
commit298100dfee881bce84eae84a44e4756159fa45e5 (patch)
tree8341d8ec6c21cf80197844e472544399361b56ad /meta-phosphor/classes
parent228358847e95f474cac6ebdfff4ee65a84b0ecfe (diff)
downloadopenbmc-298100dfee881bce84eae84a44e4756159fa45e5.tar.xz
obmc-phosphor-python-autotools: hack to support mixed python installs
Some packages are switching to 'inherit python3native' while also having a DEPEND on a python2-based script (such as sdbus++). Rewrite the #! in these executables to use `nativepython` instead of `python` so that the correct version of python and modules are found. (From meta-phosphor rev: 75f63b9ee7741073d22cf9001bfe4c3f31e3a59f) Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I8a7bcb21a539463838a6a103d531aa8f90c5c8c3 Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-phosphor/classes')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-python-autotools.bbclass13
1 files changed, 13 insertions, 0 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-python-autotools.bbclass b/meta-phosphor/classes/obmc-phosphor-python-autotools.bbclass
index d69eb345e..0922a1ab6 100644
--- a/meta-phosphor/classes/obmc-phosphor-python-autotools.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-python-autotools.bbclass
@@ -15,3 +15,16 @@ python() {
set_append(d, 'FILES_%s' % pkg,
d.getVar('PYTHON_SITEPACKAGES_DIR', True))
}
+
+# In order to facilitate packages that use python3native, but also
+# depend on python2 scripts we need to replace the #! to be nativepython
+# instead of just python. Without this, `which python` points to the
+# host's python, which is not the one where required modules would be
+# installed.
+do_install_append_class-native() {
+ for i in ${D}${bindir}/* ${D}${sbindir}/*; do
+ if [ -f "$i" ]; then
+ sed -i -e s:env\ python:env\ nativepython:g $i
+ fi
+ done
+}