From cb15e7ef339cb3caf92112b9cf5f0b6d70c4e419 Mon Sep 17 00:00:00 2001 From: Gregory Haynes Date: Sun, 28 Feb 2016 20:44:16 -0800 Subject: [PATCH] Prioritize venv python on host If we are being run from a python 3 virtualenv where python2 is also available on the host we will use the hosts' python2 over the virtualenv python3 (even if the virtualenv is higher precedence in PATH). Change-Id: I9a25b9e45845a4121aab8250fd53c6f006825742 --- .../package-installs/extra-data.d/99-squash-package-install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/elements/package-installs/extra-data.d/99-squash-package-install b/elements/package-installs/extra-data.d/99-squash-package-install index b107f338c..1f3e6a8c0 100755 --- a/elements/package-installs/extra-data.d/99-squash-package-install +++ b/elements/package-installs/extra-data.d/99-squash-package-install @@ -5,6 +5,8 @@ fi set -eu set -o pipefail -python_path=$(command -v python2 || command -v python3) +# Search for python first in case we are in a venv with python3 which +# should take precedence +python_path=$(command -v python || command -v python2 || command -v python3) sudo -E $python_path $(dirname $0)/../bin/package-installs-squash --elements="$IMAGE_ELEMENT" --path=$ELEMENTS_PATH $TMP_MOUNT_PATH/tmp/package-installs.json