-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
84 lines (60 loc) · 2.51 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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
version := $(shell python3 -c "import configparser; config = configparser.ConfigParser(); config.read('pyproject.toml'); print(config['tool.poetry']['version'][1:-1])")
daml_dit_if_files := $(shell find daml_dit_if -name '*.py') README.md
daml_dit_if_bdist := dist/daml_dit_if-$(version)-py3-none-any.whl
daml_dit_if_sdist := dist/daml_dit_if-$(version).tar.gz
build_dir := build/.dir
poetry_build_marker := build/.poetry.build
poetry_install_marker := build/.poetry.install
SRC_FILES=$(shell find daml_dit_if -type f)
####################################################################################################
## GENERAL TARGETS ##
####################################################################################################
.PHONY: all
all: build
.PHONY: clean
clean:
find . -name *.pyc -print0 | xargs -0 rm
find . -name __pycache__ -print0 | xargs -0 rm -fr
rm -fr build dist $(LIBRARY_NAME).egg-info test-reports
.PHONY: deps
deps: $(poetry_install_marker)
.PHONY: format
format:
poetry run isort daml_dit_if
poetry run black daml_dit_if
.PHONY: publish
publish: build
poetry publish
.PHONY: install
install: build
pip3 install --force $(daml_dit_if_bdist)
.PHONY: build
build: test $(daml_dit_if_bdist) $(daml_dit_if_sdist)
.PHONY: version
version:
@echo $(version)
####################################################################################################
## TEST TARGETS ##
####################################################################################################
.PHONY: format-test
format-test:
poetry run isort daml_dit_if --check-only
poetry run black daml_dit_if . --check --extend-exclude='^/target'
.PHONY: typecheck
typecheck:
poetry run python3 -m mypy --config-file pytest.ini -p daml_dit_if
.PHONY: test
test: format-test typecheck
####################################################################################################
## file targets ##
####################################################################################################
$(build_dir):
@mkdir -p build
@touch $@
$(poetry_build_marker): $(build_dir) pyproject.toml $(SRC_FILES)
poetry build
touch $@
$(poetry_install_marker): $(build_dir) poetry.lock
touch $@
$(daml_dit_if_bdist): $(poetry_build_marker)
$(daml_dit_if_sdist): $(poetry_build_marker)