File: bootstrap

package info (click to toggle)
python-syrupy 4.9.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,368 kB
  • sloc: python: 5,978; makefile: 3
file content (40 lines) | stat: -rwxr-xr-x 1,124 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Based on conventions from https://github.com/github/scripts-to-rule-them-all
# script/bootstrap: Resolve all dependencies that the application requires to
# run.

# If not in CI, we have to install the correct python versions
if [[ -z $CI ]]; then
    # pyenv update
    pyenv install --skip-existing || return
fi

POETRY_HOME=`pwd`/.poetry
POETRY_BIN="$POETRY_HOME/bin/poetry"
if [[ ! -z $CI ]]; then
    POETRY_BIN=poetry
fi

if [[ -z $CI ]]; then
    # FIXME: There must be a better way to install this per project rather than globally?
    curl -sSL https://install.python-poetry.org | POETRY_HOME="$POETRY_HOME" python3 - --version $(cat .poetry-version)
    $POETRY_BIN env use $(cat .python-version)
fi

if [[ -z $SKIP_DEPS ]]; then
    $POETRY_BIN install --with=dev --with=test --no-interaction
fi

if [[ -z $CI ]]; then
    . ./.venv/bin/activate
    if [[ ! "$PATH" =~ "$POETRY_HOME" ]]; then
        export PATH="$POETRY_HOME/bin:$PATH"
    fi
fi

if [[ -z $CI ]]; then
    python -m python_githooks

    if ! complete -p invoke &>/dev/null; then
        source <(inv --print-completion-script bash)
    fi
fi