latex-packages/build.py

19 lines
662 B
Python
Raw Normal View History

2021-10-06 23:10:06 +02:00
from pathlib import *
import sys
sys.path.insert(0, 'PyTeX/')
from package_formatter import PackageFormatter
from replacements import make_default_commands
def build(build_dir: str):
2021-10-06 23:10:25 +02:00
input_root = Path('./packages').resolve()
2021-10-06 23:10:06 +02:00
output = input_root / build_dir
for file in input_root.rglob('*.pysty'):
formatter = PackageFormatter(package_name=file.with_suffix('').name)
2021-10-06 23:21:01 +02:00
print('[PyTeX] Writing file {}'.format(formatter.file_name))
2021-10-06 23:10:06 +02:00
make_default_commands(formatter)
2021-10-06 23:10:25 +02:00
formatter.format_package(file, Path('./').resolve() / build_dir / str(file.parent.relative_to(input_root)))
2021-10-06 23:10:06 +02:00
if __name__ == "__main__":
build('build')