summaryrefslogtreecommitdiff
path: root/run.sh
diff options
context:
space:
mode:
authorFabien Catteau <fcatteau@gitlab.com>2019-06-07 16:46:05 +0000
committerFabien Catteau <fcatteau@gitlab.com>2019-06-07 16:46:05 +0000
commitc1eff826603590c83778ff8c2e8aa018df5c0e73 (patch)
treeb54b9f1850a607daa1e31bd953255314f1d6a488 /run.sh
parent86bcbbc7758ee2f084d7baa624a349adc654c20c (diff)
parent368542b7fd5f1599a29722ea31a0166ce8848c50 (diff)
Merge branch 'python3' into 'master'v1.3.0
Add option to select Python version 2 or 3 See merge request gitlab-org/security-products/license-management!36
Diffstat (limited to 'run.sh')
-rwxr-xr-xrun.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/run.sh b/run.sh
index 8270381..7adf439 100755
--- a/run.sh
+++ b/run.sh
@@ -65,6 +65,26 @@ if [ "$COMMAND" = "test" -a $# -ne 2 ] ; then
exit 1
fi
+# Switch to Python 3 if requesting
+case "$LM_PYTHON_VERSION" in
+ "2"|"2.7")
+ echo "using python $LM_PYTHON_VERSION"
+ pip --version
+ ;;
+
+ "3"|"3.5")
+ echo "switching to python $LM_PYTHON_VERSION"
+ pip3 install --upgrade --no-index -f "file://$LOCAL_PYPI_INDEX" "pip==$VERSION_OF_PIP"
+ update-alternatives --install /usr/bin/python python /usr/bin/python3.5 1
+ pip --version
+ ;;
+
+ *)
+ echo "python version not supported: $LM_PYTHON_VERSION" >&2
+ exit 1
+ ;;
+esac
+
# Run command
case "$COMMAND" in
test)