python-compute/Makefile

53 lines
1.3 KiB
Makefile
Raw Normal View History

2023-11-23 02:34:02 +03:00
SRCDIR = compute
DISTDIR = dist
DOCS_SRCDIR = docs/source
DOCS_BUILDDIR = docs/build
2023-11-06 12:52:19 +03:00
.PHONY: docs
2023-08-24 22:36:12 +03:00
2023-12-01 01:39:26 +03:00
all: docs build-deb
2023-06-17 20:07:50 +03:00
2023-11-23 02:34:02 +03:00
requirements.txt:
poetry export -f requirements.txt -o requirements.txt
2023-12-03 23:25:34 +03:00
build: version format lint
2023-06-17 20:07:50 +03:00
poetry build
2023-11-23 02:34:02 +03:00
build-deb: build
cd packaging && $(MAKE)
2023-12-03 23:25:34 +03:00
version:
VERSION=$$(awk '/^version/{print $$3}' pyproject.toml); \
sed "s/__version__ =.*/__version__ = $$VERSION/" -i $(SRCDIR)/__init__.py; \
sed "s/release =.*/release = $$VERSION/" -i $(DOCS_SRCDIR)/conf.py
2023-08-24 22:36:12 +03:00
format:
2023-11-23 02:34:02 +03:00
poetry run isort $(SRCDIR)
poetry run ruff format $(SRCDIR)
2023-08-24 22:36:12 +03:00
lint:
2023-11-23 02:34:02 +03:00
poetry run ruff check $(SRCDIR)
2023-11-06 12:52:19 +03:00
docs:
2023-11-23 02:34:02 +03:00
poetry run sphinx-build $(DOCS_SRCDIR) $(DOCS_BUILDDIR)
2023-11-06 12:52:19 +03:00
2023-11-06 17:47:56 +03:00
docs-versions:
2023-11-23 02:34:02 +03:00
poetry run sphinx-multiversion $(DOCS_SRCDIR) $(DOCS_BUILDDIR)
2023-11-06 17:47:56 +03:00
2023-11-09 01:17:50 +03:00
serve-docs:
2023-12-03 23:25:34 +03:00
poetry run sphinx-autobuild $(DOCS_SRCDIR) $(DOCS_BUILDDIR) \
--pre-build 'make clean'
2023-11-06 12:52:19 +03:00
clean:
2023-11-23 02:34:02 +03:00
[ -d $(DISTDIR) ] && rm -rf $(DISTDIR) || true
[ -d $(DOCS_BUILDDIR) ] && rm -rf $(DOCS_BUILDDIR) || true
2023-11-06 12:52:19 +03:00
find . -type d -name __pycache__ -exec rm -rf {} \; > /dev/null 2>&1 || true
2023-11-23 02:34:02 +03:00
cd packaging && $(MAKE) clean
2023-11-06 12:52:19 +03:00
2023-11-23 02:34:02 +03:00
test-build: build-deb
scp packaging/build/compute*.deb vm:~
2023-12-03 23:25:34 +03:00
upload-docs: docs-versions
ssh root@hitomi 'rm -rf /srv/http/nixhacks.net/hstack/*'
2023-12-13 01:42:50 +03:00
scp -r $(DOCS_BUILDDIR)/* root@hitomi:/srv/http/nixhacks.net/hstack/