From: Nathan Cutler Date: Thu, 22 Mar 2018 06:24:07 +0000 (+0100) Subject: tools: setup-virtualenv.sh: do not hardcode python binary X-Git-Tag: v13.1.0~507^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a4fd5c42a9887e622a19ffdbafa5497a561341c9;p=ceph.git tools: setup-virtualenv.sh: do not hardcode python binary . . . instead, take a command-line option that defaults to "python2.7" Fixes: http://tracker.ceph.com/issues/23437 Signed-off-by: Nathan Cutler --- diff --git a/src/tools/setup-virtualenv.sh b/src/tools/setup-virtualenv.sh index a99c5088a56d..f991b21c022a 100755 --- a/src/tools/setup-virtualenv.sh +++ b/src/tools/setup-virtualenv.sh @@ -15,10 +15,24 @@ # GNU Library Public License for more details. # +SCRIPTNAME="$(basename $0)" + +TEMP=$(getopt --options "" --long "python:" --name "$SCRIPTNAME" -- "$@") +if [ $? != 0 ] ; then echo "Failed to parse options...exiting" >&2 ; exit 1 ; fi +eval set -- "$TEMP" +PYTHON_BINARY="python2.7" +while true ; do + case "$1" in + --python) PYTHON_BINARY="$2" ; shift ; shift ;; + --) shift ; break ;; + *) echo "Internal error" ; exit 1 ;; + esac +done + DIR=$1 rm -fr $DIR mkdir -p $DIR -virtualenv --python python2.7 $DIR +virtualenv --python $PYTHON_BINARY $DIR . $DIR/bin/activate if pip --help | grep -q disable-pip-version-check; then