Skip to content

Commit f0beec4

Browse files
author
Florian Kraemer
committed
Added a version check to the install.sh script.
1 parent 5a37605 commit f0beec4

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

install.sh

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

3+
# Check if a Python executable is present.
34
if command -v python3 &>/dev/null; then
45
python_cmd=python3
56
elif command -v python &>/dev/null; then
@@ -9,6 +10,20 @@ else
910
exit 1
1011
fi
1112

13+
# Get the version number of Python installed on the system.
14+
python_version=$($python_cmd --version 2>&1 | awk '{print $2}')
15+
16+
# Extract the major version number (i.e. 3 from 3.x).
17+
major_version=$(echo $python_version | cut -d. -f1)
18+
19+
if [ "$major_version" == "3" ]; then
20+
echo "Python 3 is installed."
21+
else
22+
echo "Python 3 is not installed."
23+
exit 1
24+
fi
25+
26+
# Execute the installation
1227
$python_cmd -m pip install -U robotframework
1328
$python_cmd -m pip install -U robotframework-requests
1429
$python_cmd -m pip install -U robotframework-databaselibrary

0 commit comments

Comments
 (0)