|
|
@ -2,7 +2,8 @@ |
|
|
|
set -e |
|
|
|
set -e |
|
|
|
|
|
|
|
|
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" |
|
|
|
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" |
|
|
|
cd $DIR |
|
|
|
ROOT=$DIR/../ |
|
|
|
|
|
|
|
cd $ROOT |
|
|
|
|
|
|
|
|
|
|
|
RC_FILE="${HOME}/.$(basename ${SHELL})rc" |
|
|
|
RC_FILE="${HOME}/.$(basename ${SHELL})rc" |
|
|
|
if [ "$(uname)" == "Darwin" ] && [ $SHELL == "/bin/bash" ]; then |
|
|
|
if [ "$(uname)" == "Darwin" ] && [ $SHELL == "/bin/bash" ]; then |
|
|
@ -32,7 +33,7 @@ fi |
|
|
|
|
|
|
|
|
|
|
|
export MAKEFLAGS="-j$(nproc)" |
|
|
|
export MAKEFLAGS="-j$(nproc)" |
|
|
|
|
|
|
|
|
|
|
|
PYENV_PYTHON_VERSION=$(cat .python-version) |
|
|
|
PYENV_PYTHON_VERSION=$(cat $ROOT/.python-version) |
|
|
|
if ! pyenv prefix ${PYENV_PYTHON_VERSION} &> /dev/null; then |
|
|
|
if ! pyenv prefix ${PYENV_PYTHON_VERSION} &> /dev/null; then |
|
|
|
# no pyenv update on mac |
|
|
|
# no pyenv update on mac |
|
|
|
if [ "$(uname)" == "Linux" ]; then |
|
|
|
if [ "$(uname)" == "Linux" ]; then |
|
|
@ -50,32 +51,20 @@ pip install poetry==1.5.1 |
|
|
|
|
|
|
|
|
|
|
|
poetry config virtualenvs.prefer-active-python true --local |
|
|
|
poetry config virtualenvs.prefer-active-python true --local |
|
|
|
|
|
|
|
|
|
|
|
if [[ -n "$XX" ]] || [[ "$(basename "$(dirname "$(pwd)")")" == "xx" ]]; then |
|
|
|
echo "PYTHONPATH=${PWD}" > $ROOT/.env |
|
|
|
XX=true |
|
|
|
poetry self add poetry-dotenv-plugin@^0.1.0 |
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
POETRY_INSTALL_ARGS="--no-cache --no-root" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [ -n "$XX" ]; then |
|
|
|
|
|
|
|
echo "WARNING: using xx dependency group, installing globally" |
|
|
|
|
|
|
|
poetry config virtualenvs.create false --local |
|
|
|
|
|
|
|
POETRY_INSTALL_ARGS="$POETRY_INSTALL_ARGS --with xx --sync" |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
echo "PYTHONPATH=${PWD}" > .env |
|
|
|
|
|
|
|
poetry self add poetry-dotenv-plugin@^0.1.0 |
|
|
|
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo "pip packages install..." |
|
|
|
echo "pip packages install..." |
|
|
|
poetry install $POETRY_INSTALL_ARGS |
|
|
|
poetry install --no-cache --no-root |
|
|
|
pyenv rehash |
|
|
|
pyenv rehash |
|
|
|
|
|
|
|
|
|
|
|
[ -n "$XX" ] || [ -n "$POETRY_VIRTUALENVS_CREATE" ] && RUN="" || RUN="poetry run" |
|
|
|
[ -n "$POETRY_VIRTUALENVS_CREATE" ] && RUN="" || RUN="poetry run" |
|
|
|
|
|
|
|
|
|
|
|
if [ "$(uname)" != "Darwin" ]; then |
|
|
|
if [ "$(uname)" != "Darwin" ]; then |
|
|
|
echo "pre-commit hooks install..." |
|
|
|
echo "pre-commit hooks install..." |
|
|
|
shopt -s nullglob |
|
|
|
shopt -s nullglob |
|
|
|
for f in .pre-commit-config.yaml */.pre-commit-config.yaml; do |
|
|
|
for f in .pre-commit-config.yaml */.pre-commit-config.yaml; do |
|
|
|
if [ -e "$DIR/$(dirname $f)/.git" ]; then |
|
|
|
if [ -e "$ROOT/$(dirname $f)/.git" ]; then |
|
|
|
$RUN pre-commit install -c "$f" |
|
|
|
$RUN pre-commit install -c "$f" |
|
|
|
fi |
|
|
|
fi |
|
|
|
done |
|
|
|
done |