Improve build

This commit is contained in:
2026-02-19 18:07:27 +01:00
parent 165dedfe30
commit c4c0266fd8
5 changed files with 16 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ import os
from typing import List
import labels
import datetime
import sys
version = "1.0.1"
@@ -17,6 +18,12 @@ print("""
""")
build_sty = False
try:
build_sty = sys.argv.index("sty") > -1
except:
pass
def load_all_files_of_array(dirname: str, files: List[str]):
data = ""
@@ -28,7 +35,8 @@ def load_all_files_of_array(dirname: str, files: List[str]):
output = load_all_files_of_array("../src/", ["header.sty"])
output += f"\\ProvidesPackage{{janishutz-helpers}}[{datetime.datetime.now().date().isoformat()} v{version}]\n\n"
if build_sty:
output += f"\\ProvidesPackage{{janishutz-helpers}}[{datetime.datetime.now().date().isoformat()} v{version}]\n\n"
output += load_all_files_of_array("../src/", ["core.sty"])
output += load_all_files_of_array("../src/config/", os.listdir("../src/config/"))
output += load_all_files_of_array("../src/", ["style.sty"])
@@ -41,11 +49,13 @@ output += l[1]
output += "\\endinput"
with open("../janishutz-helpers.tex", "w") as file:
file.write(output)
with open("../janishutz-helpers.sty", "w") as file:
file.write(output)
if not build_sty:
with open("../janishutz-helpers.tex", "w") as file:
file.write(output)
else:
with open("../janishutz-helpers.sty", "w") as file:
file.write(output)
print("==> Built successfully. Output to project-root/janishutz-helpers.tex\n")