From eabba3ca8695a5a287180cc3e84d8c78be61fcf3 Mon Sep 17 00:00:00 2001 From: Cameron Clough Date: Fri, 21 Apr 2023 22:36:10 -0700 Subject: [PATCH] update update_requirements.sh (#28002) * simplify update_requirements.sh * check POETRY_VIRTUALENVS_CREATE old-commit-hash: 16c56e644e3df603a72bc5dbd80553e1e0509644 --- update_requirements.sh | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/update_requirements.sh b/update_requirements.sh index b430df59e5..b2b36e7097 100755 --- a/update_requirements.sh +++ b/update_requirements.sh @@ -50,25 +50,27 @@ pip install poetry==1.2.2 poetry config virtualenvs.prefer-active-python true --local -POETRY_INSTALL_ARGS="" -if [ -d "./xx" ] || [ -n "$XX" ]; then - echo "WARNING: using xx dependency group, installing globally" - poetry config virtualenvs.create false --local - POETRY_INSTALL_ARGS="--with xx --sync" +if [[ -n "$XX" ]] || [[ "$(basename "$(dirname "$(pwd)")")" == "xx" ]]; then + XX=true fi -echo "pip packages install..." -poetry install --no-cache --no-root $POETRY_INSTALL_ARGS -pyenv rehash +POETRY_INSTALL_ARGS="--no-cache --no-root" -if [ -d "./xx" ] || [ -n "$POETRY_VIRTUALENVS_CREATE" ]; then - RUN="" +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 - RUN="poetry run" fi +echo "pip packages install..." +poetry install $POETRY_INSTALL_ARGS +pyenv rehash + +[ -n "$XX" ] || [ -n "$POETRY_VIRTUALENVS_CREATE" ] && RUN="" || RUN="poetry run" + if [ "$(uname)" != "Darwin" ]; then echo "pre-commit hooks install..." shopt -s nullglob