File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change 1010export PYTHON_VERSION=" 3.7.2"
1111export PYENV_ROOT=" $HOME /.pyenv"
1212export PYENV_BIN=" $PYENV_ROOT /versions/$PYTHON_VERSION /bin"
13+ BASH_PROFILE=" $HOME /.bash_profile"
14+ ZSHENV=" $HOME /.zshrc"
15+ PYTHON_ALREADY_IN_PATH=false
1316
1417function change_to_scripts_directory() {
1518 SCRIPTS_DIRECTORY=$( cd " $( dirname " ${BASH_SOURCE[0]} " ) " ; pwd -P )
@@ -37,7 +40,8 @@ function install_python() {
3740 echo_with_colors_inverted " I. Installing Python "
3841 echo_with_colors_inverted " =============================================="
3942 if [ -f python_installer ]; then
40- ./python_installer
43+ SUPPRESS_PATH_EXPORT_MESSAGE=true
44+ source ./python_installer SUPPRESS_PATH_EXPORT_MESSAGE
4145 exit_if_return_code_is_non_zero
4246 fi
4347}
@@ -55,6 +59,13 @@ function install_ebcli() {
5559 fi
5660}
5761
62+ function print_python_path_export_message() {
63+ if [ " ${PYTHON_ALREADY_IN_PATH} " = false ]; then
64+ print_path_export_instructions
65+ fi
66+ }
67+
5868change_to_scripts_directory
5969install_python
6070install_ebcli
71+ print_python_path_export_message
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ BASH_PROFILE="$HOME/.bash_profile"
2424ZSHENV=" $HOME /.zshrc"
2525COMMAND_LINE_ARGS=$*
2626PYTHON_VERSION=${PYTHON_VERSION:= " 3.7.2" }
27+ SUPPRESS_PATH_EXPORT_MESSAGE=${SUPPRESS_PATH_EXPORT_MESSAGE:= false}
2728PYENV_ROOT=${PYENV_ROOT:= " $HOME /.pyenv" }
29+ export PYTHON_ALREADY_IN_PATH=false
2830
2931if [ ! -d ${PYENV_ROOT} ]; then
3032 mkdir ${PYENV_ROOT}
@@ -105,10 +107,15 @@ function install_python() {
105107 echo_success_message " - Python $PYTHON_VERSION is installed at $PYENV_BIN "
106108
107109 if python_is_not_in_path; then
108- print_path_export_instructions
110+ if [ ${SUPPRESS_PATH_EXPORT_MESSAGE} = false ] ; then
111+ print_path_export_instructions
112+ fi
109113 else
114+ PYTHON_ALREADY_IN_PATH=true
110115 echo " "
111- echo_with_indentation " - $PYENV_BIN is already in PATH no further action need be taken."
116+ if [ ${SUPPRESS_PATH_EXPORT_MESSAGE} = false ] ; then
117+ echo_with_indentation " - $PYENV_BIN is already in PATH no further action need be taken."
118+ fi
112119 fi
113120}
114121
@@ -191,4 +198,6 @@ function main() {
191198 echo_step_title " Installing virtualenv using $PYENV_BIN /pip"
192199 install_virtualenv
193200}
201+ export print_path_export_instructions
202+ export echo_with_indentation
194203main
You can’t perform that action at this time.
0 commit comments