-
Notifications
You must be signed in to change notification settings - Fork 4
/
Makefile
80 lines (70 loc) · 1.89 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
76
77
78
79
80
ifndef MIG_ENV
MIG_ENV = 'local'
endif
ifeq ($(PY),2)
PYTHON_BIN = './envhelp/python2'
else
PYTHON_BIN = './envhelp/python3'
endif
ifeq ($(ALLDEPS),1)
REQS_PATH = ./recommended.txt
else
REQS_PATH = ./requirements.txt
endif
info:
@echo "Welcome to MiGrid"
@echo
@echo "The following should help you get started:"
@echo
@echo "'make test' - run the test suite"
@echo "'make PY=2 test' - run the test suite (python 2)"
.PHONY: fmt
fmt:
ifneq ($(MIG_ENV),'local')
@echo "unavailable outside local development environment"
@exit 1
endif
$(PYTHON_BIN) -m autopep8 --ignore E402 -i
.PHONY: clean
clean:
@rm -f ./envhelp/py2.imageid
@rm -f ./envhelp/py3.depends
.PHONY: distclean
distclean: clean
@rm -rf ./envhelp/venv
@rm -rf ./envhelp/output
@rm -rf ./tests/__pycache__
@rm -f ./tests/*.pyc
.PHONY: test
test: dependencies testconfig
@$(PYTHON_BIN) -m unittest discover -s tests/
.PHONY: dependencies
dependencies: ./envhelp/venv/pyvenv.cfg ./envhelp/py3.depends
.PHONY: testconfig
testconfig: ./envhelp/output/testconfs
./envhelp/output/testconfs:
@./envhelp/makeconfig test --python2
@./envhelp/makeconfig test
@mkdir -p ./envhelp/output/certs
@mkdir -p ./envhelp/output/state
@mkdir -p ./envhelp/output/state/log
ifeq ($(MIG_ENV),'local')
./envhelp/py3.depends: $(REQS_PATH) local-requirements.txt
else
./envhelp/py3.depends: $(REQS_PATH)
endif
@rm -f ./envhelp/py3.depends
@echo "upgrading venv pip as required for some dependencies"
@./envhelp/venv/bin/pip3 install --upgrade pip
@echo "installing dependencies from $(REQS_PATH)"
@./envhelp/venv/bin/pip3 install -r $(REQS_PATH)
ifeq ($(MIG_ENV),'local')
@echo ""
@echo "installing development dependencies"
@./envhelp/venv/bin/pip3 install -r local-requirements.txt
endif
@touch ./envhelp/py3.depends
./envhelp/venv/pyvenv.cfg:
@echo "provisioning environment"
@/usr/bin/env python3 -m venv ./envhelp/venv
@rm -f ./envhelp/py3.depends