You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

68 lines
2.0 KiB

  1. all: clean flake8 test pypi docs tag release
  2. .PHONY: all docs
  3. PACKAGE_NAME=$(shell python setup.py --name)
  4. PYTHON_VERSION=$(shell python -c "import sys; print('py%s%s' % sys.version_info[0:2])")
  5. PYTHON_PATH=$(shell which python)
  6. PLATFORM=$(shell uname -s | awk '{print tolower($0)}')
  7. DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
  8. PYENV_HOME := $(DIR)/.tox/$(PYTHON_VERSION)-$(PLATFORM)/
  9. clean:
  10. find . -name "*.pyc" -delete
  11. package:
  12. python setup.py sdist bdist_wheel build_sphinx
  13. install: prepare
  14. $(PYENV_HOME)/bin/python setup.py install
  15. uninstall:
  16. $(PYENV_HOME)/bin/pip uninstall -y $(PACKAGE_NAME)
  17. venv: $(PYENV_HOME)/bin/activate
  18. # virtual environment depends on requriements files
  19. $(PYENV_HOME)/bin/activate: requirements*.txt
  20. @echo "INFO: (Re)creating virtual environment..."
  21. test -d $(PYENV_HOME)/bin/activate || virtualenv --python=$(PYTHON_PATH) --system-site-packages $(PYENV_HOME)
  22. $(PYENV_HOME)/bin/pip install -q -r requirements.txt
  23. $(PYENV_HOME)/bin/pip install -q -r requirements-dev.txt
  24. touch $(PYENV_HOME)/bin/activate
  25. prepare: venv
  26. @echo "INFO: === Prearing to run for package:$(PACKAGE_NAME) platform:$(PLATFORM) py:$(PYTHON_VERSION) dir:$(DIR) ==="
  27. testspace:
  28. ${HOME}/testspace/testspace publish build/results.xml
  29. flake8:
  30. $(PYENV_HOME)/bin/python -m flake8
  31. $(PYENV_HOME)/bin/python -m flake8 --install-hook 2>/dev/null || true
  32. test: prepare flake8
  33. $(PYENV_HOME)/bin/python setup.py test
  34. test-all:
  35. # tox should not run inside virtualenv because it does create and use multiple virtualenvs
  36. pip install -q tox tox-pyenv
  37. python -m tox --skip-missing-interpreters true
  38. pypi:
  39. $(PYENV_HOME)/bin/python setup.py check --restructuredtext --strict
  40. $(PYENV_HOME)/bin/python setup.py sdist bdist_wheel upload
  41. pypitest:
  42. $(PYENV_HOME)/bin/python setup.py check --restructuredtext --strict
  43. $(PYENV_HOME)/bin/python setup.py sdist bdist_wheel upload -r pypitest
  44. tag:
  45. bumpversion minor
  46. git push origin master
  47. git push --tags
  48. release:
  49. tag
  50. pypi
  51. web