~celebdor/charms/trusty/midonet-api/trunk

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
#!/usr/bin/make
CODE=hooks
PYTHON := /usr/bin/env python
TESTS=unit_tests/

.venv2:
	virtualenv .venv2 --python=python2 --system-site-packages
	.venv2/bin/pip install -U pip
	.venv2/bin/pip install -I -r unit_test_requirements.txt

.venv3:
	virtualenv .venv3 --python=python3 --system-site-packages
	.venv3/bin/pip install -U pip
	.venv3/bin/pip install -U distribute
	.venv3/bin/pip install -I -r unit_test_requirements.txt

lint: .venv2 .venv3
	@.venv2/bin/flake8 --ignore=E501,H803 \
	    --exclude charmhelpers,test.py \
	    $(CODE) && echo Py2 OK
	@.venv3/bin/flake8 --ignore=E501,H803 \
	    $(CODE) && echo Py3 OK

test2: .venv2
	@echo Starting Py2 tests...
	PYTHONPATH=$(CODE) .venv2/bin/nosetests -s --nologcapture $(TESTS)

test3: .venv3
	@echo Starting Py3 tests...
	PYTHONPATH=$(CODE) .venv3/bin/nosetests -s --nologcapture $(TESTS)

test: lint test2 test3

bin/charm_helpers_sync.py:
	@mkdir -p bin
	@bzr cat lp:charm-helpers/tools/charm_helpers_sync/charm_helpers_sync.py \
        > bin/charm_helpers_sync.py

bin/midonet_helpers_sync.py:
	@mkdir -p bin
	@bzr cat \
	   lp:midonet-helpers/tools/midonet_helpers_sync/midonet_helpers_sync.py \
        > bin/midonet_helpers_sync.py

templates/repo.yaml:
	@bzr cat lp:midonet-helpers/templates/repo.yaml > templates/repo.yaml

sync: bin/charm_helpers_sync.py bin/midonet_helpers_sync.py templates/repo.yaml
	@$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-hooks.yaml
	@$(PYTHON) bin/charm_helpers_sync.py -c charm-helpers-tests.yaml
	@$(PYTHON) bin/midonet_helpers_sync.py -c midonet-helpers-hooks.yaml
	@$(PYTHON) bin/midonet_helpers_sync.py -c midonet-helpers-tests.yaml

publish: lint test
	bzr push lp:~celebdor/charms/trusty/midonet-api/trunk