From 7504293c288587e65d617d7353fc22aa3da22b60 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Tue, 26 Sep 2017 01:30:32 +0200 Subject: [PATCH] More reliable detection of python and ruby interpreter in build.sh --- build.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index 260af8965..b591d1925 100755 --- a/build.sh +++ b/build.sh @@ -233,9 +233,9 @@ fi echo "" # if not given, locate ruby interpreter (prefer 1.9, then default, finally 1.8 as fallback) -if [ "$RUBY" != "-" ]; then +if [ "$RUBY" = "" ]; then for ruby in "ruby2.4" "ruby2.3" "ruby2.2" "ruby2.1" "ruby2" "ruby1.9" "ruby" "ruby1.8"; do - if [ "$RUBY" = "" ] && [ "`$ruby -v 2>/dev/null`" != "" ]; then + if [ "$RUBY" = "" ] && [ "`$ruby -e 'puts 1' 2>/dev/null`" = "1" ]; then RUBY="$ruby" fi done @@ -319,9 +319,9 @@ if [ "$RUBY" != "" ] && [ "$RUBY" != "-" ]; then fi # if not given, locate Python interpreter -if [ "$PYTHON" != "-" ]; then +if [ "$PYTHON" = "" ]; then for python in "python3.5" "python3.4" "python3.3" "python3.2" "python3.1" "python3" "python2.8" "python2.7" "python2" "python"; do - if [ "$PYTHON" = "" ] && [ "`$python -V 2>&1`" != "" ]; then + if [ "$PYTHON" = "" ] && [ "`$python -c 'print(1)' 2>/dev/null`" = "1" ]; then PYTHON="$python" fi done