summaryrefslogtreecommitdiffstats
path: root/meta/files
diff options
context:
space:
mode:
authorJeremy Puhlman <jpuhlman@mvista.com>2020-03-19 11:20:48 -0700
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-03-21 22:38:19 +0000
commit1e6061a4d223dc104039728ba169dbe63e74f750 (patch)
tree46754834aed3135d01906fcdf5de504872c4220a /meta/files
parentf9e410521c92e2458ba7e2ca63d28434618b9f25 (diff)
downloadopenembedded-core-1e6061a4d223dc104039728ba169dbe63e74f750.tar.gz
toolchain-shar-extract: check for available python
centos7 doesn't have python3 intalled by default, so running the script errors in novel ways if it is not installed. Signed-off-by: Jeremy A. Puhlman <jpuhlman@mvista.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/files')
-rw-r--r--meta/files/toolchain-shar-extract.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/meta/files/toolchain-shar-extract.sh b/meta/files/toolchain-shar-extract.sh
index 2e0fe94963..04527f891f 100644
--- a/meta/files/toolchain-shar-extract.sh
+++ b/meta/files/toolchain-shar-extract.sh
@@ -1,8 +1,13 @@
#!/bin/sh
export LC_ALL=en_US.UTF-8
+#Make sure at least one python is installed
+INIT_PYTHON=$(which python3 2>/dev/null )
+[ -z "$INIT_PYTHON" ] && INIT_PYTHON=$(which python2 2>/dev/null)
+[ -z "$INIT_PYTHON" ] && echo "Error: The SDK needs a python installed" && exit 1
+
# Remove invalid PATH elements first (maybe from a previously setup toolchain now deleted
-PATH=`python3 -c 'import os; print(":".join(e for e in os.environ["PATH"].split(":") if os.path.exists(e)))'`
+PATH=`$INIT_PYTHON -c 'import os; print(":".join(e for e in os.environ["PATH"].split(":") if os.path.exists(e)))'`
tweakpath () {
case ":${PATH}:" in