/
Makefile
138 lines (116 loc) · 5.08 KB
/
Makefile
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
#/***************************************************************************
# Riab
#
# Disaster risk assessment tool developed by AusAid and World Bank
# -------------------
# begin : 2012-01-09
# copyright : (C) 2012 by Australia Indonesia Facility for Disaster Reduction
# email : ole.moller.nielsen@gmail.com
# ***************************************************************************/
#
#/***************************************************************************
# * *
# * This program is free software; you can redistribute it and/or modify *
# * it under the terms of the GNU General Public License as published by *
# * the Free Software Foundation; either version 2 of the License, or *
# * (at your option) any later version. *
# * *
# ***************************************************************************/
# Makefile for Risk in a Box - QGIS
NONGUI := storage engine impact_functions
GUI := gui
ALL := $(NONGUI) $(GUI) # Would like to turn this into comma separated list using e.g. $(subst,...) or $(ALL, Wstr) but None of that works as described in the various posts
default: compile
compile:
make -C gui
docs: compile
cd docs; make html; cd ..
clean:
@# FIXME (Ole): Use normal Makefile rules instead
@# Preceding dash means that make will continue in case of errors
@# Swapping stdout & stderr and filter out low level QGIS garbage
@# See http://stackoverflow.com/questions/3618078/pipe-only-stderr-through-a-filter
@-find . -name '*~' -exec rm {} \;
@-find . -name '*.pyc' -exec rm {} \;
@-/bin/rm .noseids 2>/dev/null || true
# Run the test suite followed by pep8 style checking
test: test_suite pep8 disabled_tests dependency_test unwanted_strings
# Run the test suite for gui only
guitest: gui_test_suite pep8 disabled_tests dependency_test unwanted_strings
# Run pep8 style checking
pep8:
@echo
@echo "-----------"
@echo "PEP8 issues"
@echo "-----------"
@pep8 --repeat --ignore=E203 --exclude ui_riab.py,ui_riabdock.py,resources.py,resources_rc.py,ui_riabhelp.py .
# Run entire test suite
test_suite: compile testdata
@echo
@echo "----------------------"
@echo "Regresssion Test Suite"
@echo "----------------------"
@-export PYTHONPATH=`pwd`; nosetests -v --with-id --with-coverage --cover-package=storage,engine,impact_functions,gui 3>&1 1>&2 2>&3 3>&- | grep -v "^Object::" || true
@# FIXME (Ole) - to get of the remaining junk I tried to use
@# ...| awk 'BEGIN {FS="Object::"} {print $1}'
@# This does clip the line, but does not flush and puts an extra
@# newline in.
@# Report expected failures if any!
@#echo Expecting 1 test to fail in support of issue 52
# Run gui test suite only
gui_test_suite: compile testdata
@echo
@echo "----------------------"
@echo "Regresssion Test Suite"
@echo "----------------------"
@# Preceding dash means that make will continue in case of errors
@-export PYTHONPATH=`pwd`; nosetests -v --with-id --with-coverage --cover-package=gui gui 3>&1 1>&2 2>&3 3>&- | grep -v "^Object::" || true
# Get test data
testdata:
@echo
@echo "-----------------------------------------------------------"
@echo "Updating test data - please hit Enter if asked for password"
@echo "-----------------------------------------------------------"
@svn co http://www.aifdr.org/svn/riab_test_data
disabled_tests:
@echo
@echo "--------------"
@echo "Disabled tests"
@echo "--------------"
@grep -R Xtest * | grep ".py:" | grep -v "docs/build/html" || true
unwanted_strings:
@echo
@echo "------------------------------"
@echo "Strings that should be deleted"
@echo "------------------------------"
@grep -R "settrace()" * | grep ".py:" | grep -v Makefile || true
dependency_test:
@echo
@echo "---------------------------------------------"
@echo "List of unwanted dependencies in RIAB library"
@echo "---------------------------------------------"
@# Need disjunction with "true" because grep returns non-zero error code if no matches were found
@# nielso@shakti:~/sandpit/risk_in_a_box$ grep PyQt4 engine
@# nielso@shakti:~/sandpit/risk_in_a_box$ echo $?
@# 1
@# See http://stackoverflow.com/questions/4761728/gives-an-error-in-makefile-not-in-bash-when-grep-output-is-empty why we need "|| true"
@grep -R PyQt4 $(NONGUI) || true
@grep -R qgis.core $(NONGUI) || true
@grep -R "import scipy" $(NONGUI) || true
@grep -R "from scipy import" $(NONGUI) || true
@grep -R "django" $(NONGUI) || true
@grep -R "geonode" $(NONGUI) || true
list_gis_packages:
@echo
@echo "---------------------------------------"
@echo "List of QGis related packages installed"
@echo "---------------------------------------"
@dpkg -l | grep qgis || true
@dpkg -l | grep gdal || true
@dpkg -l | grep geos || true
pylint:
@echo
@echo "---------------------------------------"
@echo "Pylint report "
@echo "---------------------------------------"
pylint --disable=C,R storage engine gui