All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] toolchain-shar-extract: check for available python
@ 2020-03-19 18:20 Jeremy A. Puhlman
  0 siblings, 0 replies; only message in thread
From: Jeremy A. Puhlman @ 2020-03-19 18:20 UTC (permalink / raw)
  To: openembedded-core

From: Jeremy Puhlman <jpuhlman@mvista.com>

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>
---
 meta/files/toolchain-shar-extract.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

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
-- 
2.13.3



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-03-19 18:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-19 18:20 [PATCH] toolchain-shar-extract: check for available python Jeremy A. Puhlman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.