| 1 | |
| 2 | |
| 3 | PYTHON=python3 |
| 4 | branch := $(shell git symbolic-ref --short -q HEAD) |
| 5 | |
| 6 | |
| 7 | |
| 8 | help : |
| 9 | @echo "The following make targets are available:" |
| 10 | @echo " help - print this message" |
| 11 | @echo " build - build python package" |
| 12 | @echo " install - install python package (local user)" |
| 13 | @echo " sinstall - install python package (system with sudo)" |
| 14 | @echo " remove - remove the package (local user)" |
| 15 | @echo " sremove - remove the package (system with sudo)" |
| 16 | @echo " clean - remove any temporary files" |
| 17 | @echo " notebook - launch ipython notebook" |
| 18 | |
| 19 | build : |
| 20 | $(PYTHON) setup.py build |
| 21 | |
| 22 | buildext : |
| 23 | $(PYTHON) setup.py build_ext --inplace |
| 24 | |
| 25 | install : |
| 26 | $(PYTHON) setup.py install --user |
| 27 | |
| 28 | sinstall : |
| 29 | sudo $(PYTHON) setup.py install |
| 30 | |
| 31 | remove : |
| 32 | $(PYTHON) setup.py install --user --record files.txt |
| 33 | tr '\n' '\0' < files.txt | xargs -0 rm -f -- |
| 34 | rm files.txt |
| 35 | |
| 36 | sremove : |
| 37 | $(PYTHON) setup.py install --record files.txt |
| 38 | tr '\n' '\0' < files.txt | sudo xargs -0 rm -f -- |
| 39 | rm files.txt |
| 40 | |
| 41 | clean : FORCE |
| 42 | $(PYTHON) setup.py clean |
| 43 | |
| 44 | pep8 : |
| 45 | flake8 examples/ ot/ test/ --count --max-line-length=127 --statistics --show-source |
| 46 | |
| 47 | test : FORCE pep8 |
| 48 | $(PYTHON) -m pytest --durations=20 -v test/ --doctest-modules --ignore ot/gpu/ |
| 49 | |
| 50 | pytest : FORCE |
| 51 | $(PYTHON) -m pytest --durations=20 -v test/ --doctest-modules --ignore ot/gpu/ |
| 52 | |
| 53 | release : |
| 54 | twine upload dist/* |
| 55 | |
| 56 | release_test : |
| 57 | twine upload --repository-url https://test.pypi.org/legacy/ dist/* |
| 58 | |
| 59 | rdoc : |
| 60 | pandoc --from=markdown --to=rst --output=docs/source/readme.rst README.md |
| 61 | sed -i 's,https://pythonot.github.io/auto_examples/,auto_examples/,g' docs/source/readme.rst |
| 62 | pandoc --from=markdown --to=rst --output=docs/source/releases.rst RELEASES.md |
| 63 | sed -i 's,https://pot.readthedocs.io/en/latest/,,g' docs/source/releases.rst |
| 64 | sed -i 's,https://github.com/rflamary/POT/blob/master/notebooks/,auto_examples/,g' docs/source/releases.rst |
| 65 | sed -i 's,.ipynb,.html,g' docs/source/releases.rst |
| 66 | sed -i 's,https://pythonot.github.io/auto_examples/,auto_examples/,g' docs/source/releases.rst |
| 67 | |
| 68 | notebook : |
| 69 | ipython notebook --matplotlib=inline --notebook-dir=notebooks/ |
| 70 | |
| 71 | bench : |
| 72 | @git stash >/dev/null 2>&1 |
| 73 | @echo 'Branch master' |
| 74 | @git checkout master >/dev/null 2>&1 |
| 75 | python3 $(script) |
| 76 | @echo 'Branch $(branch)' |
| 77 | @git checkout $(branch) >/dev/null 2>&1 |
| 78 | python3 $(script) |
| 79 | @git stash apply >/dev/null 2>&1 |
| 80 | |
| 81 | autopep8 : |
| 82 | autopep8 -ir test ot examples --jobs -1 |
| 83 | |
| 84 | aautopep8 : |
| 85 | autopep8 -air test ot examples --jobs -1 |
| 86 | |
| 87 | wheels : |
| 88 | cibuildwheel --platform linux --output-dir dist |
| 89 | |
| 90 | dist : wheels |
| 91 | $(PYTHON) setup.py sdist |
| 92 | |
| 93 | |
| 94 | pydocstyle : |
| 95 | pydocstyle ot |
| 96 | |
| 97 | FORCE : |