Skip to content

Commit dc4361d

Browse files
committed
Added warning when pip comes from a different version of Python.
1 parent 1841745 commit dc4361d

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

psij-ci-setup

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,16 @@ check_python_version() {
291291
fi
292292
}
293293

294+
check_pip_version() {
295+
PYTHON_VERSION=`$PYTHON --version | awk '{print $2}' | cut -d '.' -f 1,2`
296+
PIP_PYTHON_VERSION=`$PIP --version | sed -nE 's/.*\(python\s(.*)\)/\1/p'`
297+
298+
if [ "$PYTHON_VERSION" != "$PIP_PYTHON_VERSION" ]; then
299+
echo -e "\e[33mWarning: The installed $PIP comes from Python $PIP_PYTHON_VERSION while your"
300+
echo -e "Python interpreter has version $PYTHON_VERSION. This is likely to cause problems.\e[0m"
301+
fi
302+
}
303+
294304
not_cached() {
295305
if [ ! -d .packages ]; then
296306
return 0
@@ -353,6 +363,7 @@ while [ "$1" != "" ]; do
353363
done
354364

355365
check_python_version
366+
check_pip_version
356367

357368
MYPATH="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
358369
cd "$MYPATH"

0 commit comments

Comments
 (0)