Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (101 loc) · 2.26 KB
/
Copy pathMakefile
File metadata and controls
142 lines (101 loc) · 2.26 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# qgis server makefile
#
DEPTH=.
include $(DEPTH)/config.mk
MANIFEST=src/pyqgisserver/build.manifest
PYTHON_PKG=src
TESTDIR=tests/unittests
#
# Configure
#
# Check if uv is available
$(eval UV_PATH=$(shell which uv))
ifdef UV_PATH
# Use installed python
export UV_NO_MANAGED_PYTHON=true
ifdef VIRTUAL_ENV
# Always prefer active environment
UV_OPTS += --active
endif
UV=uv run $(UV_OPTS)
endif
-include .localconfig.mk
REQUIREMENT_GROUPS=\
dev \
tests \
lint \
$(NULL)
.PHONY: update-requirements
REQUIREMENTS=requirements.txt $(patsubst %, update-requirements-%, $(REQUIREMENT_GROUPS))
update-requirements: $(REQUIREMENTS)
requirements.txt: uv.lock
@echo "Updating requirements.txt"; \
uv export --no-dev --format requirements.txt \
--no-annotate \
--no-editable \
--no-hashes -q -o requirements.txt;
update-requirements-%: uv.lock
@echo "Updating requirqments for '$*'"; \
uv export --format requirements.txt \
--no-annotate \
--no-editable \
--no-hashes \
--only-group $* \
-q -o requirements/$*.txt;
# Install all dev requirements using frozen packagess
install:
@ uv sync --frozen $(UV_OPTS)
version:
@echo $(VERSION) > VERSION
configure:: version
ifeq ($(DIST_RELEASE), true)
configure:: bump-release-version
endif
manifest: version
@{ \
echo name=$(PROJECT_NAME) > $(MANIFEST) && \
echo version=$(VERSION) >> $(MANIFEST) && \
echo buildid=$(BUILDID) >> $(MANIFEST) && \
echo commitid=$(COMMITID) >> $(MANIFEST); \
}
@cat $(MANIFEST)
#
# Release
#
bump-release-version:
@echo "Bumping to release version"
@ uv version --bump stable $(UV_OPTS) --frozen || true
#
# Static analysis
#
LINT_TARGETS=$(PYTHON_PKG) $(TESTDIR)
lint::
@ $(UV) ruff check --output-format=concise $(LINT_TARGETS)
lint-preview:
@ $(UV) ruff check --preview $(LINT_TARGETS)
lint-fix:
@ $(UV) ruff check --fix $(LINT_TARGETS)
format:
@ $(UV) ruff format $(LINT_TARGETS)
format-diff:
@ $(UV) ruff format --diff $(LINT_TARGETS)
typecheck:
@ $(UV) mypy --config-file=$(topsrcdir)/mypy.ini src
#
# Tests
#
test: manifest
$(UV) pytest -v $(TESTDIR)
#
# Packaging
#
dist:: clean
@uv build --sdist --wheel
clean:
rm -rf *.egg-info ./dist
#
# Deprecated
#
PYPISERVER:=storage
deliver:
twine upload $(TWINE_OPTIONS) -r $(PYPISERVER) dist/*.tar.gz