-
Notifications
You must be signed in to change notification settings - Fork 12
/
Makefile
75 lines (64 loc) · 1.57 KB
/
Makefile
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
SHELL := /bin/bash
.SILENT: build clean devenv docs publish test lint
.IGNORE: clean
.ONESHELL:
BLUE:=\033[0;34m
RED:=\033[0;31m
NC:=\033[0m # No Color
BOLD:=$(tput bold)
NORM:=$(tput sgr0)
# the location of this file.
DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
# build the package from the source
build: devenv
. venv/bin/activate;
python -m build;
twine check --strict dist/*
clean:
rm -rf build/
rm -rf dist/
rm -rf kafe2.egg-info/
rm -rf venv/
rm -rf `find . -type d -name __pycache__`
cd doc && $(MAKE) clean
rm -f test-*.yml
devenv:
if [ ! -d "$(DIR)/venv" ]; then
echo "Creating venv";
python -m venv venv/;
fi
@if ! venv/bin/python -c "import kafe2" 2>/dev/null; then
echo "Installing kafe2 in editable mode";
. venv/bin/activate;
pip install --upgrade -e .[dev];
fi
docs: devenv
echo "Generating Docs"
. venv/bin/activate;
cd doc;
$(MAKE) html;
$(MAKE) latex;
publish: build
echo "uploading build to PyPI"
. venv/bin/activate;
twine upload ./dist/*
test: devenv
echo "Running Pytest and Coverage"
. venv/bin/activate;
pytest;
coverage run
lint: devenv
. venv/bin/activate;
echo -e "$(BLUE)${BOLD}ISORT${NC}$(NORM)";
isort --check --diff ./kafe2;
RET_Isort=$$?;
echo -e "$(BLUE)${BOLD}BLACK${NC}$(NORM)";
black --check --color --diff ./kafe2;
RET_Black=$$?;
echo -e "$(BLUE)${BOLD}FLAKE8${NC}$(NORM)";
flake8 --config .flake8 ./kafe2;
RET_Flake8=$$?;
if [ $$RET_Isort -ne 0 ] || [ $$RET_Black -ne 0 ] || [ $$RET_Flake8 -ne 0 ]; then
echo -e "$(RED)${BOLD}Linting failed${NC}$(NORM)";
exit 1;
fi