-
Notifications
You must be signed in to change notification settings - Fork 0
/
check-dependencies
41 lines (32 loc) · 1.62 KB
/
check-dependencies
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
function check_dependencies {
missing=""
py_missing="Python version 3.10 or higher was not found on your system. Please install it and rerun this script. You can download the latest version from the official website: https://www.python.org/downloads/"
pip_missing="Pip was not found. Pip version 20.0 or higher is required for this project. You can find guidelines on this here: https://packaging.python.org/en/latest/tutorials/installing-packages/#ensure-you-can-run-pip-from-the-command-line"
npm_missing="Node.js/npm was not found. Please make sure you have installed Node.js version 16.0 or higher along with npm correctly. You can download Nodejs from here: https://nodejs.org/en/download"
if [[ "$OSTYPE" == "darwin"* || "$OSTYPE" == "linux-gnu"* ]]; then
if command -v python3 &> /dev/null; then
if ! python3 -c "import sys; exit(0) if sys.version_info >= (3,10) else exit(1)" &>/dev/null; then
echo "$py_missing"
exit 1
fi
else
echo "$py_missing"
exit 1
fi
if ! command -v python3 -m pip &> /dev/null; then
echo "$pip_missing"
exit 1
fi
MINIMUM_PIP_VERSION="20.0"
PIP_VERSION=$(python3 -m pip --version | awk '{print $2}')
if ! awk 'BEGIN{exit !('$PIP_VERSION' >= '$MINIMUM_PIP_VERSION')}'; then
echo "An older version of pip was found. Pip version 20.0 or higher is required for this project. To upgrade run following command: 'pip install --upgrade pip' or 'python3 -m pip install --upgrade pip'"
exit 1
fi
if ! command -v npm &> /dev/null; then
echo "$npm_missing"
exit 1
fi
fi
}