blob: d686297583cbbffb8d848e3c4e425e097af50d82 (
plain)
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
|
# Makefile for refcat.
# use .env if present, https://lithic.tech/blog/2020-05/makefile-dot-env
ifneq (,$(wildcard ./.env))
include .env
export
endif
SHELL := /bin/bash
PY_FILES := $(shell find . -name \*.py -print)
PKGNAME := refcat
# A class for which we should render an image.
TOP_CLASS := BrefCombined
# The "zipapp" we build, cf. PEP441, https://www.python.org/dev/peps/pep-0441/,
# https://shiv.readthedocs.io/
ZIPAPP := $(PKGNAME).pyz
# IMPORTANT: Python version on dev (e.g. use https://github.com/pyenv/pyenv)
# and target *must match* (up to minor version) e.g. for aitio (2021), you
# might want to use:
# make refcat.pyz PYTHON_INTERPRETER='"/usr/bin/env python3.8"'
PYTHON_INTERPRETER := "/usr/bin/env python3.8"
$(ZIPAPP): $(PY_FILES)
# https://shiv.readthedocs.io/en/latest/cli-reference.html
# note: use SHIV_ROOT envvar to override expansion dir (e.g. if home is networked)
shiv --reproducible --compressed --entry-point refcat.cli:main --python $(PYTHON_INTERPRETER) --output-file $(ZIPAPP) .
notes/deps.png: $(ZIPAPP)
./refcat.pyz dot $(TOP_CLASS) | dot -Tpng > notes/deps.png
.PHONY: deploy
deploy: $(ZIPAPP)
ifndef DEPLOY_TARGET
$(error DEPLOY_TARGET is not set)
else
rsync -avP $^ ${DEPLOY_TARGET}
endif
# .PHONY: test
# test:
# pytest -v tests
.PHONY: fmt
fmt:
yapf -p -i -r $(PKGNAME) tests
isort $(PKGNAME)
.PHONY: clean
clean:
rm -rf .pytest_cache/
rm -rf build/
rm -rf dist/
rm -rf $(PKGNAME).egg-info/
rm -rf $(ZIPAPP)
find . -name "__pycache__" -exec rm -rf "{}" +
|