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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
|
# Copyright 2014-2017 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
# Pending merge
DEPLOYER="lp:juju-deployer/darwin"
CODETREE="lp:codetree"
JUJUCLIENT="lp:python-jujuclient"
WEBSOCKETCLIENT="https://github.com/liris/websocket-client.git"
PYTHON := /usr/bin/env python
TESTS=mojo/tests/
PROJECT=mojo
DIST_PACKAGES=python-setuptools python-jinja2 lxc git python-nose juju-deployer juju python-argcomplete
SHELL := /bin/bash
USERINSTALL=--user
install: install-deps
python setup.py install $(USERINSTALL)
install-deps: get-deps
cd deps/websocket-client && python setup.py install $(USERINSTALL)
cd deps/python-jujuclient && python setup.py install $(USERINSTALL)
cd deps/juju-deployer && python setup.py install $(USERINSTALL)
cd deps/codetree && python setup.py install $(USERINSTALL)
get-deps: dist-deps deps/codetree deps/juju-deployer
dpkg -l python-yaml 2>&1 >/dev/null || sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install python-yaml
dist-deps:
dpkg-query -W $(DIST_PACKAGES) || sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $(DIST_PACKAGES)
deps-dir:
mkdir -p deps
deps/codetree: deps-dir
[ -d deps/codetree ] || bzr branch $(CODETREE) deps/codetree
cd deps/codetree && bzr update
deps/juju-deployer: deps/python-jujuclient
[ -d deps/juju-deployer ] || bzr branch $(DEPLOYER) deps/juju-deployer
cd deps/juju-deployer && bzr update
deps/python-jujuclient: deps/websocket-client
[ -d deps/python-jujuclient ] || bzr branch $(JUJUCLIENT) deps/python-jujuclient
cd deps/python-jujuclient && bzr update
deps/websocket-client: deps-dir
[ -d deps/websocket-client ] || git clone $(WEBSOCKETCLIENT) deps/websocket-client
cd deps/websocket-client && git checkout master
clean:
find . -name \*.pyc -exec rm -f {} \;
rm -rf deps/* mojo/__pycache__
rm -rf build dist mojo.egg-info
rm -f debian/files
rm -rf debian/mojo
rm -f debian/*debhelper*
rm -f debian/mojo.substvars
rm -rf parts
rm -rf prime
rm -rf stage
rm -f *.snap
test:
@echo "Starting tests (including unit tests)..."
@$(PYTHON) /usr/bin/nosetests $(TESTS)
unit-test:
@echo Starting unit tests...
@$(PYTHON) /usr/bin/nosetests -e test_container.py $(TESTS)
lint:
@echo "Checking for Python 2 syntax (ignoring jujuwait.py which is an external project)..."
@python2 -m flake8 --max-complexity=30 --max-line-length=131 --hang-closing --exclude='mojo/juju/wait.py,mojo/juju/__init__.py' $(PROJECT) && echo OK
lint-complex:
@echo "Checking for Python 2 syntax and complexity (ignoring jujuwait.py which is an external project)..."
@python2 -m flake8 --max-complexity=10 --max-line-length=131 --hang-closing --exclude='mojo/juju/wait.py,mojo/juju/__init__.py' $(PROJECT) && echo OK
build: test lint
dist:
bzr export --root=. ../mojo_$$(python setup.py --version).orig.tar.bz2 .
dch:
dch -D trusty --newversion $$(python setup.py -V)
deb: dist dch
cd debian && debuild -sa -I.bzr
deb-src: dist dch
cd debian && debuild -S -sa -I.bzr
clean-docs:
@echo Cleaning documentation directory...
cd docs/www && rm -f *.html
generate-docs: clean-docs
@echo Generating html documentation in docs/www...
for mdfile in docs/mojo/*.md; do \
htmlfile=$${mdfile%.*}.html ; \
htmlfile=$${htmlfile/mojo/www} ; \
cp docs/templates/header.html $${htmlfile} ; \
markdown $$mdfile >> $${htmlfile} ; \
cat docs/templates/footer.html >> $${htmlfile} ; \
done
|