~dricottone/gap

ref: 029dc0cebe4fe61dc7190ea8613713fad69a5139 gap/Makefile -rw-r--r-- 1.8 KiB
029dc0ceDominic Ricottone Updating TOML parsing for Python 3.11 2 years ago
                                                                                
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
VERSION=1.0.3

PY_COMPILE_BIN=python -m py_compile

#BUILD_BIN=python -m build
BUILD_BIN=pyproject-build

#UNITTEST_FILE_BIN=python -m unittest
#UNITTEST_DIR_BIN=python -m unittest discover --top-level-directory .
UNITTEST_FILE_BIN=unittest --color
UNITTEST_DIR_BIN=unittest --color --working-directory .

#MYPY_BIN=python -m mypy
MYPY_BIN=MYPY_CACHE_DIR=gap/__mypycache__ mypy

#PIPX_BIN=python -m pipx
PIPX_BIN=pipx

.PHONY: clean
clean:
	rm -rf **/__pycache__ **/__mypycache__ **/*.pyc build *.egg-info

gap/cli.py: gap/bootstrap.py
	./gap/bootstrap.py > gap/cli.py

tests/__init__.py:
	touch tests/__init__.py

tests/generated_syntax:
	mkdir -p tests/generated_syntax

tests/generated_syntax/__init__.py: tests/generated_syntax
	touch tests/__init__.py

TEST_FILES=tests/__init__.py tests/generated_syntax tests/generated_syntax/__init__.py

.PHONY: test
test: $(TEST_FILES)
	$(PY_COMPILE_BIN) gap/*.py
	$(UNITTEST_DIR_BIN) tests
	$(PY_COMPILE_BIN) tests/generated_syntax/*.py
	$(UNITTEST_FILE_BIN) tests/generated_syntax_tests.py
	$(MYPY_BIN) -p gap

.PHONY: unittest
# more verbose than `make test`, skips `py_compile` and `mypy`
unittest: $(TEST_FILES)
	$(UNITTEST_DIR_BIN) tests --verbose
	$(UNITTEST_FILE_BIN) tests/generated_syntax_tests.py --verbose

PY_FILES=gap/cli.py gap/generator.py gap/__main__.py gap/toml_parser.py

build/gap-$(VERSION)-py3-none-any.whl: build

.PHONY:
build: $(PY_FILES)
	mkdir -p build
	$(BUILD_BIN) --wheel --no-isolation --outdir build/

.PHONY: reinstall
reinstall: uninstall install

.PHONY: install
install: build/gap-$(VERSION)-py3-none-any.whl
	$(PIPX_BIN) install build/gap-$(VERSION)-py3-none-any.whl

.PHONY: uninstall
uninstall:
	$(PIPX_BIN) uninstall gap

.PHONY: rc
rc:
	docker run --interactive --tty --rm --name pytest --mount type=bind,src=$(pwd),dst=/code python:3.11-rc sh