forked from ubernostrum/django-contact-form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
60 lines (51 loc) · 1.48 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
PACKAGE_NAME=contact_form
TESTING_VENV_NAME=${PACKAGE_NAME}_test
ifndef PYTHON_VERSION
PYTHON_VERSION=3.6.0
endif
ifndef DJANGO_VERSION
DJANGO_VERSION=1.10
endif
.PHONY: clean
clean:
python setup.py clean
rm -rf build/
rm -rf dist/
rm -rf *.egg*/
rm -rf ${PACKAGE_NAME}/__pycache__/
rm -rf ${PACKAGE_NAME}/tests/__pycache__/
find ${PACKAGE_NAME} -type f -name '*.pyc' -delete
rm -f MANIFEST
rm -rf coverage .coverage .coverage*
pip uninstall -y Django
.PHONY: venv
venv:
[ -e ~/.pyenv/versions/${TESTING_VENV_NAME} ] && \
echo "\033[1;33mA ${TESTING_VENV_NAME} pyenv already exists. Skipping pyenv creation.\033[0m" || \
pyenv virtualenv ${PYTHON_VERSION} ${TESTING_VENV_NAME}
pyenv local ${TESTING_VENV_NAME}
pip install --upgrade pip setuptools
.PHONY: teardown
teardown: clean
pyenv uninstall -f ${TESTING_VENV_NAME}
rm .python-version
.PHONY: django
django:
pip install Django~=${DJANGO_VERSION}.0
.PHONY: test_dependencies
test_dependencies:
[ -e test_requirements.txt ] && \
pip install -r test_requirements.txt || \
echo "\033[1;33mNo test_requirements.txt found. Skipping install of test_requirements.txt.\033[0m"
pip install -r test_requirements.txt
.PHONY: lint
lint: test_dependencies
flake8 ${PACKAGE_NAME}
.PHONY: test
test: django lint
[ -e requirements.txt ] \
&& pip install -r requirements.txt || \
echo "\033[1;33mNo requirements.txt found. Skipping install of requirements.txt.\033[0m"
pip install -e .
coverage run ${PACKAGE_NAME}/runtests.py
coverage report -m