From a4fd5c42a9887e622a19ffdbafa5497a561341c9 Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Thu, 22 Mar 2018 07:24:07 +0100 Subject: [PATCH] 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 --- src/tools/setup-virtualenv.sh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/tools/setup-virtualenv.sh b/src/tools/setup-virtualenv.sh index a99c5088a56..f991b21c022 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 -- 2.39.5