Skip to content

Commit e7b28b1

Browse files
Chase AllbeeChaseAllbee
authored andcommitted
Update path instructions post install
1 parent 0bb73d6 commit e7b28b1

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

scripts/bundled_installer

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
export PYTHON_VERSION="3.7.2"
1111
export PYENV_ROOT="$HOME/.pyenv"
1212
export 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

1417
function 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+
5868
change_to_scripts_directory
5969
install_python
6070
install_ebcli
71+
print_python_path_export_message

scripts/python_installer

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ BASH_PROFILE="$HOME/.bash_profile"
2424
ZSHENV="$HOME/.zshrc"
2525
COMMAND_LINE_ARGS=$*
2626
PYTHON_VERSION=${PYTHON_VERSION:="3.7.2"}
27+
SUPPRESS_PATH_EXPORT_MESSAGE=${SUPPRESS_PATH_EXPORT_MESSAGE:=false}
2728
PYENV_ROOT=${PYENV_ROOT:="$HOME/.pyenv"}
29+
export PYTHON_ALREADY_IN_PATH=false
2830

2931
if [ ! -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
194203
main

0 commit comments

Comments
 (0)