better Makefile and build script

This commit is contained in:
Maximilian Keßler 2021-10-06 23:21:01 +02:00
parent c18b4ad0e4
commit 13c7d3bc21
3 changed files with 19 additions and 2 deletions

2
.gitignore vendored
View file

@ -1,2 +1,4 @@
*.swp *.swp
build/* build/*
.gitconfiglock
.initsubmodulelock

View file

@ -1,4 +1,18 @@
.PHONY: build .PHONY: build
build: build: .initsubmodulelock
python3 build.py @python3 build.py
init: .initsubmodulelock .gitconfiglock
.initsubmodulelock:
@git submodule update --init
@touch .initsubmodulelock
.gitconfiglock:
@echo "[Make config] Setting git configs to prevent wrong pushes"
@git config push.recurseSubmodules check
@git config status.submodulesummary 1
@echo "[Push annotated tags by default]"
@git config push.followTags true
@touch .gitconfiglock

View file

@ -10,6 +10,7 @@ def build(build_dir: str):
output = input_root / build_dir output = input_root / build_dir
for file in input_root.rglob('*.pysty'): for file in input_root.rglob('*.pysty'):
formatter = PackageFormatter(package_name=file.with_suffix('').name) formatter = PackageFormatter(package_name=file.with_suffix('').name)
print('[PyTeX] Writing file {}'.format(formatter.file_name))
make_default_commands(formatter) make_default_commands(formatter)
formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root))) formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root)))