Newer
Older
NewLang / env.sh
# SPDX-License-Identifier: LGPL-2.1-only
# Copyright 2022 Jookia <contact@jookia.org>

activate() { . venv/bin/activate; }

die() {
  rm -r venv
  echo "$1"
  exit 1
}

setup() {
  echo "No venv found, creating..."
  python3 -m venv venv || die "Unable to create venv"
  echo "Activating venv..."
  activate
  echo "Updating pip..."
  pip -q install -U pip || die "Unable to update pip"
  echo "Installing requirements..."
  pip -q install -r requirements.txt || die "Unable to install requirements"
  touch venv/.stamp
  echo "All done!"
}
 
if test -e venv/.stamp; then activate; else setup; fi

dotidy() { black src tests build.py; }
dolint() { flake8 src tests build.py; }
dotest() { pytest -q -n auto --hypothesis-profile=dev; }
dotest_ci() { pytest -q -n auto --hypothesis-profile=ci; }
dotest_long() { pytest -q -n auto --hypothesis-profile=long; }
docheck() { dotidy && dolint && dotest; }
domut() { mutmut run --paths-to-mutate "src/syntax.py src/tokenize.py src/parse.py"; }
dobuild() { python build.py; }