blob: 3334311362573a8b9f39efb12fed6acf65c96b8a [file] [log] [blame]
John Snow2c24d522021-06-29 17:43:19 -04001QEMU_VENV_DIR=.dev-venv
Wainer dos Santos Moschetta6f651a62021-06-30 15:45:46 -03002QEMU_TOX_EXTRA_ARGS ?=
John Snow2c24d522021-06-29 17:43:19 -04003
John Snow205d7212021-06-29 17:43:17 -04004.PHONY: help
John Snow65603792021-05-27 17:17:12 -04005help:
6 @echo "python packaging help:"
7 @echo ""
John Snow6f84d722021-06-29 17:43:15 -04008 @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 Snow65603792021-05-27 17:17:12 -040013 @echo ""
John Snow8c95d0f2021-06-29 17:43:16 -040014 @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 Moschetta6f651a62021-06-30 15:45:46 -030019 @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra"
20 @echo " arguments to tox".
John Snow8c95d0f2021-06-29 17:43:16 -040021 @echo ""
John Snow2c24d522021-06-29 17:43:19 -040022 @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 Snow28cd32f2021-06-29 17:43:20 -040027 @echo "make check:"
28 @echo " Run tests in your *current environment*."
29 @echo " Performs no environment setup of any kind."
John Snow65603792021-05-27 17:17:12 -040030 @echo ""
John Snow28cd32f2021-06-29 17:43:20 -040031 @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 Snow65603792021-05-27 17:17:12 -040035 @echo ""
John Snow6f84d722021-06-29 17:43:15 -040036 @echo "make pipenv"
37 @echo " Creates pipenv's virtual environment (.venv)"
38 @echo ""
John Snow2c24d522021-06-29 17:43:19 -040039 @echo "make dev-venv"
40 @echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))"
41 @echo ""
John Snow50d0fba2021-06-29 17:43:21 -040042 @echo "make clean:"
43 @echo " Remove package build output."
John Snow65603792021-05-27 17:17:12 -040044 @echo ""
John Snow50d0fba2021-06-29 17:43:21 -040045 @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 Snow65603792021-05-27 17:17:12 -040050
John Snow205d7212021-06-29 17:43:17 -040051.PHONY: pipenv
John Snow6f84d722021-06-29 17:43:15 -040052pipenv: .venv
John Snow65603792021-05-27 17:17:12 -040053.venv: Pipfile.lock
54 @PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated
John Snow19cf0032021-06-29 17:43:22 -040055 rm -f pyproject.toml
John Snow65603792021-05-27 17:17:12 -040056 @touch .venv
57
John Snow205d7212021-06-29 17:43:17 -040058.PHONY: check-pipenv
John Snow6f84d722021-06-29 17:43:15 -040059check-pipenv: pipenv
John Snow65603792021-05-27 17:17:12 -040060 @pipenv run make check
61
John Snow2c24d522021-06-29 17:43:19 -040062.PHONY: dev-venv
63dev-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
76check-dev: dev-venv
77 @( \
78 echo "ACTIVATE $(QEMU_VENV_DIR)"; \
79 . $(QEMU_VENV_DIR)/bin/activate; \
80 make check; \
81 )
82
John Snow205d7212021-06-29 17:43:17 -040083.PHONY: develop
John Snow65603792021-05-27 17:17:12 -040084develop:
John Snow2c24d522021-06-29 17:43:19 -040085 pip3 install --disable-pip-version-check -e .[devel]
John Snow65603792021-05-27 17:17:12 -040086
John Snow205d7212021-06-29 17:43:17 -040087.PHONY: check
John Snow65603792021-05-27 17:17:12 -040088check:
89 @avocado --config avocado.cfg run tests/
90
John Snow205d7212021-06-29 17:43:17 -040091.PHONY: check-tox
John Snow3c8de382021-05-27 17:17:14 -040092check-tox:
Wainer dos Santos Moschetta6f651a62021-06-30 15:45:46 -030093 @tox $(QEMU_TOX_EXTRA_ARGS)
John Snow3c8de382021-05-27 17:17:14 -040094
John Snowa4ffaec2021-09-15 12:29:55 -040095.PHONY: check-coverage
96check-coverage:
97 @coverage run -m avocado --config avocado.cfg run tests/*.py
98 @coverage combine
99 @coverage html
100 @coverage report
101
John Snow205d7212021-06-29 17:43:17 -0400102.PHONY: clean
John Snow65603792021-05-27 17:17:12 -0400103clean:
104 python3 setup.py clean --all
John Snow19cf0032021-06-29 17:43:22 -0400105 rm -f pyproject.toml
John Snow65603792021-05-27 17:17:12 -0400106
John Snow205d7212021-06-29 17:43:17 -0400107.PHONY: distclean
John Snow65603792021-05-27 17:17:12 -0400108distclean: clean
John Snow2c24d522021-06-29 17:43:19 -0400109 rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
John Snowa4ffaec2021-09-15 12:29:55 -0400110 rm -f .coverage .coverage.*
111 rm -rf htmlcov/