-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile.janitoo
145 lines (123 loc) · 5 KB
/
Makefile.janitoo
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# Common makefile for janitoo's projects
#
# You can set these variables from the command line.
ARCHBASE = archive
BUILDDIR = build
DISTDIR = dists
NOSEOPTS = --verbosity=2
PYLINTOPTS = --max-line-length=140 --max-args=9 --min-public-methods=0
ifndef PYTHON_EXEC
PYTHON_EXEC=python
endif
ifndef message
message="Auto-commit"
endif
python_version_full := $(wordlist 2,4,$(subst ., ,$(shell ${PYTHON_EXEC} --version 2>&1)))
python_version_major = $(word 1,${python_version_full})
python_version_minor = $(word 2,${python_version_full})
python_version_patch = $(word 3,${python_version_full})
ifdef VIRTUAL_ENV
PYTHON_EXEC=${VIRTUAL_ENV}/bin/python
python_version_full := $(wordlist 2,4,$(subst ., ,$(shell ${PYTHON_EXEC} --version 2>&1)))
PIP_EXEC=${VIRTUAL_ENV}/bin/pip
NOSE=${VIRTUAL_ENV}/bin/nosetests
PYLINT=${VIRTUAL_ENV}/bin/pylint
python_version_major = $(word 1,${python_version_full})
python_version_minor = $(word 2,${python_version_full})
python_version_patch = $(word 3,${python_version_full})
else
PIP_EXEC=pip
ifeq (${python_version_major},3)
PIP_EXEC=pip3
endif
NOSE=$(shell which nosetests)
PYLINT=$(shell which pylint)
endif
janitoo_version := $(shell ${PYTHON_EXEC} _version.py 2>/dev/null)
SUBMODULES = $(shell find . -maxdepth 1 -iname jani\* -type d|sort|sed -e 's/janitoo_nosetests_flask//g'|sed -e 's/janitoo_nosetests//g'|sed -e 's/janitoo_sphinx//g')
COREMODULES = janitoo janitoo_factory janitoo_factory_exts janitoo_db janitoo_flask janitoo_flask_socketio janitoo_manager janitoo_manager_proxy janitoo_datalog_rrd janitoo_thermal janitoo_hostsensor janitoo_layouts
TESTMODULES = janitoo_nosetests janitoo_nosetests_flask
#~ NOSECOVER = --cover-package=${MODULENAME} --with-coverage --cover-inclusive --cover-html --cover-html-dir=${BUILDDIR}/docs/html/tools/coverage --with-html --html-file=${BUILDDIR}/docs/html/tools/nosetests/index.html
NOSECOVER = --cover-package=${MODULENAME} --with-coverage --cover-inclusive --cover-html --cover-html-dir=${BUILDDIR}/docs/html/tools/coverage
NOSEDOCKER = --cover-package=${NOSEMODULES},${MODULENAME},${MOREMODULES} --with-coverage --cover-inclusive --with-xunit --xunit-testsuite-name=${MODULENAME}
MODULENAME = $(shell basename `pwd`)
DOCKERNAME = $(shell echo ${MODULENAME}|sed -e "s|janitoo_||g")
DOCKERVOLS =
DOCKERPORT = 8882
NOSEMODULES = janitoo,janitoo_factory,janitoo_db
MOREMODULES = janitoo_factory_ext,janitoo_raspberry
DEBIANDEPS := $(shell [ -f debian.deps ] && cat debian.deps)
BASHDEPS := $(shell [ -f bash.deps ] && echo "bash.deps")
JANITOODEPS := $(shell [ -f janitoo.deps ] && echo janitoo.deps)
BOWERDEPS := $(shell [ -f bower.deps ] && cat bower.deps)
TAGGED := $(shell git tag | grep -c v${janitoo_version} )
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " build : build the module"
@echo " develop : install for developpers"
@echo " install : install for users"
@echo " uninstall : uninstall the module"
@echo " deps : install dependencies for users"
@echo " doc : make documentation"
@echo " tests : launch tests"
@echo " clean : clean the development directory"
env:
@echo "Python ${PYTHON_EXEC} (${python_version_full})"
@echo "Pip ${PIP_EXEC}"
@echo "Nose ${NOSE}"
@echo "Modules ${SUBMODULES}"
@echo "Core modules ${COREMODULES}"
clean-doc:
-rm -Rf ${BUILDDIR}/docs
-rm -Rf ${BUILDDIR}/janidoc
-rm -f objects.inv
-rm -f generated_doc
-rm -f janidoc
janidoc:
-ln -s /opt/janitoo/src/janitoo_sphinx janidoc
apidoc:
-rm -rf ${BUILDDIR}/janidoc/source/api
-mkdir -p ${BUILDDIR}/janidoc/source/api
cp -Rf janidoc/* ${BUILDDIR}/janidoc/
cd ${BUILDDIR}/janidoc/source/api && sphinx-apidoc --force --no-toc -o . ../../../../src/
cd ${BUILDDIR}/janidoc/source/api && mv ${MODULENAME}.rst index.rst
doc: janidoc apidoc
- [ -f transitions_graph.py ] && python transitions_graph.py
-git commit -m "Update bus fsm image" rst/images/fsm_bus.png
-cp -Rf rst/* ${BUILDDIR}/janidoc/source
sed -i -e "s/MODULE_NAME/${MODULENAME}/g" ${BUILDDIR}/janidoc/source/tools/index.rst
make -C ${BUILDDIR}/janidoc html
cp ${BUILDDIR}/janidoc/source/README.rst README.rst
-ln -s $(BUILDDIR)/docs/html generated_doc
@echo
@echo "Documentation finished."
github.io:
git checkout --orphan gh-pages
git rm -rf .
touch .nojekyll
git add .nojekyll
git commit -m "Initial import" -a
git push origin gh-pages
git checkout master
@echo
@echo "github.io branch initialised."
doc-full: tests pylint doc-commit
doc-commit: doc
git checkout gh-pages
cp -Rf build/docs/html/* .
git add *.html
git add *.js
git add tools/
git add api/
-git add _images/
-git add _modules/
-git add _sources/
-git add _static/
git commit -m "Auto-commit documentation" -a
git push origin gh-pages
git checkout master
@echo
@echo "Documentation published to github.io."
pylint:
-mkdir -p ${BUILDDIR}/docs/html/tools/pylint
$(PYLINT) --output-format=html $(PYLINTOPTS) src/${MODULENAME} >${BUILDDIR}/docs/html/tools/pylint/index.html