]> git.proxmox.com Git - mirror_qemu.git/blame - python/Makefile
python: support pylint 2.16
[mirror_qemu.git] / python / Makefile
CommitLineData
2c24d52d 1QEMU_VENV_DIR=.dev-venv
6f651a6d 2QEMU_TOX_EXTRA_ARGS ?=
2c24d52d 3
205d7219 4.PHONY: help
6560379f
JS
5help:
6 @echo "python packaging help:"
7 @echo ""
6f84d726
JS
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'"
6560379f 13 @echo ""
8c95d0fc
JS
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'"
6f651a6d
WSM
19 @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra"
20 @echo " arguments to tox".
8c95d0fc 21 @echo ""
2c24d52d
JS
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 ""
28cd32fb
JS
27 @echo "make check:"
28 @echo " Run tests in your *current environment*."
29 @echo " Performs no environment setup of any kind."
30 @echo ""
31 @echo "make develop:"
7a21bee2 32 @echo " Install deps needed for 'make check',"
28cd32fb
JS
33 @echo " and install the qemu package in editable mode."
34 @echo " (Can be used in or outside of a venv.)"
6560379f 35 @echo ""
6f84d726
JS
36 @echo "make pipenv"
37 @echo " Creates pipenv's virtual environment (.venv)"
38 @echo ""
2c24d52d
JS
39 @echo "make dev-venv"
40 @echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))"
41 @echo ""
50d0fba8
JS
42 @echo "make clean:"
43 @echo " Remove package build output."
6560379f 44 @echo ""
50d0fba8
JS
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"
6560379f 50
205d7219 51.PHONY: pipenv
6f84d726 52pipenv: .venv
6560379f
JS
53.venv: Pipfile.lock
54 @PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated
19cf0031 55 rm -f pyproject.toml
6560379f
JS
56 @touch .venv
57
205d7219 58.PHONY: check-pipenv
6f84d726 59check-pipenv: pipenv
6560379f
JS
60 @pipenv run make check
61
2c24d52d
JS
62.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
205d7219 83.PHONY: develop
6560379f 84develop:
2c24d52d 85 pip3 install --disable-pip-version-check -e .[devel]
6560379f 86
205d7219 87.PHONY: check
6560379f
JS
88check:
89 @avocado --config avocado.cfg run tests/
90
205d7219 91.PHONY: check-tox
3c8de38c 92check-tox:
6f651a6d 93 @tox $(QEMU_TOX_EXTRA_ARGS)
3c8de38c 94
a4ffaecd
JS
95.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
205d7219 102.PHONY: clean
6560379f
JS
103clean:
104 python3 setup.py clean --all
19cf0031 105 rm -f pyproject.toml
6560379f 106
205d7219 107.PHONY: distclean
6560379f 108distclean: clean
2c24d52d 109 rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
a4ffaecd
JS
110 rm -f .coverage .coverage.*
111 rm -rf htmlcov/