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
22.DEFAULT_GOAL := help
33define BROWSER_PYSCRIPT
44import os, webbrowser, sys
@@ -28,16 +28,17 @@ BROWSER := python -c "$$BROWSER_PYSCRIPT"
2828help :
2929@python -c " $$ PRINT_HELP_PYSCRIPT" < $(MAKEFILE_LIST )
3030
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
3232
3333
3434clean-build : # # remove build artifacts
3535rm -fr build/
3636rm -fr dist/
3737rm -fr {{ cookiecutter.project_slug }}/rust/target
3838rm -fr .eggs/
39+ rm -f * .so * .dylib * .dll
3940find . -name ' *.egg-info' -exec rm -fr {} +
40- find . -name ' *.egg' -exec rm -f {} +
41+ find . -name ' *.egg' -exec rm -fr {} +
4142
4243clean-pyc : # # remove Python file artifacts
4344find . -name ' *.pyc' -exec rm -f {} +
@@ -50,58 +51,56 @@ clean-test: ## remove test and coverage artifacts
5051rm -f .coverage
5152rm -fr htmlcov/
5253
53- lint : # # check style with flake8
54- flake8 {{ cookiecutter.project_slug }} tests
55-
56- test : # # run tests quickly with the default Python
57- {% if cookiecutter.use_pytest == ' y' -%}
58- py.test
59- {% else %}
60- python setup.py test
61- {%- endif %}
54+ clean-venv :
55+ rm -rf venv
6256
57+ lint : venv # # check style with flake8
58+ venv/bin/flake8 {{ cookiecutter.project_slug }} tests
6359
64- cargo-test : # # build rust lib for local testing. DO NOT USE ON TRAVIS. Cross needs to build for the target
65- cargo test --manifest-path {{ cookiecutter.project_slug }}/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
6663
67- cargo-build : # # build rust lib for local testing. DO NOT USE ON TRAVIS. Cross needs to build for the target
68- cargo build --manifest-path {{ cookiecutter.project_slug }}/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
6967
70- cross-build : clean
71- cross build --manifest-path {{ cookiecutter.project_slug }}/rust/Cargo.toml --target $$ TARGET --release
7268
73- test-all : # # run tests on every Python version with tox
74- tox
69+ test-all : venv # # run tests on every Python version with tox
70+ venv/bin/ tox
7571
76- coverage : # # check code coverage quickly with the default Python
72+ coverage : venv # # check code coverage quickly with the default Python
7773{% if cookiecutter.use_pytest == ' y' -%}
78- coverage run --source {{ cookiecutter.project_slug }} -m pytest
74+ venv/bin/ coverage run --source {{ cookiecutter.project_slug }} -m pytest
7975{% else %}
80- coverage run --source {{ cookiecutter.project_slug }} setup.py test
76+ venv/bin/ coverage run --source {{ cookiecutter.project_slug }} setup.py test
8177{% endif %}
82- coverage report -m
83- coverage html
78+ venv/bin/ coverage report -m
79+ venv/bin/ coverage html
8480$(BROWSER ) htmlcov/index.html
8581
86- docs : # # generate Sphinx HTML documentation, including API docs
82+ docs : venv # # generate Sphinx HTML documentation, including API docs
8783rm -f docs/{{ cookiecutter.project_slug }}.rst
8884rm -f docs/modules.rst
89- sphinx-apidoc -o docs/ {{ cookiecutter.project_slug }}
85+ venv/bin/ sphinx-apidoc -o docs/ {{ cookiecutter.project_slug }}
9086$(MAKE ) -C docs clean
9187$(MAKE ) -C docs html
9288$(BROWSER ) docs/_build/html/index.html
9389
94- servedocs : docs # # compile the docs watching for changes
95- watchmedo shell-command -p ' *.rst' -c ' $(MAKE) -C docs html' -R -D .
90+ servedocs : venv docs # # compile the docs watching for changes
91+ venv/bin/ watchmedo shell-command -p ' *.rst' -c ' $(MAKE) -C docs html' -R -D .
9692
97- release : clean # # package and upload a release
98- python setup.py sdist upload
99- python setup.py bdist_wheel upload
93+ release : venv clean # # package and upload a release
94+ venv/bin/ python setup.py sdist upload
95+ venv/bin/ python setup.py bdist_wheel upload
10096
101- dist : clean # # builds source and wheel package
102- python setup.py sdist
103- python setup.py bdist_wheel
97+ dist : venv clean # # builds source and wheel package
98+ venv/bin/ python setup.py sdist
99+ venv/bin/ python setup.py bdist_wheel
104100ls -l dist
105101
106- install : clean # # install the package to the active Python's site-packages
107- python setup.py install
102+ install : venv clean # # install the package to the active Python's site-packages
103+ venv/bin/python setup.py install
104+
105+
106+ local-test : clean test coverage dist install
0 commit comments