]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools: setup-virtualenv.sh: do not hardcode python binary
authorNathan Cutler <ncutler@suse.com>
Thu, 22 Mar 2018 06:24:07 +0000 (07:24 +0100)
committerNathan Cutler <ncutler@suse.com>
Fri, 23 Mar 2018 10:21:20 +0000 (11:21 +0100)
. . . instead, take a command-line option that defaults to
"python2.7"

Fixes: http://tracker.ceph.com/issues/23437
Signed-off-by: Nathan Cutler <ncutler@suse.com>
src/tools/setup-virtualenv.sh

index a99c5088a56d359be011f101914c837d621703fa..f991b21c022a6fa2c3cb566fa34ff9429f5f0df3 100755 (executable)
 # 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