xref: /openbmc/qemu/python/Makefile (revision 28cd32fb)
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:      remove package build output."
40	@echo ""
41	@echo "make distclean:  remove venv files, qemu package forwarder,"
42	@echo "                 built distribution files, and everything"
43	@echo "                 from 'make clean'."
44
45.PHONY: pipenv
46pipenv: .venv
47.venv: Pipfile.lock
48	@PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated
49	@touch .venv
50
51.PHONY: check-pipenv
52check-pipenv: pipenv
53	@pipenv run make check
54
55.PHONY: dev-venv
56dev-venv: $(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate
57$(QEMU_VENV_DIR) $(QEMU_VENV_DIR)/bin/activate: setup.cfg
58	@echo "VENV $(QEMU_VENV_DIR)"
59	@python3 -m venv $(QEMU_VENV_DIR)
60	@(							\
61		echo "ACTIVATE $(QEMU_VENV_DIR)";		\
62		. $(QEMU_VENV_DIR)/bin/activate;		\
63		echo "INSTALL qemu[devel] $(QEMU_VENV_DIR)";	\
64		make develop 1>/dev/null;			\
65	)
66	@touch $(QEMU_VENV_DIR)
67
68.PHONY: check-dev
69check-dev: dev-venv
70	@(							\
71		echo "ACTIVATE $(QEMU_VENV_DIR)";		\
72		. $(QEMU_VENV_DIR)/bin/activate;		\
73		make check;					\
74	)
75
76.PHONY: develop
77develop:
78	pip3 install --disable-pip-version-check -e .[devel]
79
80.PHONY: check
81check:
82	@avocado --config avocado.cfg run tests/
83
84.PHONY: check-tox
85check-tox:
86	@tox
87
88.PHONY: clean
89clean:
90	python3 setup.py clean --all
91
92.PHONY: distclean
93distclean: clean
94	rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/
95