Skip to content

Commit ddbf8ee

Browse files
committed
Fix `make check' on Travis CI
1 parent 688a946 commit ddbf8ee

File tree

3 files changed

+51
-28
lines changed

3 files changed

+51
-28
lines changed

Makefile

+46-25
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,76 @@
11
# Makefile for vcs-repo-mgr.
22
#
33
# Author: Peter Odding <peter@peterodding.com>
4-
# Last Change: March 16, 2016
4+
# Last Change: August 4, 2016
55
# URL: https://github.com/xolox/python-vcs-repo-mgr
66

77
WORKON_HOME ?= $(HOME)/.virtualenvs
88
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
1012

1113
default:
1214
@echo 'Makefile for vcs-repo-mgr'
1315
@echo
1416
@echo 'Usage:'
1517
@echo
1618
@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'
1924
@echo ' make docs update documentation using Sphinx'
2025
@echo ' make publish publish changes to GitHub/PyPI'
2126
@echo ' make clean cleanup all temporary files'
2227
@echo
2328

2429
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 .
3037

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
3542

3643
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
3955

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
4358

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
4762

48-
publish:
63+
publish: install
4964
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
5170

5271
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
5475

55-
.PHONY: default install test check readme docs publish clean
76+
.PHONY: default install reset check test tox readme docs publish clean

requirements-checks.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Python packages required to run `make check'.
2+
flake8 >= 2.6.0
3+
flake8-docstrings >= 0.2.8
4+
pyflakes >= 1.2.3

tox.ini

+1-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,5 @@ python_files = vcs_repo_mgr/tests.py
1717

1818
[flake8]
1919
exclude = .tox
20-
max-line-length = 120
21-
22-
[pep257]
2320
ignore = D200,D211,D400,D402
21+
max-line-length = 120

0 commit comments

Comments
 (0)