|
1 | 1 | # Makefile for vcs-repo-mgr.
|
2 | 2 | #
|
3 | 3 | # Author: Peter Odding <peter@peterodding.com>
|
4 |
| -# Last Change: March 16, 2016 |
| 4 | +# Last Change: August 4, 2016 |
5 | 5 | # URL: https://github.com/xolox/python-vcs-repo-mgr
|
6 | 6 |
|
7 | 7 | WORKON_HOME ?= $(HOME)/.virtualenvs
|
8 | 8 | VIRTUAL_ENV ?= $(WORKON_HOME)/vcs-repo-mgr
|
9 |
| -ACTIVATE = . "$(VIRTUAL_ENV)/bin/activate" |
| 9 | +PATH := $(VIRTUAL_ENV)/bin:$(PATH) |
| 10 | +MAKE := $(MAKE) --no-print-directory |
| 11 | +SHELL = bash |
10 | 12 |
|
11 | 13 | default:
|
12 | 14 | @echo 'Makefile for vcs-repo-mgr'
|
13 | 15 | @echo
|
14 | 16 | @echo 'Usage:'
|
15 | 17 | @echo
|
16 | 18 | @echo ' make install install the package in a virtual environment'
|
17 |
| - @echo ' make test run the test suite and report coverage' |
18 |
| - @echo ' make check check the coding style' |
| 19 | + @echo ' make reset recreate the virtual environment' |
| 20 | + @echo ' make check check coding style (PEP-8, PEP-257)' |
| 21 | + @echo ' make test run the test suite, report coverage' |
| 22 | + @echo ' make tox run the tests on all Python versions' |
| 23 | + @echo ' make readme update usage in readme' |
19 | 24 | @echo ' make docs update documentation using Sphinx'
|
20 | 25 | @echo ' make publish publish changes to GitHub/PyPI'
|
21 | 26 | @echo ' make clean cleanup all temporary files'
|
22 | 27 | @echo
|
23 | 28 |
|
24 | 29 | install:
|
25 |
| - test -d "$(VIRTUAL_ENV)" || virtualenv --no-site-packages "$(VIRTUAL_ENV)" |
26 |
| - test -x "$(VIRTUAL_ENV)/bin/pip" || ($(ACTIVATE) && easy_install pip) |
27 |
| - test -x "$(VIRTUAL_ENV)/bin/pip-accel" || ($(ACTIVATE) && pip install --quiet pip-accel) |
28 |
| - $(ACTIVATE) && pip uninstall --quiet --yes vcs-repo-mgr || true |
29 |
| - $(ACTIVATE) && pip-accel install --quiet --editable . |
| 30 | + @test -d "$(VIRTUAL_ENV)" || mkdir -p "$(VIRTUAL_ENV)" |
| 31 | + @test -x "$(VIRTUAL_ENV)/bin/python" || virtualenv --quiet "$(VIRTUAL_ENV)" |
| 32 | + @test -x "$(VIRTUAL_ENV)/bin/pip" || easy_install pip |
| 33 | + @test -x "$(VIRTUAL_ENV)/bin/pip-accel" || (pip install --quiet pip-accel && pip-accel install --quiet 'urllib3[secure]') |
| 34 | + @echo "Updating requirements .." >&2 |
| 35 | + @pip-accel install --quiet --requirement=requirements.txt |
| 36 | + @which vcs-tool &>/dev/null || pip install --quiet --no-deps --editable . |
30 | 37 |
|
31 |
| -test: install |
32 |
| - $(ACTIVATE) && pip-accel install --quiet pytest pytest-cov |
33 |
| - $(ACTIVATE) && py.test --cov --exitfirst --verbose |
34 |
| - $(ACTIVATE) && coverage html |
| 38 | +reset: |
| 39 | + $(MAKE) clean |
| 40 | + rm -Rf "$(VIRTUAL_ENV)" |
| 41 | + $(MAKE) install |
35 | 42 |
|
36 | 43 | check: install
|
37 |
| - test -x "$(VIRTUAL_ENV)/bin/flake8" || ($(ACTIVATE) && pip-accel install --quiet flake8-pep257) |
38 |
| - $(ACTIVATE) && flake8 |
| 44 | + @echo "Updating flake8 .." >&2 |
| 45 | + @pip-accel install --upgrade --quiet --requirement=requirements-checks.txt |
| 46 | + @flake8 |
| 47 | + |
| 48 | +test: install |
| 49 | + @pip-accel install --quiet coverage pytest pytest-cov |
| 50 | + @py.test -v --cov --cov-report=html --no-cov-on-fail |
| 51 | + @coverage report --fail-under=90 |
| 52 | + |
| 53 | +tox: install |
| 54 | + @pip-accel install --quiet tox && tox |
39 | 55 |
|
40 |
| -readme: |
41 |
| - test -x "$(VIRTUAL_ENV)/bin/cog.py" || ($(ACTIVATE) && pip-accel install --quiet cogapp) |
42 |
| - $(ACTIVATE) && cog.py -r README.rst |
| 56 | +readme: install |
| 57 | + @pip-accel install --quiet cogapp && cog.py -r README.rst |
43 | 58 |
|
44 |
| -docs: install |
45 |
| - test -x "$(VIRTUAL_ENV)/bin/sphinx-build" || ($(ACTIVATE) && pip-accel install --quiet sphinx) |
46 |
| - cd docs && make html |
| 59 | +docs: readme |
| 60 | + @pip-accel install --quiet sphinx |
| 61 | + cd docs && sphinx-build -nb html -d build/doctrees . build/html |
47 | 62 |
|
48 |
| -publish: |
| 63 | +publish: install |
49 | 64 | git push origin && git push --tags origin
|
50 |
| - make clean && python setup.py sdist upload |
| 65 | + $(MAKE) clean |
| 66 | + pip-accel install --quiet twine wheel |
| 67 | + python setup.py sdist bdist_wheel |
| 68 | + twine upload dist/* |
| 69 | + $(MAKE) clean |
51 | 70 |
|
52 | 71 | clean:
|
53 |
| - rm -Rf build dist docs/build *.egg-info htmlcov |
| 72 | + @rm -Rf *.egg .cache .coverage build dist docs/build htmlcov |
| 73 | + @find -depth -type d -name __pycache__ -exec rm -Rf {} \; |
| 74 | + @find -type f -name '*.pyc' -delete |
54 | 75 |
|
55 |
| -.PHONY: default install test check readme docs publish clean |
| 76 | +.PHONY: default install reset check test tox readme docs publish clean |
0 commit comments