Fix path issues in ubuntu_setup.sh and openpilot_env.sh (#21380)

* fix: fix pathing issues in ubuntu_setup.sh and openpilot_env.sh

Fixes:
- enter git tree before trying git operations in ubuntu_setup.sh
- extend PYTHONPATH instead of overwriting it in openpilot_env.sh
- fix pyenv pathing with workaround in openpilot_env.sh

This also adds a newline before .bashrc extensions to visually separate
the additions from existing content.

* Update tools/ubuntu_setup.sh

Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
old-commit-hash: 6d3c587564
commatwo_master
orphen 4 years ago committed by GitHub
parent 3a17364df4
commit 44440909dd
  1. 11
      tools/openpilot_env.sh
  2. 9
      tools/ubuntu_setup.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

@ -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

Loading…
Cancel
Save