-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
52 lines (39 loc) · 1.16 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
.PHONY: clean deploy distclean install pep8 test
# Project settings
PROJECT = flax_id
# Virtual environment settings
ENV ?= venv
VENV = $(shell python -c "import sys; print(int(hasattr(sys, 'real_prefix')));")
# Python commands
ifeq ($(VENV),1)
FLAKE8 = flake8
TOX = tox
else
FLAKE8 = $(ENV)/bin/flake8
TOX = $(ENV)/bin/tox
endif
# Setup bootstrap args & tox settings
has_bootstrapper = $(shell python -m bootstrapper --version 2>&1 | grep -v "No module")
requirements = -r requirements.txt
# List directories
dist_dir = ./dist
tox_dir = ./.tox
clean_dirs = ./$(PROJECT) $(ENV) $(shell [ -d $(tox_dir) ] && echo $(tox_dir) || :)
all: install
clean:
find $(clean_dirs) \( -name "*.pyc" -o -name __pycache__ -o -type d -empty \) -exec rm -rf {} + 2> /dev/null
distclean: clean
rm -rf $(ENV)/ ./build/ $(dist_dir)/ ./*egg* ./.coverage $(tox_dir)/
install: .install
.install: requirements.txt setup.py
ifneq ($(has_bootstrapper),)
python -m bootstrapper -e $(ENV)/
else
[ ! -d $(ENV)/ ] && virtualenv $(ENV)/ || :
$(ENV)/bin/pip install $(requirements)
endif
touch $@
pep8: .install
$(FLAKE8) --statistics ./$(PROJECT)/ setup.py
test: .install clean pep8
$(TOX)