-
Notifications
You must be signed in to change notification settings - Fork 109
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (50 loc) · 1.67 KB
/
Copy pathMakefile
File metadata and controls
69 lines (50 loc) · 1.67 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
BUILD_DIR=build
PYTHON ?= /usr/bin/env python3
all: deps lint man package install
# Install dependent pip packages, needed to lint or build
deps:
$(PYTHON) -m pip install .[dev]
# Format using ruff
RUFF_CMD=$(PYTHON) -m ruff
format:
$(RUFF_CMD) format .
$(RUFF_CMD) check --fix .
# Check formatting using ruff
check_format:
$(RUFF_CMD) format --check --diff .
$(RUFF_CMD) check --diff .
MYPY_COMMAND=$(PYTHON) -m mypy --show-error-codes
check_types:
$(MYPY_COMMAND) revup
pylint:
$(PYTHON) -m pylint revup
# Lint check for formatting and type hints
# This needs pass before any merge.
lint: check_types check_format pylint
# Clean all artifacts
clean:
rm -rf $(BUILD_DIR)
rm -rf .mypy_cache
REVUP_VERSION:=$(shell $(PYTHON) revup/version.py)
REVUP_DATE ?= Apr 21, 2021
REVUP_VERSION_HASH?=${shell git rev-parse --short v$(REVUP_VERSION) || echo main}
package: man
REVUP_VERSION_HASH=$(REVUP_VERSION_HASH) $(PYTHON) -m build --outdir $(BUILD_DIR)
install: package
$(PYTHON) -m pip install build/revup-$(REVUP_VERSION)-py3-none-any.whl --force-reinstall
upload_check:
$(PYTHON) -m twine check build/revup-$(REVUP_VERSION).tar.gz
upload_test:
$(PYTHON) -m twine upload --repository testpypi build/revup-$(REVUP_VERSION).tar.gz
upload:
$(PYTHON) -m twine upload build/revup-$(REVUP_VERSION).tar.gz
man:
mkdir -p revup/man1
@for src in docs/*.md ; do \
name=$$(basename $${src} .md) ; \
scripts/build_manpage.sh "$${name}" "$(REVUP_VERSION)" "$(REVUP_DATE)" \
"$${src}" "revup/man1/$${name}.1.gz" || exit 1 ; \
done
test:
$(PYTHON) -m pytest --cov=revup --cov-report=term-missing tests/
.PHONY: all deps man install package format check_format check_types pylint lint clean