xref: /openbmc/qemu/python/Makefile (revision 812b31d3)
1QEMU_VENV_DIR=.dev-venv
2
3.PHONY: help
4help:
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 check:"
25	@echo "    Run tests in your *current environment*."
26	@echo "    Performs no environment setup of any kind."
27	@echo ""
28	@echo "make develop:"
29	@echo "    Install deps needed for for 'make check',"
30	@echo "    and install the qemu package in editable mode."
31	@echo "    (Can be used in or outside of a venv.)"
32	@echo ""
33	@echo "make pipenv"
34	@echo "    Creates pipenv's virtual environment (.venv)"
35	@echo ""
36	@echo "make dev-venv"
37	@echo "    Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))"
38	@echo ""
39	@echo "make clean:"
40	@echo "    Remove package build output."
41	@echo ""
42	@echo "make distclean:"
43	@echo "    remove pipenv/venv files, qemu package forwarder,"
44	@echo "    built distribution files, and everything from 'make clean'."
45	@echo ""
46	@echo -e "Have a nice day ^_^\n"
47
48.PHONY: pipenv
49pipenv: .venv
50.venv: Pipfile.lock
51	@PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated
52	rm -f pyproject.toml
53	@touch .venv
54
55.PHONY: check-pipenv
56check-pipenv: pipenv
57	@pipenv run make check
58
59.PHONY: dev-venv
60dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate
61$(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate: setup.cfg
62	@echo "VENV $(QEMU_VENV_DIR)"
63	@python3 -m venv $(QEMU_VENV_DIR)
64	@(							\
65		echo "ACTIVATE $(QEMU_VENV_DIR)";		\
66		. $(QEMU_VENV_DIR)/bin/activate;		\
67		echo "INSTALL qemu[devel] $(QEMU_VENV_DIR)";	\
68		make develop 1>/dev/null;			\
69	)
70	@touch $(QEMU_VENV_DIR)
71
72.PHONY: check-dev
73check-dev: dev-venv
74	@(							\
75		echo "ACTIVATE $(QEMU_VENV_DIR)";		\
76		. $(QEMU_VENV_DIR)/bin/activate;		\
77		make check;					\
78	)
79
80.PHONY: develop
81develop:
82	pip3 install --disable-pip-version-check -e .[devel]
83
84.PHONY: check
85check:
86	@avocado --config avocado.cfg run tests/
87
88.PHONY: check-tox
89check-tox:
90	@tox
91
92.PHONY: clean
93clean:
94	python3 setup.py clean --all
95	rm -f pyproject.toml
96
97.PHONY: distclean
98distclean: clean
99	rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
100