From 6bd4924cec73908225e6744b1b00dd86cb39d3ed Mon Sep 17 00:00:00 2001 From: Javier Pena Date: Fri, 15 Sep 2017 15:55:00 +0200 Subject: [PATCH] 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 --- functions-common | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functions-common b/functions-common index 283a6cf3d5..e53c72dc6e 100644 --- a/functions-common +++ b/functions-common @@ -2081,7 +2081,7 @@ function _get_python_version { local interp=$1 local version # disable erroring out here, otherwise if python 3 doesn't exist we fail hard. - if [[ -x $(which $interp) ]]; then + if [[ -x $(which $interp 2> /dev/null) ]]; then version=$($interp -c 'import sys; print("%s.%s" % sys.version_info[0:2])') fi echo ${version}