-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
57 lines (46 loc) · 1.48 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
short_ver = $(shell git describe --abbrev=0 --always | cut -f2 -d/ )
long_ver = $(shell git describe --long 2>/dev/null | cut -f2 -d/ || echo $(short_ver)-0-unknown-g`git describe --always`)
.DEFAULT_GOAL := rpm
PYTHON ?= python3
PYTHON_SOURCE_DIRS = rohmu/ test/
PYTEST_ARG ?= -v
RST_FILES = README.rst docs/about.rst docs/autodoc.rst docs/development.rst docs/index.rst docs/toc.rst docs/usage.rst
.PHONY: fedora-dev-setup
fedora-dev-setup:
dnf builddep -y rohmu.spec
.PHONY: rpm
rpm: rohmu/
git archive --output=rohmu-rpm-src.tar --prefix=rohmu/ HEAD
rpmbuild -bb rohmu.spec \
--define '_topdir $(PWD)/rpm' \
--define '_sourcedir $(CURDIR)' \
--define 'major_version $(short_ver)' \
--define 'minor_version $(subst -,.,$(subst $(short_ver)-,,$(long_ver)))'
$(RM) rohmu-rpm-src.tar
.PHONY: unittest
unittest:
$(PYTHON) -m pytest -vv test/
.PHONY: lint
lint:
ruff check $(PYTHON_SOURCE_DIRS)
.PHONY: mypy
mypy:
$(PYTHON) -m mypy --show-error-codes $(PYTHON_SOURCE_DIRS)
.PHONY: fmt
fmt:
ruff check --select I --fix $(PYTHON_SOURCE_DIRS)
ruff format $(PYTHON_SOURCE_DIRS)
$(PYTHON) -m rstfmt $(RST_FILES) -w 100
.PHONY: coverage
coverage:
$(PYTHON) -m pytest $(PYTEST_ARG) --cov-report term-missing --cov-report xml:coverage.xml \
--cov rohmu test/
.PHONY: venv
venv:
$(PYTHON) -m venv venv && \
source venv/bin/activate && \
pip install -U pip && \
pip install -e ".[dev,docs]"
.PHONY: clean
clean:
rm -rf venv .mypy_cache/ .pytest_cache/ rohmu.egg-info/ rpm/ rohmu-rpm-src.tar