Skip to content

Commit 8e81e0e

Browse files
committed
Add check for minimum python version
1 parent 481a725 commit 8e81e0e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

psij-ci-setup

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#!/bin/bash
22

3+
MIN_PYTHON_VERSION="3.8"
4+
35
set -o pipefail
46

57
if pip --version 2>&1 | egrep -q 'python 3\..*' >/dev/null 2>&1 ; then
@@ -280,6 +282,14 @@ check_key() {
280282
fi
281283
}
282284

285+
check_python_version() {
286+
VERSION=`$PYTHON --version | awk '{print $2}'`
287+
FIRST=`echo -e "$VERSION\n$MIN_PYTHON_VERSION" | sort -V|head -n 1`
288+
if [ "$FIRST" == "$VERSION" ]; then
289+
echo "Error: PSI/J requires Python $MIN_PYTHON_VERSION or above. Your current version is $VERSION."
290+
exit 2
291+
fi
292+
}
283293

284294
not_cached() {
285295
if [ ! -d .packages ]; then
@@ -342,6 +352,8 @@ while [ "$1" != "" ]; do
342352
shift
343353
done
344354

355+
check_python_version
356+
345357
MYPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
346358
cd "$MYPATH"
347359

0 commit comments

Comments
 (0)