File tree Expand file tree Collapse file tree 1 file changed +22
-0
lines changed
Expand file tree Collapse file tree 1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,11 @@ function echo_with_indentation() {
6464 echo -e " $message "
6565}
6666
67+ function echo_error_message () {
68+ local message=$1
69+ echo_with_indentation " \033[38;5;9m$message \033[0m"
70+ }
71+
6772function echo_recommendation_message() {
6873 local message=$1
6974 echo_with_indentation " \033[38;5;11m$message \033[0m"
@@ -146,6 +151,20 @@ function export_pyenv_and_pyenv_repository_paths() {
146151 export PATH=" $PYENV_ROOT /bin:$PYENV_REPOSITORY_LOCATION /bin:$PATH "
147152}
148153
154+ function verify_http_client_exists() {
155+ if type curl & > /dev/null; then
156+ return
157+ elif type aria2c & > /dev/null; then
158+ return
159+ elif [[ " $( wget --version 2> /dev/null || true) " = " GNU Wget 1.1" [0-3]* ]]; then
160+ echo_error_message " wget (>= 1.14) or curl (>= 7.18.1) is required to download and install Python."
161+ exit 1
162+ else
163+ echo_error_message " Could not find \` curl\` , \` wget\` , or \` aria2c\` . Please install one of these tools to continue Python installation"
164+ exit 1
165+ fi
166+ }
167+
149168function main() {
150169 echo_step_title " Determining whether pyenv is already installed and in PATH"
151170
@@ -161,6 +180,9 @@ function main() {
161180 echo_step_title " Temporarily export necessary pyenv paths"
162181 export_pyenv_and_pyenv_repository_paths
163182
183+ echo_step_title " Checking whether Python can be downloaded (through curl, wget, or aria2c)"
184+ verify_http_client_exists
185+
164186 echo_step_title " Installing Python $PYTHON_VERSION "
165187 install_python
166188
You can’t perform that action at this time.
0 commit comments