Makefile 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. # Required executables
  2. ifeq (, $(shell which python3))
  3. $(error "No python3 on PATH.")
  4. endif
  5. ifeq (, $(shell which pipenv))
  6. $(error "No pipenv on PATH.")
  7. endif
  8. # Suppress warning if pipenv is started inside .venv
  9. export PIPENV_VERBOSITY=1
  10. # Use relative .venv folder instead of home-folder based
  11. export PIPENV_VENV_IN_PROJECT=1
  12. # Ignore existing venvs (required for travis)
  13. export PIPENV_IGNORE_VIRTUALENVS=1
  14. # Setup python path
  15. export PYTHONPATH=.
  16. # Make sure we are running with an explicit encoding
  17. export LC_ALL=C.UTF-8
  18. export LANG=C.UTF-8
  19. # Current package version
  20. VERSION = $(shell python3 setup.py --version)
  21. all: clean venv build
  22. venv: clean
  23. @echo Initialize virtualenv, i.e., install required packages etc.
  24. pipenv --three install --dev
  25. shell:
  26. @echo Initialize virtualenv and open a new shell using it
  27. pipenv shell
  28. clean:
  29. @echo Clean project base
  30. rm -rfv .venv .tox .egg build dist src
  31. find . -type d -name ".ropeproject" -exec rm -rf "{}" +;
  32. find . -type d -name ".pytest_cache" -exec rm -rf "{}" +;
  33. find . -type d -name "__pycache__" -exec rm -rf "{}" +;
  34. test:
  35. @echo Run all tests in default virtualenv
  36. pipenv run py.test tests
  37. testall:
  38. @echo Run all tests against all virtualenvs defined in tox.ini
  39. pipenv run tox -c setup.cfg tests
  40. coverage:
  41. @echo Run test coverage checks
  42. pipenv run py.test --verbose tests
  43. isort:
  44. @echo Check for incorrectly sorted imports
  45. pipenv run isort --check-only .
  46. lint:
  47. @echo Run code formatting checks against source code base
  48. pipenv run flake8 my_module tests
  49. build: test coverage isort lint
  50. @echo Run setup.py-based build process to package application
  51. pipenv run python setup.py bdist_wheel
  52. publish: all
  53. @echo Release to pypi.org and create git tag
  54. pipenv run twine upload dist/*
  55. git tag -a $(VERSION) -m "Version $(VERSION)"
  56. git push --tags
  57. run:
  58. @echo Execute my_module directly
  59. pipenv run python -m my_module
  60. fetch-latest-boilerplate:
  61. @echo Fetch latest python3-boilerplate version from github
  62. git remote add py3template git@github.com:BastiTee/python3-boilerplate.git \
  63. ||true
  64. git pull py3template master --allow-unrelated-histories ||true
  65. @echo ----------------------------------------------------
  66. @echo Resolve all merge conflicts and commit your changes!
  67. @echo ----------------------------------------------------