-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
269 lines (226 loc) · 8.38 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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
#/***************************************************************************
# StreamFeatureExtractor
#
# A tool to extract features from a stream network.
# -------------------
# begin : 2014-05-07
# copyright : (C) 2014 by Linfiniti Consulting CC.
# email : [email protected]
# ***************************************************************************/
#
#/***************************************************************************
# * *
# * 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. *
# * *
# ***************************************************************************/
#################################################
# Edit the following to match your sources lists
#################################################
#Add iso code for any locales you want to support here (space separated)
LOCALES = en af de id
PLUGINNAME = StreamFeatureExtractor
PY_FILES = \
__init__.py \
stream_feature_extractor.py\
stream_options_dialog.py \
stream_help_dialog.py\
stream_utilities.py\
custom_logging.py
EXTRAS = icon.png metadata.txt LICENSE README.md
STYLES = styles
UI_FILES = \
stream_options_dialog_base.ui\
stream_help_dialog_base.ui
COMPILED_RESOURCE_FILES = resources_rc.py
# For debug deploys
PYDEV = pydev
#################################################
# Normally you would not need to edit below here
#################################################
HELP = help/output/html
THIRD_PARTY = third_party
PLUGIN_UPLOAD = ./plugin_upload.py
QGISDIR=.qgis2
default: compile
compile: $(COMPILED_RESOURCE_FILES)
%_rc.py : %.qrc
pyrcc4 -o $*_rc.py $<
test: test_code pep8 pylint
test_code: compile transcompile
@echo
@echo "----------------------"
@echo "Regression Test Suite"
@echo "----------------------"
@# Preceding dash means that make will continue in case of errors
@-export PYTHONPATH=`pwd`:`pwd`/third_party:$(PYTHONPATH); \
export QGIS_DEBUG=0; \
export QGIS_LOG_FILE=/dev/null; \
nosetests -v --exclude pydev --with-id --with-coverage \
--cover-package= . \
3>&1 1>&2 2>&3 3>&- || true
deploy: compile doc transcompile compile_qml_styles
@echo
@echo "------------------------------------------"
@echo "Deploying plugin to your .qgis2 directory."
@echo "------------------------------------------"
# The deploy target only works on unix like operating system where
# the Python plugin directory is located at:
# $HOME/$(QGISDIR)/python/plugins
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(UI_FILES) $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/i18n
cp -vfr i18n/*.qm $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/i18n/
cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help
cp -vfr $(STYLES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/styles
cp -vfr $(THIRD_PARTY) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/
debugdeploy: deploy
@echo
@echo "------------------------------------------"
@echo "Deploying pydev debug libs."
@echo "------------------------------------------"
# The deploy target only works on unix like operating system where
# the Python plugin directory is located at:
# $HOME/$(QGISDIR)/python/plugins
mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -rvf $(PYDEV) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
cp -vfr $(THIRD_PARTY) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/third_party
# Help prepare target extracts strings for translation for the sphinx help
prepare_help:
@echo
@echo "-----------------------------------"
@echo "Preparing help for translation."
@echo "-----------------------------------"
scripts/prepare_documentation_translations.sh
# Help compile target compiles sphinx for the help system
compile_help:
@echo
@echo "-----------------------------------"
@echo "Compiling help for translation."
@echo "-----------------------------------"
scripts/compile_documentation.sh
# The dclean target removes compiled python files from plugin directory
dclean:
@echo
@echo "-----------------------------------"
@echo "Removing any compiled python files."
@echo "-----------------------------------"
find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete
derase:
@echo
@echo "-------------------------"
@echo "Removing deployed plugin."
@echo "-------------------------"
rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)
zip: deploy dclean
@echo
@echo "---------------------------"
@echo "Creating plugin zip bundle."
@echo "---------------------------"
# The zip target deploys the plugin and creates a zip file with the deployed
# content. You can then upload the zip file on http://plugins.qgis.org
rm -f $(PLUGINNAME).zip
cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME)
package: compile
# Create a zip package of the plugin named $(PLUGINNAME).zip.
# This requires use of git (your plugin development directory must be a
# git repository).
# To use, pass a valid commit or tag as follows:
# make package VERSION=Version_0.3.2
@echo
@echo "------------------------------------"
@echo "Exporting plugin to zip package. "
@echo "------------------------------------"
rm -f $(PLUGINNAME).zip
git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION)
echo "Created package: $(PLUGINNAME).zip"
upload: zip
@echo
@echo "-------------------------------------"
@echo "Uploading plugin to QGIS Plugin repo."
@echo "-------------------------------------"
$(PLUGIN_UPLOAD) $(PLUGINNAME).zip
transup:
@echo
@echo "------------------------------------------------"
@echo "Updating translation files with any new strings."
@echo "------------------------------------------------"
@scripts/update-strings.sh $(LOCALES)
transcompile:
@echo
@echo "----------------------------------------"
@echo "Compiled translation files to .qm files."
@echo "----------------------------------------"
@scripts/compile-strings.sh $(LOCALES)
transclean:
@echo
@echo "------------------------------------"
@echo "Removing compiled translation files."
@echo "------------------------------------"
rm -f i18n/*.qm
clean:
@echo
@echo "------------------------------------"
@echo "Removing uic and rcc generated files"
@echo "------------------------------------"
rm $(COMPILED_RESOURCE_FILES)
doc:
@echo
@echo "------------------------------------"
@echo "Building documentation using sphinx."
@echo "------------------------------------"
cd help; make clean; make html
tag:
@echo
@echo "------------------------------------"
@echo "Tagging the release."
@echo "------------------------------------"
@# Note that make runs commands in a subshell so
@# variable context is lost from one line to the next
@# So we need to do everything as a single line command
@read -p "Version e.g. 1.0.0: " VERSION; \
scripts/tag-release.sh $$VERSION
pylint:
@echo
@echo "-----------------"
@echo "Pylint violations"
@echo "-----------------"
@pylint --reports=n --rcfile=pylintrc . | \
grep -v locally-disabled || true
# Run pep8 style checking
#http://pypi.python.org/pypi/pep8
pep8:
@echo
@echo "-----------"
@echo "PEP8 issues"
@echo "-----------"
@pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude conf.py,pydev,resources_rc.py,third_party . || true
compile_qml_styles:
@echo
@echo "-----------------------------------------"
@echo "Compile qml styles for supported locales."
@echo "-----------------------------------------"
@PYTHONPATH=. python scripts/translate_style.py $(LOCALES)
# Run pep257 style checking
#http://pypi.python.org/pypi/pep257
# http://pep257.readthedocs.io/en/latest/error_codes.html
# D104 will be disabled.
pep257:
@echo
@echo "-----------"
@echo "PEP257 issues"
@echo "-----------"
@pep257 --version
@pep257 --ignore=D102,D103,D104,D105,D200,D202,D203,D205,D210,D211,D300,D301,D302,D400,D401 safe/ || true
# Run flake8 style checking
flake8:
@echo
@echo "-----------"
@echo "Flake8 issues"
@echo "-----------"
@python3 -m flake8 --version
@python3 -m flake8