bundlewrap/.envrc
2023-05-05 18:25:21 +02:00

31 lines
928 B
Bash

#!/usr/bin/env bash
if test -f .venv/bin/python && test "$(realpath .venv/bin/python)" != "$(realpath "$(pyenv which python)")"
then
echo "rebuilding venv für new python version"
rm -rf .venv
fi
python3 -m venv .venv
source .venv/bin/activate
PATH_add .venv/bin
PATH_add bin
python3 -m pip --require-virtualenv --quiet install --upgrade pip wheel
python3 -m pip --require-virtualenv --quiet install --upgrade -r requirements.txt
# git deploy cache
export BW_GIT_DEPLOY_CACHE=".cache/bw/git_deploy"
CREATED_AT=$(stat -f "%Sa" "$BW_GIT_DEPLOY_CACHE" | xargs -I{} date -f '%b %d %H:%M:%S %Y' -j "{}" '+%s')
NOW_AT=$(date +%s)
SECONDS_SINCE=$(expr "$NOW_AT" - "$CREATED_AT")
if [[ "$SECONDS_SINCE" > 86400 ]]
then
rm -rf "$BW_GIT_DEPLOY_CACHE"
fi
mkdir -p "$BW_GIT_DEPLOY_CACHE"
export EXPERIMENTAL_UPLOAD_VIA_CAT=1
export BW_ITEM_WORKERS=32
export BW_NODE_WORKERS=12
export DISK_CACHE_DIR=.cache/cache_to_disk
unset PS1