1
- .PHONY : clean clean-test clean-pyc clean-build docs help
1
+ .PHONY : clean clean-test clean-pyc clean-build clean-venv docs help install dist release test test-all
2
2
.DEFAULT_GOAL := help
3
3
define BROWSER_PYSCRIPT
4
4
import os, webbrowser, sys
@@ -28,16 +28,17 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
28
28
help :
29
29
@python -c " $$ PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST )
30
30
31
- clean : clean-build clean-pyc clean-test # # remove all build, test, coverage and Python artifacts
31
+ clean : clean-build clean-pyc clean-test clean-venv # # remove all build, test, coverage, Python artifacts and virtualenv
32
32
33
33
34
34
clean-build : # # remove build artifacts
35
35
rm -fr build/
36
36
rm -fr dist/
37
37
rm -fr trust_pypi_example/rust/target
38
38
rm -fr .eggs/
39
+ rm -f * .so * .dylib * .dll
39
40
find . -name ' *.egg-info' -exec rm -fr {} +
40
- find . -name ' *.egg' -exec rm -f {} +
41
+ find . -name ' *.egg' -exec rm -fr {} +
41
42
42
43
clean-pyc : # # remove Python file artifacts
43
44
find . -name ' *.pyc' -exec rm -f {} +
@@ -50,52 +51,53 @@ clean-test: ## remove test and coverage artifacts
50
51
rm -f .coverage
51
52
rm -fr htmlcov/
52
53
53
- lint : # # check style with flake8
54
- flake8 trust_pypi_example tests
55
-
56
- test : # # run tests quickly with the default Python
57
- py.test
58
-
54
+ clean-venv :
55
+ rm -rf venv
59
56
57
+ lint : venv # # check style with flake8
58
+ venv/bin/flake8 trust_pypi_example tests
60
59
61
- cargo-test : # # build rust lib for local testing. DO NOT USE ON TRAVIS. Cross needs to build for the target
62
- cargo test --manifest-path trust_pypi_example/rust/Cargo.toml --release
60
+ test : venv # # This will use py.test because of pytest-runner
61
+ venv/bin/python setup.py check
62
+ venv/bin/python setup.py test
63
63
64
- cargo-build : # # build rust lib for local testing. DO NOT USE ON TRAVIS. Cross needs to build for the target
65
- cargo build --manifest-path trust_pypi_example/rust/Cargo.toml --release
64
+ venv : # # set up a virtualenv that will by python and install dependencies
65
+ python -m virtualenv venv || python -m venv venv
66
+ venv/bin/pip install -r requirements_dev.txt
66
67
67
- cross-build : clean
68
- cross build --manifest-path trust_pypi_example/rust/Cargo.toml --target $$ TARGET --release
69
68
70
- test-all : # # run tests on every Python version with tox
71
- tox
69
+ test-all : venv # # run tests on every Python version with tox
70
+ venv/bin/ tox
72
71
73
- coverage : # # check code coverage quickly with the default Python
74
- coverage run --source trust_pypi_example -m pytest
72
+ coverage : venv # # check code coverage quickly with the default Python
73
+ venv/bin/ coverage run --source trust_pypi_example -m pytest
75
74
76
- coverage report -m
77
- coverage html
75
+ venv/bin/ coverage report -m
76
+ venv/bin/ coverage html
78
77
$(BROWSER ) htmlcov/index.html
79
78
80
- docs : # # generate Sphinx HTML documentation, including API docs
79
+ docs : venv # # generate Sphinx HTML documentation, including API docs
81
80
rm -f docs/trust_pypi_example.rst
82
81
rm -f docs/modules.rst
83
- sphinx-apidoc -o docs/ trust_pypi_example
82
+ venv/bin/ sphinx-apidoc -o docs/ trust_pypi_example
84
83
$(MAKE ) -C docs clean
85
84
$(MAKE ) -C docs html
86
85
$(BROWSER ) docs/_build/html/index.html
87
86
88
- servedocs : docs # # compile the docs watching for changes
89
- watchmedo shell-command -p ' *.rst' -c ' $(MAKE) -C docs html' -R -D .
87
+ servedocs : venv docs # # compile the docs watching for changes
88
+ venv/bin/ watchmedo shell-command -p ' *.rst' -c ' $(MAKE) -C docs html' -R -D .
90
89
91
- release : clean # # package and upload a release
92
- python setup.py sdist upload
93
- python setup.py bdist_wheel upload
90
+ release : venv clean # # package and upload a release
91
+ venv/bin/ python setup.py sdist upload
92
+ venv/bin/ python setup.py bdist_wheel upload
94
93
95
- dist : clean # # builds source and wheel package
96
- python setup.py sdist
97
- python setup.py bdist_wheel
94
+ dist : venv clean # # builds source and wheel package
95
+ venv/bin/ python setup.py sdist
96
+ venv/bin/ python setup.py bdist_wheel
98
97
ls -l dist
99
98
100
- install : clean # # install the package to the active Python's site-packages
101
- python setup.py install
99
+ install : venv clean # # install the package to the active Python's site-packages
100
+ venv/bin/python setup.py install
101
+
102
+
103
+ local-test : clean test coverage dist install
0 commit comments