|
| 1 | +#/*************************************************************************** |
| 2 | +# Geodms |
| 3 | +# |
| 4 | +# Geodms plugin for qgis |
| 5 | +# ------------------- |
| 6 | +# begin : 2025-03-28 |
| 7 | +# git sha : $Format:%H$ |
| 8 | +# copyright : (C) 2025 by Object Vision BV |
| 9 | + |
| 10 | +# ***************************************************************************/ |
| 11 | +# |
| 12 | +#/*************************************************************************** |
| 13 | +# * * |
| 14 | +# * This program is free software; you can redistribute it and/or modify * |
| 15 | +# * it under the terms of the GNU General Public License as published by * |
| 16 | +# * the Free Software Foundation; either version 2 of the License, or * |
| 17 | +# * (at your option) any later version. * |
| 18 | +# * * |
| 19 | +# ***************************************************************************/ |
| 20 | + |
| 21 | +################################################# |
| 22 | +# Edit the following to match your sources lists |
| 23 | +################################################# |
| 24 | + |
| 25 | + |
| 26 | +#Add iso code for any locales you want to support here (space separated) |
| 27 | +# default is no locales |
| 28 | +# LOCALES = af |
| 29 | +LOCALES = |
| 30 | + |
| 31 | +# If locales are enabled, set the name of the lrelease binary on your system. If |
| 32 | +# you have trouble compiling the translations, you may have to specify the full path to |
| 33 | +# lrelease |
| 34 | +#LRELEASE = lrelease |
| 35 | +#LRELEASE = lrelease-qt4 |
| 36 | + |
| 37 | + |
| 38 | +# translation |
| 39 | +SOURCES = \ |
| 40 | + __init__.py \ |
| 41 | + geodms.py geodms_dockwidget.py |
| 42 | + |
| 43 | +PLUGINNAME = geodms |
| 44 | + |
| 45 | +PY_FILES = \ |
| 46 | + __init__.py \ |
| 47 | + geodms.py geodms_dockwidget.py |
| 48 | + |
| 49 | +UI_FILES = geodms_dockwidget_base.ui |
| 50 | + |
| 51 | +EXTRAS = metadata.txt icon.png |
| 52 | + |
| 53 | +EXTRA_DIRS = |
| 54 | + |
| 55 | +COMPILED_RESOURCE_FILES = resources.py |
| 56 | + |
| 57 | +PEP8EXCLUDE=pydev,resources.py,conf.py,third_party,ui |
| 58 | + |
| 59 | +# QGISDIR points to the location where your plugin should be installed. |
| 60 | +# This varies by platform, relative to your HOME directory: |
| 61 | +# * Linux: |
| 62 | +# .local/share/QGIS/QGIS3/profiles/default/python/plugins/ |
| 63 | +# * Mac OS X: |
| 64 | +# Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins |
| 65 | +# * Windows: |
| 66 | +# AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins' |
| 67 | + |
| 68 | +QGISDIR=C:\Users\Cicada\AppData/Roaming/QGIS/QGIS3/profiles/default/python/plugins |
| 69 | + |
| 70 | +################################################# |
| 71 | +# Normally you would not need to edit below here |
| 72 | +################################################# |
| 73 | + |
| 74 | +HELP = help/build/html |
| 75 | + |
| 76 | +PLUGIN_UPLOAD = $(c)/plugin_upload.py |
| 77 | + |
| 78 | +RESOURCE_SRC=$(shell grep '^ *<file' resources.qrc | sed 's@</file>@@g;s/.*>//g' | tr '\n' ' ') |
| 79 | + |
| 80 | +.PHONY: default |
| 81 | +default: |
| 82 | + @echo While you can use make to build and deploy your plugin, pb_tool |
| 83 | + @echo is a much better solution. |
| 84 | + @echo A Python script, pb_tool provides platform independent management of |
| 85 | + @echo your plugins and runs anywhere. |
| 86 | + @echo You can install pb_tool using: pip install pb_tool |
| 87 | + @echo See https://g-sherman.github.io/plugin_build_tool/ for info. |
| 88 | + |
| 89 | +compile: $(COMPILED_RESOURCE_FILES) |
| 90 | + |
| 91 | +%.py : %.qrc $(RESOURCES_SRC) |
| 92 | + pyrcc5 -o $*.py $< |
| 93 | + |
| 94 | +%.qm : %.ts |
| 95 | + $(LRELEASE) $< |
| 96 | + |
| 97 | +test: compile transcompile |
| 98 | + @echo |
| 99 | + @echo "----------------------" |
| 100 | + @echo "Regression Test Suite" |
| 101 | + @echo "----------------------" |
| 102 | + |
| 103 | + @# Preceding dash means that make will continue in case of errors |
| 104 | + @-export PYTHONPATH=`pwd`:$(PYTHONPATH); \ |
| 105 | + export QGIS_DEBUG=0; \ |
| 106 | + export QGIS_LOG_FILE=/dev/null; \ |
| 107 | + nosetests -v --with-id --with-coverage --cover-package=. \ |
| 108 | + 3>&1 1>&2 2>&3 3>&- || true |
| 109 | + @echo "----------------------" |
| 110 | + @echo "If you get a 'no module named qgis.core error, try sourcing" |
| 111 | + @echo "the helper script we have provided first then run make test." |
| 112 | + @echo "e.g. source run-env-linux.sh <path to qgis install>; make test" |
| 113 | + @echo "----------------------" |
| 114 | + |
| 115 | +deploy: compile doc transcompile |
| 116 | + @echo |
| 117 | + @echo "------------------------------------------" |
| 118 | + @echo "Deploying plugin to your .qgis2 directory." |
| 119 | + @echo "------------------------------------------" |
| 120 | + # The deploy target only works on unix like operating system where |
| 121 | + # the Python plugin directory is located at: |
| 122 | + # $HOME/$(QGISDIR)/python/plugins |
| 123 | + mkdir -p $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 124 | + cp -vf $(PY_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 125 | + cp -vf $(UI_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 126 | + cp -vf $(COMPILED_RESOURCE_FILES) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 127 | + cp -vf $(EXTRAS) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 128 | + cp -vfr i18n $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 129 | + cp -vfr $(HELP) $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME)/help |
| 130 | + # Copy extra directories if any |
| 131 | + (foreach EXTRA_DIR,(EXTRA_DIRS), cp -R (EXTRA_DIR) (HOME)/(QGISDIR)/python/plugins/(PLUGINNAME)/;) |
| 132 | + |
| 133 | + |
| 134 | +# The dclean target removes compiled python files from plugin directory |
| 135 | +# also deletes any .git entry |
| 136 | +dclean: |
| 137 | + @echo |
| 138 | + @echo "-----------------------------------" |
| 139 | + @echo "Removing any compiled python files." |
| 140 | + @echo "-----------------------------------" |
| 141 | + find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname "*.pyc" -delete |
| 142 | + find $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) -iname ".git" -prune -exec rm -Rf {} \; |
| 143 | + |
| 144 | + |
| 145 | +derase: |
| 146 | + @echo |
| 147 | + @echo "-------------------------" |
| 148 | + @echo "Removing deployed plugin." |
| 149 | + @echo "-------------------------" |
| 150 | + rm -Rf $(HOME)/$(QGISDIR)/python/plugins/$(PLUGINNAME) |
| 151 | + |
| 152 | +zip: deploy dclean |
| 153 | + @echo |
| 154 | + @echo "---------------------------" |
| 155 | + @echo "Creating plugin zip bundle." |
| 156 | + @echo "---------------------------" |
| 157 | + # The zip target deploys the plugin and creates a zip file with the deployed |
| 158 | + # content. You can then upload the zip file on http://plugins.qgis.org |
| 159 | + rm -f $(PLUGINNAME).zip |
| 160 | + cd $(HOME)/$(QGISDIR)/python/plugins; zip -9r $(CURDIR)/$(PLUGINNAME).zip $(PLUGINNAME) |
| 161 | + |
| 162 | +package: compile |
| 163 | + # Create a zip package of the plugin named $(PLUGINNAME).zip. |
| 164 | + # This requires use of git (your plugin development directory must be a |
| 165 | + # git repository). |
| 166 | + # To use, pass a valid commit or tag as follows: |
| 167 | + # make package VERSION=Version_0.3.2 |
| 168 | + @echo |
| 169 | + @echo "------------------------------------" |
| 170 | + @echo "Exporting plugin to zip package. " |
| 171 | + @echo "------------------------------------" |
| 172 | + rm -f $(PLUGINNAME).zip |
| 173 | + git archive --prefix=$(PLUGINNAME)/ -o $(PLUGINNAME).zip $(VERSION) |
| 174 | + echo "Created package: $(PLUGINNAME).zip" |
| 175 | + |
| 176 | +upload: zip |
| 177 | + @echo |
| 178 | + @echo "-------------------------------------" |
| 179 | + @echo "Uploading plugin to QGIS Plugin repo." |
| 180 | + @echo "-------------------------------------" |
| 181 | + $(PLUGIN_UPLOAD) $(PLUGINNAME).zip |
| 182 | + |
| 183 | +transup: |
| 184 | + @echo |
| 185 | + @echo "------------------------------------------------" |
| 186 | + @echo "Updating translation files with any new strings." |
| 187 | + @echo "------------------------------------------------" |
| 188 | + @chmod +x scripts/update-strings.sh |
| 189 | + @scripts/update-strings.sh $(LOCALES) |
| 190 | + |
| 191 | +transcompile: |
| 192 | + @echo |
| 193 | + @echo "----------------------------------------" |
| 194 | + @echo "Compiled translation files to .qm files." |
| 195 | + @echo "----------------------------------------" |
| 196 | + @chmod +x scripts/compile-strings.sh |
| 197 | + @scripts/compile-strings.sh $(LRELEASE) $(LOCALES) |
| 198 | + |
| 199 | +transclean: |
| 200 | + @echo |
| 201 | + @echo "------------------------------------" |
| 202 | + @echo "Removing compiled translation files." |
| 203 | + @echo "------------------------------------" |
| 204 | + rm -f i18n/*.qm |
| 205 | + |
| 206 | +clean: |
| 207 | + @echo |
| 208 | + @echo "------------------------------------" |
| 209 | + @echo "Removing uic and rcc generated files" |
| 210 | + @echo "------------------------------------" |
| 211 | + rm $(COMPILED_UI_FILES) $(COMPILED_RESOURCE_FILES) |
| 212 | + |
| 213 | +doc: |
| 214 | + @echo |
| 215 | + @echo "------------------------------------" |
| 216 | + @echo "Building documentation using sphinx." |
| 217 | + @echo "------------------------------------" |
| 218 | + cd help; make html |
| 219 | + |
| 220 | +pylint: |
| 221 | + @echo |
| 222 | + @echo "-----------------" |
| 223 | + @echo "Pylint violations" |
| 224 | + @echo "-----------------" |
| 225 | + @pylint --reports=n --rcfile=pylintrc . || true |
| 226 | + @echo |
| 227 | + @echo "----------------------" |
| 228 | + @echo "If you get a 'no module named qgis.core' error, try sourcing" |
| 229 | + @echo "the helper script we have provided first then run make pylint." |
| 230 | + @echo "e.g. source run-env-linux.sh <path to qgis install>; make pylint" |
| 231 | + @echo "----------------------" |
| 232 | + |
| 233 | + |
| 234 | +# Run pep8 style checking |
| 235 | +#http://pypi.python.org/pypi/pep8 |
| 236 | +pep8: |
| 237 | + @echo |
| 238 | + @echo "-----------" |
| 239 | + @echo "PEP8 issues" |
| 240 | + @echo "-----------" |
| 241 | + @pep8 --repeat --ignore=E203,E121,E122,E123,E124,E125,E126,E127,E128 --exclude $(PEP8EXCLUDE) . || true |
| 242 | + @echo "-----------" |
| 243 | + @echo "Ignored in PEP8 check:" |
| 244 | + @echo $(PEP8EXCLUDE) |
0 commit comments