-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
57 lines (44 loc) · 1.46 KB
/
Makefile
File metadata and controls
57 lines (44 loc) · 1.46 KB
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
VIRTUALENV = virtualenv --python=python3
VENV_DIR = .venv
VENV := $(if $(VIRTUAL_ENV),$(VIRTUAL_ENV),$(VENV_DIR))
PYTHON = $(VENV)/bin/python
REQ_STAMP = $(VENV)/.req_stamp
# editable
MODULE_PATH=json_message_processor
.DEFAULT: help
help:
@echo "make init"
@echo " prepare development environment and create virtualenv"
@echo "make test"
@echo " run lint and unit tests"
@echo "make lint"
@echo " run lint only"
@echo "make dep"
@echo " dump the current pip packages to requirements.txt"
@echo "make clean"
@echo " clean compiled files and the virtual environment"
virtualenv: $(PYTHON) # creates a virtual environment
# one time virtualenv setup
$(PYTHON):
@$(VIRTUALENV) $(VENV)
@$(VENV)/bin/pip install --upgrade pip
@$(VENV)/bin/pip install --upgrade setuptools
@$(VENV)/bin/pip install pylint
@$(VENV)/bin/pip install coverage
init: virtualenv $(REQ_STAMP) # will run any time the requirements.txt file has been updated
$(REQ_STAMP): requirements.txt # install all module requirements
@$(VENV)/bin/pip install -Ur requirements.txt
@touch $(REQ_STAMP)
lint:
@$(VENV)/bin/pylint -j 4 ${MODULE_PATH}/*.py
test: init lint
@$(VENV)/bin/coverage run --branch -m unittest discover -s tests/
@$(VENV)/bin/coverage report --omit "*__init__*" -m ${MODULE_PATH}/*.py
dep:
@$(VENV)/bin/pip freeze > requirements.txt
clean:
@rm -rf $(VENV)
@find . -name "*.pyc" -delete
@find . -name "*.pyo" -delete
@find . -name .coverage -delete
.PHONY: init test lint dep