Skip to content

Commit 90e7754

Browse files
committed
check python and pip version for update too
1 parent ad44f6e commit 90e7754

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

update.sh

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,13 @@ function install_software() {
5757
fi
5858
}
5959

60+
function check_python_version() {
61+
if ! python3 -V | grep '3.[7-9].[0-9]' > /dev/null 2>&1; then
62+
echo "An unsupported version of python 3 is installed. Must have python 3.7+ installed to use the Hologram SDK"
63+
exit 1
64+
fi
65+
}
66+
6067
# EFFECTS: Returns true if the specified program is installed, false otherwise.
6168
function check_if_installed() {
6269
if command -v "$*" >/dev/null 2>&1; then
@@ -96,10 +103,12 @@ function verify_installation() {
96103
echo 'You are now ready to use the Hologram Python SDK!'
97104
}
98105

106+
check_python_version
107+
99108
update_repository
100109

101110
# Check if an older version exists and uninstall it
102-
if command hologram version | grep '0.8'; then
111+
if command hologram version | grep '0.[0-8]'; then
103112
echo "Found a previous version of the SDK on Python 2. The new update uses"
104113
echo "Python 3 and is not compatible with Python 2. This script will uninstall"
105114
echo "the previous SDK version, install Python 3 and then install the new"
@@ -123,6 +132,10 @@ do
123132
pause "Installing $program. Press [Enter] key to continue...";
124133
install_software 'python3-pip'
125134
fi
135+
if ! pip3 -V | grep '3.[7-9]' >/dev/null 2>&1; then
136+
echo "pip3 is installed for an unsupported version of python."
137+
exit 1
138+
fi
126139
elif check_if_installed "$program"; then
127140
echo "$program is already installed."
128141
else

0 commit comments

Comments
 (0)