Makefile 7.9 KB

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