[parser] Makefile nonsense
Includes are now explicit so they can be extracted into dependencies for the makefile.
This commit is contained in:
parent
385c378edb
commit
6692d12d36
4 changed files with 59 additions and 0 deletions
12
lrparser.mk
Normal file
12
lrparser.mk
Normal file
|
|
@ -0,0 +1,12 @@
|
||||||
|
# This file generated by makedep.py
|
||||||
|
VERSION=0.7.9
|
||||||
|
PYTHON_SOURCES=\
|
||||||
|
parser/tree_sitter.py \
|
||||||
|
parser/runtime.py \
|
||||||
|
parser/generated_source.py \
|
||||||
|
parser/parser.py \
|
||||||
|
parser/emacs.py \
|
||||||
|
parser/wadler/runtime.py \
|
||||||
|
parser/wadler/builder.py \
|
||||||
|
parser/wadler/__init__.py \
|
||||||
|
parser/__init__.py
|
||||||
16
makedep.py
Normal file
16
makedep.py
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
import tomllib
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
with open("pyproject.toml", "rb") as f:
|
||||||
|
result = tomllib.load(f)
|
||||||
|
version = result["project"]["version"]
|
||||||
|
includes = result["tool"]["pdm"]["build"]["includes"]
|
||||||
|
with open("lrparser.mk", "w", encoding="utf-8") as f:
|
||||||
|
f.write("# This file generated by makedep.py\n")
|
||||||
|
f.write(f"VERSION={version}\n")
|
||||||
|
f.write(f"PYTHON_SOURCES=\\\n\t{' \\\n\t'.join(includes)}\n")
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
main()
|
||||||
18
makefile
18
makefile
|
|
@ -5,3 +5,21 @@
|
||||||
test:
|
test:
|
||||||
python3 ./parser/parser.py
|
python3 ./parser/parser.py
|
||||||
pdm run python3 -m pytest
|
pdm run python3 -m pytest
|
||||||
|
|
||||||
|
.PHONY: dep
|
||||||
|
dep: lrparser.mk
|
||||||
|
|
||||||
|
lrparser.mk: makedep.py pyproject.toml
|
||||||
|
python3 makedep.py
|
||||||
|
|
||||||
|
include lrparser.mk
|
||||||
|
|
||||||
|
.PHONY: wheel
|
||||||
|
wheel: dist/lrparsers-$(VERSION)-py3-none-any.whl
|
||||||
|
|
||||||
|
dist/lrparsers-$(VERSION).tar.gz dist/lrparsers-$(VERSION)-py3-none-any.whl: pyproject.toml $(PYTHON_SOURCES)
|
||||||
|
pdm build
|
||||||
|
|
||||||
|
.PHONY: clean
|
||||||
|
clean:
|
||||||
|
rm -rf ./dist
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,19 @@ dev = [
|
||||||
"hypothesis>=6.111.1",
|
"hypothesis>=6.111.1",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[tool.pdm.build]
|
||||||
|
includes = [
|
||||||
|
"parser/tree_sitter.py",
|
||||||
|
"parser/runtime.py",
|
||||||
|
"parser/generated_source.py",
|
||||||
|
"parser/parser.py",
|
||||||
|
"parser/emacs.py",
|
||||||
|
"parser/wadler/runtime.py",
|
||||||
|
"parser/wadler/builder.py",
|
||||||
|
"parser/wadler/__init__.py",
|
||||||
|
"parser/__init__.py",
|
||||||
|
]
|
||||||
|
|
||||||
[tool.pyright]
|
[tool.pyright]
|
||||||
exclude = ["historical", ".venv"]
|
exclude = ["historical", ".venv"]
|
||||||
venvPath = "."
|
venvPath = "."
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue