mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 23:33:58 +08:00
setup: perform all pyenv setup in a single place (#23408)
* consolidate pyenv setup * cleanup openpilot_env.sh * undo openpilot_env.sh changes * needed on mac * add that back Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>
This commit is contained in:
@@ -4,11 +4,26 @@ set -e
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
|
||||
cd $DIR
|
||||
|
||||
RC_FILE="${HOME}/.$(basename ${SHELL})rc"
|
||||
if [ "$(uname)" == "Darwin" ] && [ $SHELL == "/bin/bash" ]; then
|
||||
RC_FILE="$HOME/.bash_profile"
|
||||
fi
|
||||
|
||||
if ! command -v "pyenv" > /dev/null 2>&1; then
|
||||
echo "pyenv install ..."
|
||||
curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash
|
||||
export PATH=$HOME/.pyenv/bin:$HOME/.pyenv/shims:$PATH
|
||||
|
||||
echo -e "\n. ~/.pyenvrc" >> $RC_FILE
|
||||
cat <<EOF > "${HOME}/.pyenvrc"
|
||||
if [ -z "\$PYENV_ROOT" ]; then
|
||||
export PATH=\$HOME/.pyenv/bin:\$HOME/.pyenv/shims:\$PATH
|
||||
export PYENV_ROOT="\$HOME/.pyenv"
|
||||
eval "\$(pyenv init -)"
|
||||
eval "\$(pyenv virtualenv-init -)"
|
||||
fi
|
||||
EOF
|
||||
fi
|
||||
source $RC_FILE
|
||||
|
||||
export MAKEFLAGS="-j$(nproc)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user