From 69120b49bc5c2180671ba7cd974a5ec42963dff2 Mon Sep 17 00:00:00 2001 From: Zack Cerza Date: Fri, 2 Dec 2022 12:52:18 -0700 Subject: [PATCH] bootstrap: Support alternate python versions And check for their usability before proceeding Signed-off-by: Zack Cerza --- bootstrap | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bootstrap b/bootstrap index c803b87877..46c81bb2b8 100755 --- a/bootstrap +++ b/bootstrap @@ -17,13 +17,18 @@ if [[ "$PYTHON" =~ "python2" ]]; then fi PYTHON=${PYTHON:-"python3"} +PYTHON_BIN=$(command -v $PYTHON) +if [ -z $PYTHON_BIN -o ! -e $PYTHON_BIN -o ! -x $PYTHON_BIN ]; then + echo "Cannot find $PYTHON!" + exit 1 +fi VENV=${VENV:-"virtualenv"} case "$(uname -s)" in Linux) case "$(lsb_release --id --short)" in Ubuntu|Debian|LinuxMint) - deps=(qemu-utils python3-dev libssl-dev python3-pip python3-venv libev-dev libvirt-dev libffi-dev libyaml-dev) + deps=(qemu-utils python3-dev libssl-dev python3-pip $PYTHON-venv libev-dev libvirt-dev libffi-dev libyaml-dev) for package in ${deps[@]}; do if [ "$(dpkg --status -- $package|sed -n 's/^Status: //p')" != "install ok installed" ]; then # add a space after old values @@ -167,7 +172,7 @@ if [ -z "$NO_CLOBBER" ] && [ ! -e "./$VENV/bin/pip" ]; then fi if [ -z "$NO_CLOBBER" ] || [ ! -e ./$VENV ]; then - python3 -m venv $VENV + $PYTHON_BIN -m venv $VENV fi ./$VENV/bin/pip install packaging -- 2.39.5