-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathMakefile
86 lines (69 loc) · 2.52 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
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
77
78
79
80
81
82
83
84
85
86
PYTHON=python3
PYTHON_VENV=env
PYTHON_PACKAGING_VENV=$(PYTHON_VENV)-packaging
PYTHON_TESTING_ENV=$(PYTHON_VENV)-qa
INTERFACE=can0
LSS_ADDRESS_CACHE_FILE=lss-address-cache.json
$(PYTHON_VENV)/.created: pyproject.toml
rm -rf $(PYTHON_VENV) && \
$(PYTHON) -m venv $(PYTHON_VENV) && \
. $(PYTHON_VENV)/bin/activate && \
python3 -m pip install -e .[full] && \
date > $(PYTHON_VENV)/.created
.PHONY: env clean server
env: $(PYTHON_VENV)/.created
clean:
rm -rf $(PYTHON_VENV)
rm -rf $(PYTHON_PACKAGING_VENV)
rm -rf $(PYTHON_TESTING_ENV)
# Note that there is no check if any of the source files has changed,
# so you will have to manually run make clean to test any changes you
# have made.
server: env
. $(PYTHON_VENV)/bin/activate && \
lxa-iobus-server \
$(INTERFACE) \
--lss-address-cache-file=$(LSS_ADDRESS_CACHE_FILE) \
$(args)
# packaging environment #######################################################
$(PYTHON_PACKAGING_VENV)/.created:
rm -rf $(PYTHON_PACKAGING_VENV) && \
$(PYTHON) -m venv $(PYTHON_PACKAGING_VENV) && \
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
python3 -m pip install --upgrade pip && \
python3 -m pip install build && \
date > $(PYTHON_PACKAGING_VENV)/.created
.PHONY: packaging-env build
packaging-env: $(PYTHON_PACKAGING_VENV)/.created
build: packaging-env
. $(PYTHON_PACKAGING_VENV)/bin/activate && \
rm -rf dist *.egg-info && \
python3 -m build
# testing #####################################################################
$(PYTHON_TESTING_ENV)/.created:
rm -rf $(PYTHON_TESTING_ENV) && \
$(PYTHON) -m venv $(PYTHON_TESTING_ENV) && \
. $(PYTHON_TESTING_ENV)/bin/activate && \
python3 -m pip install pip --upgrade && \
python3 -m pip install ruff codespell && \
date > $(PYTHON_TESTING_ENV)/.created
node_modules/.created:
rm -rf node_modules && \
npm install -D prettier prettier-plugin-toml && \
date > node_modules/.created
.PHONY: qa qa-codespell qa-ruff qa-ruff-fix qa-prettier
qa: qa-codespell qa-ruff qa-prettier
qa-codespell: $(PYTHON_TESTING_ENV)/.created
. $(PYTHON_TESTING_ENV)/bin/activate && \
codespell
qa-ruff: $(PYTHON_TESTING_ENV)/.created
. $(PYTHON_TESTING_ENV)/bin/activate && \
ruff format --check --diff && ruff check
qa-ruff-fix: $(PYTHON_TESTING_ENV)/.created
. $(PYTHON_TESTING_ENV)/bin/activate && \
ruff format && ruff check --fix
qa-prettier: node_modules/.created
npx prettier --check pyproject.toml
npx prettier --check lxa_iobus/server/static/index.html
npx prettier --check lxa_iobus/server/static/main.js
npx prettier --check lxa_iobus/server/static/style.css