Browse code

Ignore stderr when checking for Python version

https://review.openstack.org/504171 prevented Python version detection
from failing when python3 is not installed. However, "which python3"
returns a message in stderr when python3 is not there, and this output
can make diskimage-builder get confused when parsing
source-repository-images.

Change-Id: Idb649dc341ede73c39954b0432ef3cacf379ed37

Javier Pena authored on 2017/09/15 22:55:00
Showing 1 changed files
... ...
@@ -2081,7 +2081,7 @@ function _get_python_version {
2081 2081
     local interp=$1
2082 2082
     local version
2083 2083
     # disable erroring out here, otherwise if python 3 doesn't exist we fail hard.
2084
-    if [[ -x $(which $interp) ]]; then
2084
+    if [[ -x $(which $interp 2> /dev/null) ]]; then
2085 2085
         version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])')
2086 2086
     fi
2087 2087
     echo ${version}