~caio1982/mojo/local_repo_keys

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
# Copyright 2014 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

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 apt-get install python-yaml

dist-deps:
	dpkg-query -W $(DIST_PACKAGES) || sudo apt-get install $(DIST_PACKAGES)

deps/codetree:
	[ -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:
	[ -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

test-all:
	@echo Starting tests...
	@$(PYTHON) /usr/bin/nosetests $(TESTS)

test:
	@echo Starting tests, excluding bzr.py...
	@$(PYTHON) /usr/bin/nosetests -e test_bzr.py $(TESTS)

lint:
	@echo Checking for Python syntax...
	@flake8 --ignore=E123,E501 $(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 Generatiing 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