diff --git a/tools/openpilot_env.sh b/tools/openpilot_env.sh index ca25706b83..ac784d41e2 100755 --- a/tools/openpilot_env.sh +++ b/tools/openpilot_env.sh @@ -1,9 +1,18 @@ if [ -z "$OPENPILOT_ENV" ]; then - export PYTHONPATH="$HOME/openpilot" + export PYTHONPATH="$HOME/openpilot:$PYTHONPATH" unamestr=`uname` if [[ "$unamestr" == 'Linux' ]]; then export PATH="$HOME/.pyenv/bin:$PATH" + + # Pyenv suggests we place the below two lines in .profile before we source + # .bashrc, but there is no simple way to guarantee we do this correctly + # programmatically across heterogeneous systems. For end-user convenience, + # we add the lines here as a workaround. + # https://github.com/pyenv/pyenv/issues/1906 + export PYENV_ROOT="$HOME/.pyenv" + eval "$(pyenv init --path)" + eval "$(pyenv virtualenv-init -)" elif [[ "$unamestr" == 'Darwin' ]]; then # msgq doesn't work on mac diff --git a/tools/ubuntu_setup.sh b/tools/ubuntu_setup.sh index 16893f6a20..fddfb2f5cb 100755 --- a/tools/ubuntu_setup.sh +++ b/tools/ubuntu_setup.sh @@ -68,18 +68,17 @@ if ! command -v "pyenv" > /dev/null 2>&1; then curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash fi -# install bashrc +# in the openpilot repo +cd $HOME/openpilot + source ~/.bashrc if [ -z "$OPENPILOT_ENV" ]; then OP_DIR=$(git rev-parse --show-toplevel) - echo "source $OP_DIR/tools/openpilot_env.sh" >> ~/.bashrc + printf "\nsource %s/tools/openpilot_env.sh" "$OP_DIR" >> ~/.bashrc source ~/.bashrc echo "added openpilot_env to bashrc" fi -# in the openpilot repo -cd $HOME/openpilot - # do the rest of the git checkout git lfs pull git submodule init