Makefile 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. # Initialize virtualenv, i.e., install required packages etc.
  24. pipenv --three install --dev
  25. shell:
  26. # Initialize virtualenv and open a new shell using it
  27. pipenv shell
  28. clean:
  29. # Clean project base
  30. rm -rfv \
  31. .venv \
  32. .tox \
  33. .egg \
  34. *.egg-info \
  35. build \
  36. dist \
  37. **/.pytest_cache \
  38. .pytest_cache \
  39. **/__pycache__
  40. test:
  41. # Run all tests in default virtualenv
  42. pipenv run py.test tests
  43. testall:
  44. # Run all tests against all virtualenvs defined in tox.ini
  45. pipenv run tox -c setup.cfg tests
  46. coverage:
  47. # Run test coverage checks
  48. pipenv run py.test --verbose tests
  49. lint:
  50. # Run code formatting checks against source code base
  51. pipenv run flake8 my_module tests
  52. build: test coverage lint
  53. # Run setup.py-based build process to package application
  54. pipenv run python setup.py bdist_wheel
  55. publish: all
  56. # Release
  57. pipenv run twine upload dist/*
  58. git tag -a $(VERSION) -m "Version $(VERSION)"
  59. git push --tags
  60. run:
  61. # Execute my_module directly
  62. pipenv run python -m my_module