-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
61 lines (44 loc) · 1.06 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
58
59
60
61
.SHELL := /bin/bash
.DEFAULT_GOAL := gbp
name := $(shell pdm show --name)
version := $(shell pdm show --version)
sdist := dist/$(name)-$(version).tar.gz
wheel := dist/$(subst -,_,$(name))-$(version)-py3-none-any.whl
src := $(shell find src -type f -print)
tests := $(shell find tests -type f -print)
python_src := $(filter %.py, $(src) $(tests))
.coverage: $(src) $(tests)
pdm run coverage run -m tests --failfast
.PHONY: test
test: .coverage
coverage-report: .coverage
pdm run coverage html
pdm run python -m webbrowser -t file://$(CURDIR)/htmlcov/index.html
gbp:
pdm run shiv --compressed -o $@ -e gbpcli:main .
build: $(sdist) $(wheel)
.PHONY: wheel
wheel: $(wheel)
.PHONY: sdist
sdist: $(sdist)
$(sdist) $(wheel): $(src)
pdm build
.PHONY: clean
clean: clean-build
rm -rf .coverage .fmt gbp htmlcov .mypy_cache
.PHONY: clean-build
clean-build:
rm -rf dist build
.PHONY: lint
lint:
pdm run pylint src tests
pdm run mypy src
.fmt: $(python_src)
pdm run isort $?
pdm run black $?
touch $@
.PHONY: fmt
fmt: .fmt
.PHONY: update
update:
pdm update --update-eager