summaryrefslogtreecommitdiff
path: root/meta-phosphor
diff options
context:
space:
mode:
authorPatrick Williams <patrick@stwcx.xyz>2020-02-27 00:46:53 +0300
committerAndrew Geissler <geissonator@yahoo.com>2020-03-16 18:50:00 +0300
commit52d65cfb273cc7c1aefa42e1460fa7ac65c98a8c (patch)
tree03b9623c1d0068488d5b4d8b8dc25736073844ef /meta-phosphor
parent741c05d54580c2ac10d7751728f45a0c891ac435 (diff)
downloadopenbmc-52d65cfb273cc7c1aefa42e1460fa7ac65c98a8c.tar.xz
obmc-phosphor-python3-autotools: workaround setuptools mangling
python-setuptools will mangle the #! line in a python script that we install using setuptools. OE already has workarounds for this in distutils3.bbclass but we cannot use it here due to the conflict of autotools and distutils. Port the mangling fixes into our autotools recipe. See pypa/setuptools#494 for upstream report (years old). (From meta-phosphor rev: a1b7f30d915a4a85e257938d0a96803e013ab528) Signed-off-by: Patrick Williams <patrick@stwcx.xyz> Change-Id: I50c7df4f92f324b6883e42d1871add813af0872d Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Diffstat (limited to 'meta-phosphor')
-rw-r--r--meta-phosphor/classes/obmc-phosphor-python3-autotools.bbclass21
1 files changed, 21 insertions, 0 deletions
diff --git a/meta-phosphor/classes/obmc-phosphor-python3-autotools.bbclass b/meta-phosphor/classes/obmc-phosphor-python3-autotools.bbclass
index d76598a36c..89a884a1b2 100644
--- a/meta-phosphor/classes/obmc-phosphor-python3-autotools.bbclass
+++ b/meta-phosphor/classes/obmc-phosphor-python3-autotools.bbclass
@@ -1,6 +1,9 @@
inherit obmc-phosphor-utils
inherit python3native
+OBMC_PYTHON_EXE="python3"
+OBMC_PYTHON_EXE_class-native="nativepython3"
+
DEPENDS += "python3"
export BUILD_SYS
@@ -15,3 +18,21 @@ python() {
set_append(d, 'FILES_%s' % pkg,
d.getVar('PYTHON_SITEPACKAGES_DIR', True))
}
+
+# python-setuptools does some mangling of the #! in any scripts it installs,
+# which has been reported for years at pypa/setuptools#494. OE has
+# workarounds in distutils3.bbclass, but we cannot inherit that here because
+# it conflicts with autotools.bbclass. Port the un-mangling code here.
+#
+# This finds any ${PYTHON} executable path that got put into the scripts
+# and reverts it back to "/usr/bin/env python3". It also reverts any full
+# ${STAGING_BINDIR_NATIVE} path back to "/usr/bin".
+#
+do_install_append() {
+ for i in ${D}${bindir}/* ${D}${sbindir}/*; do
+ if [ -f "$i" ]; then
+ sed -i -e s:${PYTHON}:${USRBINPATH}/env\ ${OBMC_PYTHON_EXE}:g $i
+ sed -i -e s:${STAGING_BINDIR_NATIVE}:${bindir}:g $i
+ fi
+ done
+}