mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-02 03:52:11 +08:00
3ca9b7f02e
* Try poetry * Remove casadi for now * Update docker * Copy pipfiles * add casadi back * Too many slashes * New poetry api * Install system * Try again * No more pipenv * new dependencies * updates * poetry 1.2.1, install dev dependencies * keep install pipenv for xx for now? * add pre-commit checks for poetry * poetry lock is too slow * update pip * migrate to poetry groups * update lockfile * don't need to specify dev group unless it is made optional * always install poetry * set POETRY_VIRTUALENVS_CREATE instead, and use pipenv for xx * use env for docs docker image * alphabetical * poetry 1.2.2 * add dev dependencies for typing added in aacf6ae3 * remove constraint * fix PIPENV_SYSTEM * remove constraint * don't need this here * bump * bump pipenv adds support for installing local pyprojects (can add openpilot as dependency of xx) * README improvements * probably not necessary * bump pip * maybe not necessary? * revert * don't install openpilot itself into the virtual env * remove PySide2 and shiboken2 reverts 3e41c775cbf670740ac648a8614d2d6b433312fe * remove Pipenv, add xx dependencies, sync system python * add pipenv as xx dep * semver package constraints, use old lockfile versions * fix casadi * remove whitespace Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> * disable poetry cache * cleanup * prefer config file Co-authored-by: Cameron Clough <cameronjclough@gmail.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: a98d105cb95a445f5ec69e783585c56604b09449
74 lines
1.8 KiB
Bash
Executable File
74 lines
1.8 KiB
Bash
Executable File
#!/bin/bash
|
|
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
|
|
|
|
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)"
|
|
|
|
PYENV_PYTHON_VERSION=$(cat .python-version)
|
|
if ! pyenv prefix ${PYENV_PYTHON_VERSION} &> /dev/null; then
|
|
# no pyenv update on mac
|
|
if [ "$(uname)" == "Linux" ]; then
|
|
echo "pyenv update ..."
|
|
pyenv update
|
|
fi
|
|
echo "python ${PYENV_PYTHON_VERSION} install ..."
|
|
CONFIGURE_OPTS="--enable-shared" pyenv install -f ${PYENV_PYTHON_VERSION}
|
|
fi
|
|
eval "$(pyenv init --path)"
|
|
|
|
echo "update pip"
|
|
pip install pip==22.3
|
|
pip install poetry==1.2.2
|
|
|
|
poetry config virtualenvs.prefer-active-python true --local
|
|
|
|
POETRY_INSTALL_ARGS=""
|
|
if [ -d "./xx" ]; then
|
|
echo "WARNING: using xx dependency group, installing globally"
|
|
poetry config virtualenvs.create false --local
|
|
POETRY_INSTALL_ARGS="--with xx --sync"
|
|
fi
|
|
|
|
echo "pip packages install..."
|
|
poetry install --no-cache --no-root $POETRY_INSTALL_ARGS
|
|
pyenv rehash
|
|
|
|
if [ -d "./xx" ] || [ -n "$POETRY_VIRTUALENVS_CREATE" ]; then
|
|
RUN=""
|
|
else
|
|
echo "PYTHONPATH=${PWD}" > .env
|
|
RUN="poetry run"
|
|
fi
|
|
|
|
echo "pre-commit hooks install..."
|
|
shopt -s nullglob
|
|
for f in .pre-commit-config.yaml */.pre-commit-config.yaml; do
|
|
cd $DIR/$(dirname $f)
|
|
if [ -e ".git" ]; then
|
|
$RUN pre-commit install
|
|
fi
|
|
done
|