]> git.proxmox.com Git - mirror_qemu.git/blob - python/Makefile
python: add 'make check-dev' invocation
[mirror_qemu.git] / python / Makefile
1 QEMU_VENV_DIR=.dev-venv
2
3 .PHONY: help
4 help:
5 @echo "python packaging help:"
6 @echo ""
7 @echo "make check-pipenv:"
8 @echo " Run tests in pipenv's virtual environment."
9 @echo " These tests use the oldest dependencies."
10 @echo " Requires: Python 3.6 and pipenv."
11 @echo " Hint (Fedora): 'sudo dnf install python3.6 pipenv'"
12 @echo ""
13 @echo "make check-tox:"
14 @echo " Run tests against multiple python versions."
15 @echo " These tests use the newest dependencies."
16 @echo " Requires: Python 3.6 - 3.10, and tox."
17 @echo " Hint (Fedora): 'sudo dnf install python3-tox python3.10'"
18 @echo ""
19 @echo "make check-dev:"
20 @echo " Run tests in a venv against your default python3 version."
21 @echo " These tests use the newest dependencies."
22 @echo " Requires: Python 3.x"
23 @echo ""
24 @echo "make develop: Install deps for 'make check', and"
25 @echo " the qemu libs in editable/development mode."
26 @echo ""
27 @echo "make check: run linters using the current environment."
28 @echo ""
29 @echo "make pipenv"
30 @echo " Creates pipenv's virtual environment (.venv)"
31 @echo ""
32 @echo "make dev-venv"
33 @echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))"
34 @echo ""
35 @echo "make clean: remove package build output."
36 @echo ""
37 @echo "make distclean: remove venv files, qemu package forwarder,"
38 @echo " built distribution files, and everything"
39 @echo " from 'make clean'."
40
41 .PHONY: pipenv
42 pipenv: .venv
43 .venv: Pipfile.lock
44 @PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated
45 @touch .venv
46
47 .PHONY: check-pipenv
48 check-pipenv: pipenv
49 @pipenv run make check
50
51 .PHONY: dev-venv
52 dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate
53 $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate: setup.cfg
54 @echo "VENV $(QEMU_VENV_DIR)"
55 @python3 -m venv $(QEMU_VENV_DIR)
56 @( \
57 echo "ACTIVATE $(QEMU_VENV_DIR)"; \
58 . $(QEMU_VENV_DIR)/bin/activate; \
59 echo "INSTALL qemu[devel] $(QEMU_VENV_DIR)"; \
60 make develop 1>/dev/null; \
61 )
62 @touch $(QEMU_VENV_DIR)
63
64 .PHONY: check-dev
65 check-dev: dev-venv
66 @( \
67 echo "ACTIVATE $(QEMU_VENV_DIR)"; \
68 . $(QEMU_VENV_DIR)/bin/activate; \
69 make check; \
70 )
71
72 .PHONY: develop
73 develop:
74 pip3 install --disable-pip-version-check -e .[devel]
75
76 .PHONY: check
77 check:
78 @avocado --config avocado.cfg run tests/
79
80 .PHONY: check-tox
81 check-tox:
82 @tox
83
84 .PHONY: clean
85 clean:
86 python3 setup.py clean --all
87
88 .PHONY: distclean
89 distclean: clean
90 rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/