-
-
Notifications
You must be signed in to change notification settings - Fork 77
/
Makefile
101 lines (73 loc) · 2.15 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
SYMBOLIC_PYTHON := python3
all: check test
.PHONY: all
check: style lint
.PHONY: check
clean:
cargo clean
rm -rf .venv
.PHONY: clean
# Builds
build:
@cargo +stable build --all --all-features
.PHONY: build
sdist: .venv/bin/python
cd py && ../.venv/bin/python setup.py sdist --format=zip
.PHONY: sdist
wheel: .venv/bin/python
cd py && ../.venv/bin/pip install -U wheel && ../.venv/bin/python setup.py bdist_wheel $(PLATFORM:%=-p %)
.PHONY: wheel
wheel-manylinux:
docker run --rm -v $(CURDIR):/work -w /work/py $(IMAGE) sh manylinux.sh
.PHONY: wheel-manylinux
wheel-manylinux-aarch64:
docker run --rm -v $(CURDIR):/work -w /work/py $(IMAGE) sh manylinux_aarch64.sh
.PHONY: wheel-manylinux-aarch64
# Tests
test: test-rust test-python
.PHONY: test
test-rust:
cargo test --workspace --all-features
.PHONY: test-rust
test-python: .venv/bin/python
.venv/bin/pip install -U "pytest>=5.0.0,<6.0.0"
.venv/bin/pip install -v --editable py
.venv/bin/pytest -v py
.PHONY: test-python
# Style checking
style: style-rust style-python
.PHONY: style
style-rust:
@rustup component add rustfmt --toolchain stable 2> /dev/null
cargo +stable fmt --all -- --check
.PHONY: style-rust
style-python: .venv/bin/python
.venv/bin/pip install -U black==22.3.0
.venv/bin/black --check py --exclude 'symbolic/_lowlevel*|dist|build|\.eggs'
# Linting
lint: lint-rust lint-python
.PHONY: lint
lint-rust:
@rustup component add clippy --toolchain stable 2> /dev/null
cargo +stable clippy --all-features --workspace --tests --examples -- -D clippy::all
.PHONY: lint-rust
lint-python: .venv/bin/python
.venv/bin/pip install -U flake8==6.0.0 mypy==1.4.0 pytest types-setuptools
cd py && ../.venv/bin/flake8 .
cd py && ../.venv/bin/mypy .
.PHONY: lint-python
# Formatting
format: format-rust format-python
.PHONY: format
format-rust:
@rustup component add rustfmt --toolchain stable 2> /dev/null
cargo +stable fmt --all
.PHONY: format-rust
format-python: .venv/bin/python
.venv/bin/pip install -U black==22.3.0
.venv/bin/black py --exclude 'symbolic/_lowlevel*|dist|build|\.eggs'
.PHONY: format-python
# Dependencies
.venv/bin/python: Makefile
@rm -rf .venv
$(SYMBOLIC_PYTHON) -m venv .venv