diff --git a/.coveragerc b/.coveragerc index 0fc95f1..2149cfe 100644 --- a/.coveragerc +++ b/.coveragerc @@ -1,7 +1,7 @@ [run] omit = devserver.py - .venv/** + venv/** */tests/** */lib/** diff --git a/.gitignore b/.gitignore index 59a2fba..7200d2f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ .idea/ *.iml *.zip -.venv +venv .env .env.dev lib diff --git a/Makefile b/Makefile index 64a6a83..37a24c7 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,22 @@ -.PHONY: all env virtualenv install nopyc clean test run-devserver +.PHONY: all env install nopyc clean test run-devserver SHELL := /usr/bin/env bash +PYTHON_BIN ?= python +PROJECT_VENV ?= venv -all: env virtualenv install +all: test env: cp -n .env.example .env | true cp -n .env.dev.example .env.dev | true -virtualenv: - @if [ ! -d ".venv" ]; then \ - python3 -m pip install virtualenv --user; \ - python3 -m virtualenv .venv; \ - fi +venv: + python -m pip install virtualenv --user + python -m virtualenv $(PROJECT_VENV) -install: env virtualenv +install: env venv @( \ - source .venv/bin/activate; \ + source $(PROJECT_VENV)/bin/activate; \ python -m pip install -r requirements.txt -t ./lib; \ python -m pip install -r requirements.txt -r requirements-dev.txt; \ ) @@ -26,16 +26,16 @@ nopyc: find . -name __pycache__ | xargs rm -rf || true clean: nopyc - rm -rf build .venv + rm -rf build $(PROJECT_VENV) test: install @( \ - source .venv/bin/activate; \ + source $(PROJECT_VENV)/bin/activate; \ coverage run -m unittest discover -v -b && coverage report && coverage xml && coverage html; \ ) run-devserver: install @( \ - source .venv/bin/activate; \ + source $(PROJECT_VENV)/bin/activate; \ FLASK_SKIP_DOTENV=1 FLASK_ENV=development FLASK_APP=devserver.py flask run; \ )