Skip to content

Commit

Permalink
import: add bin/setup / bin/clean for convenience
Browse files Browse the repository at this point in the history
  • Loading branch information
jone committed Sep 6, 2024
1 parent adfdd49 commit 10be4bb
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
28 changes: 28 additions & 0 deletions import/bin/_load-venv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
set -euo pipefail

upfind () {
if [ "$(realpath `dirname $1`)" == "/" ]; then
echo "ERROR: no $(basename $1) found in any parent directory."
exit 1
fi
ls -d $1 2>/dev/null || upfind ../$1
}

if [ "${DISABLE_PROJECT_VENV_AUTO_CREATION:-}" == "" ]; then
if [ ! -x ./venv/bin/python ]; then
if hash pyenv 2>/dev/null; then
pyenv exec python -m venv venv
else
pythonVersion=$(cat $(upfind .python-version))
pythonExecutable=python$pythonVersion
if ! hash $pythonExecutable 2>/dev/null; then
echo "ERROR: missing pyenv or $pythonExecutable"
exit 1
fi
$pythonExecutable -m venv venv
fi
./venv/bin/pip install -U pip
fi
source ./venv/bin/activate
fi
8 changes: 8 additions & 0 deletions import/bin/setup
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "$0")/.."
. bin/_load-venv

pip install -U pip
pip install poetry
poetry install

0 comments on commit 10be4bb

Please sign in to comment.