-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
76 lines (67 loc) · 2.57 KB
/
Makefile
File metadata and controls
76 lines (67 loc) · 2.57 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
all:
@echo "Guacalib Makefile targets:"
@echo ""
@echo "Development:"
@echo " make format - Format Python code with black"
@echo " make format-check - Check code formatting without changes"
@echo " make tests - Run full test suite"
@echo " make cleanup - Clean up test database entries"
@echo ""
@echo "Build & Release:"
@echo " make set-release-version v=X.X.X - Set version in version.py and README.md"
@echo " make build - Build package for distribution"
@echo " make testpub - Publish to PyPI test repository"
@echo " make pub - Publish to PyPI production"
@echo " make push - Create release tag and push to Git"
.PHONY: set-release-version
set-release-version:
@test -n "$(v)" || { echo "Usage: make set-release-version v=X.X.X"; exit 1; }
@echo "Setting version to $(v)..."
sed -i 's/VERSION = ".*"/VERSION = "$(v)"/' guacalib/version.py
sed -i 's/This is version .*/This is version $(v)/' README.md
@echo "Version updated to $(v) in version.py and README.md"
@echo "Don't forget to update CHANGELOG.md!"
build: FORCE
rm -rf build/ dist/ *.egg-info/
python -m build
testpub: build
python3 -m twine upload --repository testpypi dist/*
pub: build
python3 -m twine upload dist/*
FORCE:
tests: FORCE
pip uninstall -y guacalib
pip install -e .
/bin/bash tests/run_tests_with_summary.sh
cleanup: FORCE
./tests/cleanup_test_entries.sh full
format: FORCE
@echo "Formatting Python files with black..."
@command -v black >/dev/null 2>&1 || { echo "Error: black is not installed. Install with: pip install black"; exit 1; }
black guacalib/ *.py
@echo "Formatting complete!"
format-check: FORCE
@echo "Checking Python file formatting with black..."
@command -v black >/dev/null 2>&1 || { echo "Error: black is not installed. Install with: pip install black"; exit 1; }
black --check guacalib/ *.py
.PHONY: push
push:
@if [ -n "$$(git status --porcelain)" ]; then \
echo "Error: Working directory not clean"; \
exit 1; \
fi; \
VERSION=$$(python3 -c "from guacalib.version import VERSION; print(VERSION)"); \
if git rev-parse "v$$VERSION" >/dev/null 2>&1; then \
echo "Error: Tag v$$VERSION already exists"; \
exit 1; \
fi; \
echo "Updating version in README.md to $$VERSION..."; \
sed -i.bak -E 's/version [0-9]+\.[0-9]+(\.[0-9]+)?/version '"$$VERSION"'/g' README.md; \
rm README.md.bak; \
git add README.md; \
git commit -m "Update version to $$VERSION in README.md"; \
echo "Creating and pushing tag v$$VERSION..."; \
git tag -a "v$$VERSION" -m "Release v$$VERSION"; \
git push origin main; \
git push origin "v$$VERSION"
git push