Makefile (3071B)
1 QEMU_VENV_DIR=.dev-venv 2 QEMU_TOX_EXTRA_ARGS ?= 3 4 .PHONY: help 5 help: 6 @echo "python packaging help:" 7 @echo "" 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'" 13 @echo "" 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'" 19 @echo " The variable QEMU_TOX_EXTRA_ARGS can be use to pass extra" 20 @echo " arguments to tox". 21 @echo "" 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 "" 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:" 32 @echo " Install deps needed for 'make check'," 33 @echo " and install the qemu package in editable mode." 34 @echo " (Can be used in or outside of a venv.)" 35 @echo "" 36 @echo "make pipenv" 37 @echo " Creates pipenv's virtual environment (.venv)" 38 @echo "" 39 @echo "make dev-venv" 40 @echo " Creates a simple venv for check-dev. ($(QEMU_VENV_DIR))" 41 @echo "" 42 @echo "make clean:" 43 @echo " Remove package build output." 44 @echo "" 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" 50 51 .PHONY: pipenv 52 pipenv: .venv 53 .venv: Pipfile.lock 54 @PIPENV_VENV_IN_PROJECT=1 pipenv sync --dev --keep-outdated 55 rm -f pyproject.toml 56 @touch .venv 57 58 .PHONY: check-pipenv 59 check-pipenv: pipenv 60 @pipenv run make check 61 62 .PHONY: dev-venv 63 dev-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 76 check-dev: dev-venv 77 @( \ 78 echo "ACTIVATE $(QEMU_VENV_DIR)"; \ 79 . $(QEMU_VENV_DIR)/bin/activate; \ 80 make check; \ 81 ) 82 83 .PHONY: develop 84 develop: 85 pip3 install --disable-pip-version-check -e .[devel] 86 87 .PHONY: check 88 check: 89 @avocado --config avocado.cfg run tests/ 90 91 .PHONY: check-tox 92 check-tox: 93 @tox $(QEMU_TOX_EXTRA_ARGS) 94 95 .PHONY: check-coverage 96 check-coverage: 97 @coverage run -m avocado --config avocado.cfg run tests/*.py 98 @coverage combine 99 @coverage html 100 @coverage report 101 102 .PHONY: clean 103 clean: 104 python3 setup.py clean --all 105 rm -f pyproject.toml 106 107 .PHONY: distclean 108 distclean: clean 109 rm -rf qemu.egg-info/ .venv/ .tox/ $(QEMU_VENV_DIR) dist/ 110 rm -f .coverage .coverage.* 111 rm -rf htmlcov/