John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 1 | QEMU_VENV_DIR=.dev-venv |
Wainer dos Santos Moschetta | 6f651a6 | 2021-06-30 15:45:46 -0300 | [diff] [blame] | 2 | QEMU_TOX_EXTRA_ARGS ?= |
John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 3 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 4 | .PHONY: help |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 5 | help: |
| 6 | @echo "python packaging help:" |
| 7 | @echo "" |
John Snow | 6f84d72 | 2021-06-29 17:43:15 -0400 | [diff] [blame] | 8 | @echo "make check-pipenv:" |
| 9 | @echo " Run tests in pipenv's virtual environment." |
| 10 | @echo " These tests use the oldest dependencies." |
| 11 | @echo " Requires: Python 3.6 and pipenv." |
| 12 | @echo " Hint (Fedora): 'sudo dnf install python3.6 pipenv'" |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 13 | @echo "" |
John Snow | 8c95d0f | 2021-06-29 17:43:16 -0400 | [diff] [blame] | 14 | @echo "make check-tox:" |
| 15 | @echo " Run tests against multiple python versions." |
| 16 | @echo " These tests use the newest dependencies." |
| 17 | @echo " Requires: Python 3.6 - 3.10, and tox." |
| 18 | @echo " Hint (Fedora): 'sudo dnf install python3-tox python3.10'" |
Wainer dos Santos Moschetta | 6f651a6 | 2021-06-30 15:45:46 -0300 | [diff] [blame] | 19 | @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra" |
| 20 | @echo " arguments to tox". |
John Snow | 8c95d0f | 2021-06-29 17:43:16 -0400 | [diff] [blame] | 21 | @echo "" |
John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 22 | @echo "make check-dev:" |
| 23 | @echo " Run tests in a venv against your default python3 version." |
| 24 | @echo " These tests use the newest dependencies." |
| 25 | @echo " Requires: Python 3.x" |
| 26 | @echo "" |
John Snow | 28cd32f | 2021-06-29 17:43:20 -0400 | [diff] [blame] | 27 | @echo "make check:" |
| 28 | @echo " Run tests in your *current environment*." |
| 29 | @echo " Performs no environment setup of any kind." |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 30 | @echo "" |
John Snow | 28cd32f | 2021-06-29 17:43:20 -0400 | [diff] [blame] | 31 | @echo "make develop:" |
| 32 | @echo " Install deps needed for for 'make check'," |
| 33 | @echo " and install the qemu package in editable mode." |
| 34 | @echo " (Can be used in or outside of a venv.)" |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 35 | @echo "" |
John Snow | 6f84d72 | 2021-06-29 17:43:15 -0400 | [diff] [blame] | 36 | @echo "make pipenv" |
| 37 | @echo " Creates pipenv's virtual environment (.venv)" |
| 38 | @echo "" |
John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 39 | @echo "make dev-venv" |
| 40 | @echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))" |
| 41 | @echo "" |
John Snow | 50d0fba | 2021-06-29 17:43:21 -0400 | [diff] [blame] | 42 | @echo "make clean:" |
| 43 | @echo " Remove package build output." |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 44 | @echo "" |
John Snow | 50d0fba | 2021-06-29 17:43:21 -0400 | [diff] [blame] | 45 | @echo "make distclean:" |
| 46 | @echo " remove pipenv/venv files, qemu package forwarder," |
| 47 | @echo " built distribution files, and everything from 'make clean'." |
| 48 | @echo "" |
| 49 | @echo -e "Have a nice day ^_^\n" |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 50 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 51 | .PHONY: pipenv |
John Snow | 6f84d72 | 2021-06-29 17:43:15 -0400 | [diff] [blame] | 52 | pipenv: .venv |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 53 | .venv: Pipfile.lock |
| 54 | @PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated |
John Snow | 19cf003 | 2021-06-29 17:43:22 -0400 | [diff] [blame] | 55 | rm -f pyproject.toml |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 56 | @touch .venv |
| 57 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 58 | .PHONY: check-pipenv |
John Snow | 6f84d72 | 2021-06-29 17:43:15 -0400 | [diff] [blame] | 59 | check-pipenv: pipenv |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 60 | @pipenv run make check |
| 61 | |
John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 62 | .PHONY: dev-venv |
| 63 | dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate |
| 64 | $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate: setup.cfg |
| 65 | @echo "VENV $(QEMU_VENV_DIR)" |
| 66 | @python3 -m venv $(QEMU_VENV_DIR) |
| 67 | @( \ |
| 68 | echo "ACTIVATE $(QEMU_VENV_DIR)"; \ |
| 69 | . $(QEMU_VENV_DIR)/bin/activate; \ |
| 70 | echo "INSTALL qemu[devel] $(QEMU_VENV_DIR)"; \ |
| 71 | make develop 1>/dev/null; \ |
| 72 | ) |
| 73 | @touch $(QEMU_VENV_DIR) |
| 74 | |
| 75 | .PHONY: check-dev |
| 76 | check-dev: dev-venv |
| 77 | @( \ |
| 78 | echo "ACTIVATE $(QEMU_VENV_DIR)"; \ |
| 79 | . $(QEMU_VENV_DIR)/bin/activate; \ |
| 80 | make check; \ |
| 81 | ) |
| 82 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 83 | .PHONY: develop |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 84 | develop: |
John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 85 | pip3 install --disable-pip-version-check -e .[devel] |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 86 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 87 | .PHONY: check |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 88 | check: |
| 89 | @avocado --config avocado.cfg run tests/ |
| 90 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 91 | .PHONY: check-tox |
John Snow | 3c8de38 | 2021-05-27 17:17:14 -0400 | [diff] [blame] | 92 | check-tox: |
Wainer dos Santos Moschetta | 6f651a6 | 2021-06-30 15:45:46 -0300 | [diff] [blame] | 93 | @tox $(QEMU_TOX_EXTRA_ARGS) |
John Snow | 3c8de38 | 2021-05-27 17:17:14 -0400 | [diff] [blame] | 94 | |
John Snow | a4ffaec | 2021-09-15 12:29:55 -0400 | [diff] [blame] | 95 | .PHONY: check-coverage |
| 96 | check-coverage: |
| 97 | @coverage run -m avocado --config avocado.cfg run tests/*.py |
| 98 | @coverage combine |
| 99 | @coverage html |
| 100 | @coverage report |
| 101 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 102 | .PHONY: clean |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 103 | clean: |
| 104 | python3 setup.py clean --all |
John Snow | 19cf003 | 2021-06-29 17:43:22 -0400 | [diff] [blame] | 105 | rm -f pyproject.toml |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 106 | |
John Snow | 205d721 | 2021-06-29 17:43:17 -0400 | [diff] [blame] | 107 | .PHONY: distclean |
John Snow | 6560379 | 2021-05-27 17:17:12 -0400 | [diff] [blame] | 108 | distclean: clean |
John Snow | 2c24d52 | 2021-06-29 17:43:19 -0400 | [diff] [blame] | 109 | rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/ |
John Snow | a4ffaec | 2021-09-15 12:29:55 -0400 | [diff] [blame] | 110 | rm -f .coverage .coverage.* |
| 111 | rm -rf htmlcov/ |