yartsu/Makefile

94 lines
2.7 KiB
Makefile
Raw Normal View History

2023-01-20 11:24:52 -06:00
VERSION ?= $(shell git describe --tags --always --dirty=-dev | sed 's/^v//g')
SRC_FILES := $(wildcard yartsu/*)
2023-01-20 11:24:52 -06:00
# TODO: use git not pdm
2022-06-14 18:35:47 -05:00
2022-06-25 18:34:56 -05:00
.PHONY: lint typecheck build format
2022-06-15 13:38:45 -05:00
2023-01-20 11:24:52 -06:00
check: lint typecheck ## apply formatting, linting and typechecking (default)
typcheck: ## perform typechecking
2022-06-14 18:35:47 -05:00
pdm run mypy yartsu
2023-01-20 11:24:52 -06:00
lint: ## format/lint with pre-commit(black,isort,flake8)
2022-06-14 18:35:47 -05:00
pdm run pre-commit run --all
2022-06-25 18:34:56 -05:00
.PHONY: dist release release.assets dist build
2022-06-16 01:47:31 -05:00
2022-06-25 18:34:56 -05:00
release.assets: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu check-version
tar czf build/yartsu-$(VERSION)-x86_64-linux.tar.gz \
build/x86_64-unknown-linux-gnu/release/install/yartsu
2023-01-20 11:24:52 -06:00
release: check-tag release-assets ## create github release and attach gzipped binary
gh release create $(TAG) build/yartsu-$(VERSION)-x86_64-linux.tar.gz -p -d
2022-06-15 13:38:45 -05:00
2023-01-20 11:24:52 -06:00
publish: check-version dist ## publish to pypi with twine
2022-06-15 13:38:45 -05:00
twine upload dist/*
2023-01-20 11:24:52 -06:00
dist: ## build wheel/targz with pdm
2022-06-15 13:38:45 -05:00
pdm build
2023-01-20 11:24:52 -06:00
build: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ## build with pyoxidizer
2022-06-14 18:35:47 -05:00
build/shiv/yartsu: $(SRC_FILES)
2022-06-25 18:34:56 -05:00
@echo "==> Building yartsu w/ shiv <=="
@mkdir -p build/shiv
@shiv \
-c yartsu \
2023-01-20 11:24:52 -06:00
-o ./build/yartsu \
--preamble scripts/preamble.py \
--reproducible \
.
build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu: $(SRC_FILES)
2022-06-25 18:34:56 -05:00
@echo "==> Building yartsu w/ shiv <=="
@pdm install
@pyoxidizer build --release
.PHONY: install.bin install.shiv
2023-01-20 11:24:52 -06:00
install-bin: build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ## install pyoxidizer binary
2022-06-25 18:34:56 -05:00
@echo "==> Installing yartsu to ~/bin <=="
@cp ./build/x86_64-unknown-linux-gnu/release/install/yartsu/yartsu ~/bin
2023-01-20 11:24:52 -06:00
install-shiv: build/shiv/yartsu ## install shiv binary
2022-06-25 18:34:56 -05:00
@echo "==> Installing yartsu to ~/bin <=="
@cp ./build/shiv/yartsu ~/bin
2022-06-14 18:35:47 -05:00
2023-01-20 11:24:52 -06:00
DOCS_RECIPES := $(patsubst %,docs-%,theme diff svg demo)
2022-06-25 18:34:56 -05:00
.PHONY: docs $(DOCS_RECIPES)
2023-01-20 11:24:52 -06:00
docs: $(DOCS_RECIPES) ## generate docs/svg
2023-01-20 11:24:52 -06:00
docs-theme:
2022-06-25 18:34:56 -05:00
@./scripts/theme-showcase-gen
2022-06-14 18:35:47 -05:00
2023-01-20 11:24:52 -06:00
docs-diff:
2022-06-25 18:34:56 -05:00
@./scripts/rich-diff > docs/rich-diff.md
2023-01-20 11:24:52 -06:00
docs-svg:
2022-06-25 18:34:56 -05:00
@lolcat -F .5 -S 9 -f assets/logo.txt | yartsu -o assets/logo.svg
@yartsu -o assets/help.svg -t "yartsu --help" -- yartsu -h
2022-06-14 18:35:47 -05:00
2023-01-20 11:24:52 -06:00
docs-demo:
2022-06-25 18:34:56 -05:00
@python -c \
2022-06-15 02:11:32 -05:00
"from rich.console import Console; \
console = Console(force_terminal=True); \
console.print('\n:snake: [b i]Emoji\'s!'); \
console.print(' [cyan]Nerd Fonts!');" | \
yartsu -w 25 -o assets/demo.svg
2023-01-20 11:24:52 -06:00
clean: ## cleanup build and loose files
2022-06-25 18:34:56 -05:00
@rm -rf build dist capture.svg
# conditionals
check-tag:
@[ "${TAG}" ] || ( echo ">> TAG is not set"; exit 1 )
@git describe HEAD --tags --exact-match
check-version:
@if [[ "${VERSION}" == *"+"* ]]; then \
echo ">> VERSION is dev"; \
echo ">> $(VERSION)"; \
exit 1; \
fi
2023-04-26 17:26:31 -05:00
-include .task.cfg.mk