1+ # Default tests run with make test and make quick-tests
2+ NOSE_TESTS =tests planemo
3+ # Default environment for make tox
4+ ENV? =py27
5+ # Extra arguments supplied to tox command
6+ ARGS? =
7+ # Location of virtualenv used for development.
8+ VENV =.venv
9+ # Source virtualenv to execute command (flake8, sphinx, twine, etc...)
10+ IN_VENV =if [ -f $(VENV ) /bin/activate ]; then . $(VENV ) /bin/activate; fi;
11+
112.PHONY : clean-pyc clean-build docs clean
213
314help :
617 @echo " clean-pyc - remove Python file artifacts"
718 @echo " clean-test - remove test and coverage artifacts"
819 @echo " setup-venv - setup a development virutalenv in current directory."
9- @echo " lint - check style with flake8"
20+ @echo " lint - check style using tox and flake8 for Python 2 and Python 3 "
1021 @echo " lint-readme - check README formatting for PyPI"
11- @echo " test - run tests quickly with the default Python"
22+ @echo " flake8 - check style using flake8 for current Python (faster than lint)"
23+ @echo " test - run tests with the default Python (faster than tox)"
24+ @echo " quick-test - run quickest tests with the default Python"
1225 @echo " coverage - check code coverage quickly with the default Python"
1326 @echo " docs - generate Sphinx HTML documentation, including API docs"
14- @echo " release - package and upload a release"
27+ @echo " open-docs - generate Sphinx HTML documentation and open in browser"
28+ @echo " open-rtd - open docs on readthedocs.org"
29+ @echo " open-project - open project on github"
30+ @echo " release - package, review, and upload a release"
1531 @echo " dist - package"
32+ @echo " update-extern - update external artifacts copied locally"
1633
1734clean : clean-build clean-pyc clean-test
1835
@@ -33,17 +50,32 @@ clean-test:
3350 rm -fr htmlcov/
3451
3552setup-venv :
36- if [ -f .venv ]; then virtualenv .venv; fi ;
37- . .venv/bin/activate && pip install -r requirements.txt && pip install -r dev-requirements.txt
53+ if [ -f $( VENV) ]; then virtualenv $( VENV) ; fi ;
54+ $(IN_VENV ) pip install -r requirements.txt && pip install -r dev-requirements.txt
55+
56+ setup-git-hook-lint :
57+ cp scripts/pre-commit-lint .git/hooks/pre-commit
58+
59+ setup-git-hook-lint-and-test :
60+ cp scripts/pre-commit-lint-and-test .git/hooks/pre-commit
61+
62+ flake8 :
63+ $(IN_VENV ) flake8 --max-complexity 11 planemo tests
3864
3965lint :
40- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; flake8 --max-complexity 11 planemo tests
66+ $( IN_VENV ) tox -e py27-lint && tox -e py34-lint
4167
4268lint-readme :
43- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; python setup.py check -r -s
69+ $( IN_VENV ) python setup.py check -r -s
4470
4571test :
46- if [ -f .venv/bin/activate ]; then . .venv/bin/activate; fi ; nosetests tests planemo
72+ $(IN_VENV ) nosetests $(NOSE_TESTS )
73+
74+ quick-test :
75+ $(IN_VENV ) PLANEMO_SKIP_GALAXY_TESTS=1 nosetests $(NOSE_TESTS )
76+
77+ tox :
78+ $(IN_VENV ) tox -e $(ENV ) -- $(ARGS )
4779
4880coverage :
4981 coverage run --source planemo setup.py test
@@ -55,27 +87,29 @@ docs:
5587 rm -f docs/planemo.rst
5688 rm -f docs/planemo_ext.rst
5789 rm -f docs/modules.rst
58- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; sphinx-apidoc -f -o docs/ planemo_ext planemo_ext/galaxy/eggs
59- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; sphinx-apidoc -f -o docs/ planemo
60- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; python scripts/commands_to_rst.py
61- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; $(MAKE ) -C docs clean
62- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; $(MAKE ) -C docs html
90+ $( IN_VENV ) sphinx-apidoc -f -o docs/ planemo_ext planemo_ext/galaxy/eggs
91+ $( IN_VENV ) sphinx-apidoc -f -o docs/ planemo
92+ $( IN_VENV ) python scripts/commands_to_rst.py
93+ $( IN_VENV ) $(MAKE ) -C docs clean
94+ $( IN_VENV ) $(MAKE ) -C docs html
6395
64- open -docs : docs
96+ _open -docs :
6597 open docs/_build/html/index.html || xdg-open docs/_build/html/index.html
6698
99+ open-docs : docs _open-docs
100+
67101open-rtd : docs
68102 open https://planemo.readthedocs.org || xdg-open https://planemo.readthedocs.org
69103
70104open-project :
71105 open https://github.com/galaxyproject/planemo || xdg-open https://github.com/galaxyproject/planemo
72106
73107dist : clean
74- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; python setup.py sdist bdist_egg bdist_wheel
108+ $( IN_VENV ) python setup.py sdist bdist_egg bdist_wheel
75109 ls -l dist
76110
77111release-test : dist
78- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; twine upload -r test dist/*
112+ $( IN_VENV ) twine upload -r test dist/*
79113 open https://testpypi.python.org/pypi/planemo || xdg-open https://testpypi.python.org/pypi/planemo
80114
81115release : release-test
@@ -84,7 +118,7 @@ release: release-test
84118 done ; \
85119 [ $$ CONTINUE = " y" ] || [ $$ CONTINUE = " Y" ] || (echo " Exiting." ; exit 1; )
86120 @echo " Releasing"
87- if [ -f .venv/bin/activate ] ; then . .venv/bin/activate ; fi ; twine upload dist/*
121+ $( IN_VENV ) twine upload dist/*
88122
89123update-extern :
90124 sh scripts/update_extern.sh
0 commit comments