This repository has been archived by the owner on Jun 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 437
/
Copy pathMakefile
50 lines (40 loc) · 1.46 KB
/
Makefile
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
.PHONY: usage tests venv_dev xresources build deploy_test deploy_prod examples
VENV_PATH=.venv
VENV_ACTIVATE=. $(VENV_PATH)/bin/activate
EXAMPLES_DIR=examples
CASTS_DIR=$(EXAMPLES_DIR)/casts
.DEFAULT: usage
usage:
@echo "Usage:"
@echo " make build # Build source distribution archives"
@echo " make deploy_prod # Upload source distribution archives to pypi.org"
@echo " make deploy_test # Upload source distribution archives to test.pypi.org"
@echo " make examples # Render example SVG animations"
@echo " make tests # Run unit tests"
build: tests
$(VENV_ACTIVATE) && \
rm -rf dist && \
python setup.py sdist bdist_wheel
deploy_test: build
$(VENV_ACTIVATE) && \
twine upload -r pypitest dist/*
deploy_prod: build
$(VENV_ACTIVATE) && \
twine upload -r pypi dist/*
tests: venv_dev
$(VENV_ACTIVATE) && \
pip freeze && \
coverage run --branch --source termtosvg -m unittest -v && \
coverage report && \
coverage html
venv_dev: setup.py
(test -d $(VENV_PATH) || python -m venv $(VENV_PATH))
$(VENV_ACTIVATE) && \
pip install -U -e .[dev]
examples:
(test -d $(VENV_PATH) || python -m venv $(VENV_PATH))
$(VENV_ACTIVATE) && \
for cast_file in $$(find $(CASTS_DIR) -name '*.cast'); do \
svg_file="$(EXAMPLES_DIR)/$$(basename --suffix=.cast $$cast_file).svg" && \
termtosvg render "$$cast_file" "$$svg_file" --font 'DejaVu Sans Mono' --theme solarized-dark; \
done