-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathMakefile
More file actions
113 lines (95 loc) · 3.41 KB
/
Makefile
File metadata and controls
113 lines (95 loc) · 3.41 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
.PHONY: help build sdist wheel dist clean install remove check upload upload_test wheel_manylinux wheel_musllinux
PY ?= python3
PACKAGE ?= HLL
CPYTHONS ?= cp39 cp310 cp311 cp312 cp313
help:
@echo "Targets:"
@echo " install - pip install ."
@echo " build - Build sdist + wheel (host)"
@echo " sdist - Build source distribution only"
@echo " wheel - Build wheel (host, non-portable)"
@echo " wheel_manylinux - Build manylinux wheels for CPYTHONS=$(CPYTHONS)"
@echo " wheel_musllinux - Build musllinux wheels for CPYTHONS=$(CPYTHONS)"
@echo " dist - Full release: clean + sdist + manylinux + musllinux"
@echo " check - twine check dist/*"
@echo " upload - Upload to PyPI"
@echo " upload_test - Upload to TestPyPI"
@echo " remove - pip uninstall $(PACKAGE)"
@echo " clean - Remove build artifacts"
@echo ""
@echo "Variables:"
@echo " CPYTHONS - CPython versions for docker wheel targets (default: $(CPYTHONS))"
@echo ""
@echo "Requires: pip install build twine"
# ---------- host builds ----------
build:
@rm -rf build/
$(PY) -m build
sdist:
@rm -rf build/
$(PY) -m build --sdist
wheel:
@rm -rf build/
$(PY) -m build --wheel
# ---------- docker wheel builds ----------
wheel_manylinux:
docker run --rm -v "$$(pwd)":/work -w /work quay.io/pypa/manylinux_2_28_x86_64 \
bash -lc ' \
set -e; \
rm -rf build/; \
for tag in $(CPYTHONS); do \
pydir=$$(ls -d /opt/python/$${tag}-* 2>/dev/null | head -1) || true; \
[ -z "$$pydir" ] && echo "Skipping $$tag (not found)" && continue; \
echo "=== $$tag ==="; \
$$pydir/bin/pip install -q build && \
$$pydir/bin/python -m build --wheel || exit 1; \
done; \
$$pydir/bin/pip install -q auditwheel; \
for whl in dist/*-linux_x86_64.whl; do \
[ -f "$$whl" ] || continue; \
$$pydir/bin/auditwheel repair "$$whl" -w dist/ && rm "$$whl"; \
done \
'
wheel_musllinux:
docker run --rm -v "$$(pwd)":/work -w /work quay.io/pypa/musllinux_1_2_x86_64 \
bash -lc ' \
set -e; \
rm -rf build/; \
for tag in $(CPYTHONS); do \
pydir=$$(ls -d /opt/python/$${tag}-* 2>/dev/null | head -1) || true; \
[ -z "$$pydir" ] && echo "Skipping $$tag (not found)" && continue; \
echo "=== $$tag ==="; \
$$pydir/bin/pip install -q build && \
$$pydir/bin/python -m build --wheel || exit 1; \
done; \
$$pydir/bin/pip install -q auditwheel; \
for whl in dist/*-linux_x86_64.whl; do \
[ -f "$$whl" ] || continue; \
$$pydir/bin/auditwheel repair "$$whl" -w dist/ && rm "$$whl"; \
done \
'
# ---------- release ----------
dist: clean sdist wheel_manylinux wheel_musllinux
check:
$(PY) -m twine check dist/*
upload: check
@if ls dist/*-linux_x86_64.whl >/dev/null 2>&1; then \
echo "ERROR: dist/ contains non-portable linux_x86_64 wheels."; \
echo "Run 'make dist' to build manylinux/musllinux wheels."; \
exit 1; \
fi
$(PY) -m twine upload dist/*
upload_test: check
@if ls dist/*-linux_x86_64.whl >/dev/null 2>&1; then \
echo "ERROR: dist/ contains non-portable linux_x86_64 wheels."; \
echo "Run 'make dist' to build manylinux/musllinux wheels."; \
exit 1; \
fi
$(PY) -m twine upload -r testpypi dist/*
# ---------- development ----------
install:
pip install .
remove:
pip uninstall -y $(PACKAGE)
clean:
rm -rf build/ dist/ *.egg-info/