[oe-commits] [openembedded-core] 04/04: toolchain-shar-extract: check for available python

git at git.openembedded.org git at git.openembedded.org
Fri Mar 20 00:03:59 UTC 2020


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master-next
in repository openembedded-core.

commit 00261a1556d122249d690031905fcd465da5e502
Author: Jeremy Puhlman <jpuhlman at mvista.com>
AuthorDate: Thu Mar 19 11:20:48 2020 -0700

    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 at mvista.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 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 2e0fe94..04527f8 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

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list