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
|
# Copyright 2014-2020 Canonical Ltd. This software is licensed under the
# GNU General Public License version 3 (see the file LICENSE).
PYTHON := python3
PROJECT := mojo
DIST_PACKAGES := lxc bzr git
GOT_JUJU := $(shell which juju)
ifndef GOT_JUJU
DIST_PACKAGES := "$(DIST_PACKAGES) juju"
JUJU := /usr/bin/juju
endif
SHELL := /bin/bash
USERINSTALL=--user
install: dist-deps
$(PYTHON) setup.py install $(USERINSTALL)
dist-deps:
dpkg-query -W $(DIST_PACKAGES) || sudo env DEBIAN_FRONTEND=noninteractive apt-get -qq -y install $(DIST_PACKAGES)
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)..."
tox
unit-test:
@echo Starting unit tests...
tox -- -e test_container.py
lint: blacken
@echo "Checking for Python syntax (ignoring jujuwait.py which is an external project)..."
tox -e lint && echo OK
lint-complex: blacken
@echo "Checking for Python syntax and complexity (ignoring jujuwait.py which is an external project)..."
FLAKE8_COMPLEXITY=10 tox -e lint && echo OK
blacken:
@echo "Reformatting code with black..."
tox -e black && echo OK
# Is this still working after the switch to tox?
#
# run-lxc-test:
# @echo "Running tests inside an LXC..."
# @./contrib/test/lxc-test
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
|