Skip to content

Commit

Permalink
check python and pip versions (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
DomAmato committed Mar 24, 2020
1 parent a71ad73 commit 0d44cb2
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,14 @@ function install_software() {
fi
}

function check_python_version() {
python3 -V | grep '3.[7-9].[0-9]' &> /dev/null
if ! [ $? == 0 ]; then
echo "An unsupported version of python 3 is installed. Must have python 3.7+ installed to use the Hologram SDK"
exit 1
fi
}

# EFFECTS: Returns true if the specified program is installed, false otherwise.
function check_if_installed() {
if command -v "$*" >/dev/null 2>&1; then
Expand Down Expand Up @@ -99,6 +107,8 @@ function verify_installation() {
echo 'You are now ready to use the Hologram Python SDK!'
}

check_python_version

update_repository

# Iterate over all programs to see if they are installed
Expand All @@ -115,6 +125,11 @@ do
pause "Installing $program. Press [Enter] key to continue...";
install_software 'python3-pip'
fi
pip3 -V | grep '3.[7-9]' &> /dev/null
if ! [ $? == 0 ]; then
echo "pip3 is installed for an unsupported version of python."
exit 1
fi
elif check_if_installed "$program"; then
echo "$program is already installed."
else
Expand Down

0 comments on commit 0d44cb2

Please sign in to comment.