Merge tag 'pull-error-2023-02-23' of https://repo.or.cz/qemu/armbru into staging
[qemu/armbru.git] / python / Makefile
blobc5bd6ff83ac90fe95b6ff88588034143f30eeaeb
1 QEMU_VENV_DIR=.dev-venv
2 QEMU_MINVENV_DIR=.min-venv
3 QEMU_TOX_EXTRA_ARGS ?=
5 .PHONY: help
6 help:
7 @echo "python packaging help:"
8 @echo ""
9 @echo "make check-minreqs:"
10 @echo " Run tests in the minreqs virtual environment."
11 @echo " These tests use the oldest dependencies."
12 @echo " Requires: Python 3.6"
13 @echo " Hint (Fedora): 'sudo dnf install python3.6'"
14 @echo ""
15 @echo "make check-tox:"
16 @echo " Run tests against multiple python versions."
17 @echo " These tests use the newest dependencies."
18 @echo " Requires: Python 3.6 - 3.10, and tox."
19 @echo " Hint (Fedora): 'sudo dnf install python3-tox python3.10'"
20 @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra"
21 @echo " arguments to tox".
22 @echo ""
23 @echo "make check-dev:"
24 @echo " Run tests in a venv against your default python3 version."
25 @echo " These tests use the newest dependencies."
26 @echo " Requires: Python 3.x"
27 @echo ""
28 @echo "make check:"
29 @echo " Run tests in your *current environment*."
30 @echo " Performs no environment setup of any kind."
31 @echo ""
32 @echo "make develop:"
33 @echo " Install deps needed for 'make check',"
34 @echo " and install the qemu package in editable mode."
35 @echo " (Can be used in or outside of a venv.)"
36 @echo ""
37 @echo "make min-venv"
38 @echo " Creates the minreqs virtual environment ($(QEMU_MINVENV_DIR))"
39 @echo ""
40 @echo "make dev-venv"
41 @echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))"
42 @echo ""
43 @echo "make clean:"
44 @echo " Remove package build output."
45 @echo ""
46 @echo "make distclean:"
47 @echo " remove venv files, qemu package forwarder,"
48 @echo " built distribution files, and everything from 'make clean'."
49 @echo ""
50 @echo -e "Have a nice day ^_^\n"
52 .PHONY: pipenv check-pipenv
53 pipenv check-pipenv:
54 @echo "pipenv was dropped; try 'make check-minreqs' or 'make min-venv'"
55 @exit 1
57 .PHONY: min-venv
58 min-venv: $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate
59 $(QEMU_MINVENV_DIR) $(QEMU_MINVENV_DIR)/bin/activate: setup.cfg tests/minreqs.txt
60 @echo "VENV $(QEMU_MINVENV_DIR)"
61 @python3.6 -m venv $(QEMU_MINVENV_DIR)
62 @( \
63 echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \
64 . $(QEMU_MINVENV_DIR)/bin/activate; \
65 echo "INSTALL -r tests/minreqs.txt $(QEMU_MINVENV_DIR)";\
66 pip install -r tests/minreqs.txt 1>/dev/null; \
67 echo "INSTALL -e qemu $(QEMU_MINVENV_DIR)"; \
68 pip install -e . 1>/dev/null; \
70 @touch $(QEMU_MINVENV_DIR)
72 .PHONY: check-minreqs
73 check-minreqs: min-venv
74 @( \
75 echo "ACTIVATE $(QEMU_MINVENV_DIR)"; \
76 . $(QEMU_MINVENV_DIR)/bin/activate; \
77 make check; \
80 .PHONY: dev-venv
81 dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate
82 $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate: setup.cfg
83 @echo "VENV $(QEMU_VENV_DIR)"
84 @python3 -m venv $(QEMU_VENV_DIR)
85 @( \
86 echo "ACTIVATE $(QEMU_VENV_DIR)"; \
87 . $(QEMU_VENV_DIR)/bin/activate; \
88 echo "INSTALL qemu[devel] $(QEMU_VENV_DIR)"; \
89 make develop 1>/dev/null; \
91 @touch $(QEMU_VENV_DIR)
93 .PHONY: check-dev
94 check-dev: dev-venv
95 @( \
96 echo "ACTIVATE $(QEMU_VENV_DIR)"; \
97 . $(QEMU_VENV_DIR)/bin/activate; \
98 make check; \
101 .PHONY: develop
102 develop:
103 pip3 install --disable-pip-version-check -e .[devel]
105 .PHONY: check
106 check:
107 @avocado --config avocado.cfg run tests/
109 .PHONY: check-tox
110 check-tox:
111 @tox $(QEMU_TOX_EXTRA_ARGS)
113 .PHONY: check-coverage
114 check-coverage:
115 @coverage run -m avocado --config avocado.cfg run tests/*.py
116 @coverage combine
117 @coverage html
118 @coverage report
120 .PHONY: clean
121 clean:
122 python3 setup.py clean --all
123 rm -f pyproject.toml
125 .PHONY: distclean
126 distclean: clean
127 rm -rf qemu.egg-info/ .eggs/ dist/
128 rm -rf $(QEMU_VENV_DIR) $(QEMU_MINVENV_DIR) .tox/
129 rm -f .coverage .coverage.*
130 rm -rf htmlcov/