-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
39 lines (32 loc) · 1.06 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
default: test
.PHONY: test
test:
$(info -----------------------------------------------------------)
. venv/bin/activate ; \
sh -c ' \
pytest -rxXs --tap-stream tests/*/*.py --color=auto --full-trace; \
pytest -rxXs --cov=ngram tests/*/*.py; \
'
.PHONY: image
image:
docker build -t ngram .
.PHONY: venv
venv:
test -e "$(shell which pip3)" || apt install -y --no-install-recommends --no-install-suggests curl python3-pip python3-venv
pip3 install --upgrade setuptools wheel virtualenv
python3 -m venv venv
. venv/bin/activate ;\
pip3 install -Ur requirements.txt
.PHONY: run
run: venv/bin/activate
$(info -----------------------------------------------------------)
mkdir -p tmp
curl 'https://baconipsum.com/api/?type=meat-and-filler¶s=2&format=text' -o tmp/bacon-ipsum.txt
. venv/bin/activate ; \
./ngram-plot.py --file tmp/bacon-ipsum.txt --n 2
.PHONY: clean
clean:
rm -fr ./venv/ __pycache__/ *.egg-info/ .coverage *.tap .pytest_cache tmp/bacon-ipsum.txt
find . -type d -iname "__pycache__" -exec rm -r {} +
.PHONY: all
all: venv test run clean