~dricottone/gap

572a6188a2634b95e380126bcce0a3c785b36874 — Dominic Ricottone 2 years ago d68765b v1.0.2
Toolchain updates to accompany migration away from setup.py
2 files changed, 33 insertions(+), 19 deletions(-)

M .gitignore
M Makefile
M .gitignore => .gitignore +2 -1
@@ 3,6 3,7 @@
**/*.pyc
tests/generated_syntax/*
build
dist

# `make build` deletes these but the files can persist if it hits an error
*.egg-info


M Makefile => Makefile +31 -18
@@ 1,12 1,21 @@
PY_COMPILE_BIN=python -m py_compile

unittest = unittest --color
#unittest = python -m unittest
unittest_discover = unittest --color --working-directory .
#unittest_discover = python -m unittest discover tests --top-level-directory . --start-directory
python = python3
#BUILD_BIN=python -m build
BUILD_BIN=pyproject-build

#UNITTEST_BIN=python -m unittest
UNITTEST_BIN=unittest --color

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

#PIPX_BIN=python -m pipx
PIPX_BIN=pipx

.PHONY: clean bootstrap test build unittest reinstall install uninstall

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

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


@@ 14,24 23,28 @@ bootstrap:
test:
	mkdir -p tests/generated_syntax
	touch tests/__init__.py tests/generated_syntax/__init__.py
	$(python) -m py_compile gap/*.py
	$(unittest_discover) tests
	$(python) -m py_compile tests/generated_syntax/*.py
	$(unittest) tests/generated_syntax_tests.py
	MYPY_CACHE_DIR=gap/__mypycache__ mypy -p gap

build:
	$(python) setup.py sdist bdist_wheel
	$(PY_COMPILE_BIN) gap/*.py
	$(UNITTEST_BIN) --working-directory . tests
	$(PY_COMPILE_BIN) tests/generated_syntax/*.py
	$(UNITTEST_BIN) tests/generated_syntax_tests.py
	$(MYPY_BIN) -p gap

# more verbose than `make test`, skips `py_compile` and `mypy`
unittest:
	$(unittest_discover) tests --verbose
	$(unittest) tests/generated_syntax_tests.py --verbose
	mkdir -p tests/generated_syntax
	touch tests/__init__.py tests/generated_syntax/__init__.py
	$(UNITTEST_BIN) --working-directory . tests --verbose
	$(UNITTEST_BIN) tests/generated_syntax_tests.py --verbose

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

reinstall: uninstall install

install:
	pipx install .
	$(PIPX_BIN) install build/gap-1.0.2-py3-none-any.whl

uninstall:
	pipx uninstall gap
	$(PIPX_BIN) uninstall gap