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 from typing import List
import labels import labels
import datetime import datetime
import sys
version = "1.0.1" 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]): def load_all_files_of_array(dirname: str, files: List[str]):
data = "" 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 = 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/", ["core.sty"])
output += load_all_files_of_array("../src/config/", os.listdir("../src/config/")) output += load_all_files_of_array("../src/config/", os.listdir("../src/config/"))
output += load_all_files_of_array("../src/", ["style.sty"]) output += load_all_files_of_array("../src/", ["style.sty"])
@@ -41,11 +49,13 @@ output += l[1]
output += "\\endinput" output += "\\endinput"
with open("../janishutz-helpers.tex", "w") as file:
file.write(output)
with open("../janishutz-helpers.sty", "w") as file: if not build_sty:
file.write(output) 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") print("==> Built successfully. Output to project-root/janishutz-helpers.tex\n")

View File

@@ -1,7 +1,7 @@
#!/bin/sh #!/bin/sh
cd build/ cd build/
python build.py python build.py sty
cd .. cd ..
loc="l" loc="l"

View File

@@ -496,7 +496,6 @@
% Set up the latex document, configure author, title (as first argument), as well as headers and footers % Set up the latex document, configure author, title (as first argument), as well as headers and footers
\newcommand{\setup}[1]{ \newcommand{\setup}[1]{
\typeout{[Setup] Setting up...} \typeout{[Setup] Setting up...}
\loadLang
\RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry} \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}
@@ -520,7 +519,6 @@
% Set up the latex document, only configuring the author, title and page size % Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{ \newcommand{\setupBarebones}[1]{
\loadLang
\RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry} \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}
@@ -530,7 +528,6 @@
% TODO: Use landscape and columns for new version % TODO: Use landscape and columns for new version
% Set up the latex document for exam summaries (Extra wide body, small margins, no header) % Set up the latex document for exam summaries (Extra wide body, small margins, no header)
\newcommand{\setupCheatSheet}[1]{ \newcommand{\setupCheatSheet}[1]{
\loadLang
\RequirePackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry} \RequirePackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}

View File

@@ -12,8 +12,6 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{janishutz-helpers}[2026-02-19 v1.0.1]
% Package imports % Package imports
\RequirePackage[table, dvipsnames]{xcolor} \RequirePackage[table, dvipsnames]{xcolor}
\RequirePackage{amsmath} \RequirePackage{amsmath}
@@ -496,7 +494,6 @@
% Set up the latex document, configure author, title (as first argument), as well as headers and footers % Set up the latex document, configure author, title (as first argument), as well as headers and footers
\newcommand{\setup}[1]{ \newcommand{\setup}[1]{
\typeout{[Setup] Setting up...} \typeout{[Setup] Setting up...}
\loadLang
\RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry} \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}
@@ -520,7 +517,6 @@
% Set up the latex document, only configuring the author, title and page size % Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{ \newcommand{\setupBarebones}[1]{
\loadLang
\RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry} \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}
@@ -530,7 +526,6 @@
% TODO: Use landscape and columns for new version % TODO: Use landscape and columns for new version
% Set up the latex document for exam summaries (Extra wide body, small margins, no header) % Set up the latex document for exam summaries (Extra wide body, small margins, no header)
\newcommand{\setupCheatSheet}[1]{ \newcommand{\setupCheatSheet}[1]{
\loadLang
\RequirePackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry} \RequirePackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}

View File

@@ -4,7 +4,6 @@
% Set up the latex document, configure author, title (as first argument), as well as headers and footers % Set up the latex document, configure author, title (as first argument), as well as headers and footers
\newcommand{\setup}[1]{ \newcommand{\setup}[1]{
\typeout{[Setup] Setting up...} \typeout{[Setup] Setting up...}
\loadLang
\RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry} \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}
@@ -28,7 +27,6 @@
% Set up the latex document, only configuring the author, title and page size % Set up the latex document, only configuring the author, title and page size
\newcommand{\setupBarebones}[1]{ \newcommand{\setupBarebones}[1]{
\loadLang
\RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry} \RequirePackage[a4paper,textwidth=17.5cm,textheight=25cm,includehead]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}
@@ -38,7 +36,6 @@
% TODO: Use landscape and columns for new version % TODO: Use landscape and columns for new version
% Set up the latex document for exam summaries (Extra wide body, small margins, no header) % Set up the latex document for exam summaries (Extra wide body, small margins, no header)
\newcommand{\setupCheatSheet}[1]{ \newcommand{\setupCheatSheet}[1]{
\loadLang
\RequirePackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry} \RequirePackage[a4paper,textwidth=20cm,textheight=28.5cm]{geometry}
\title{\Huge \textbf{#1}} \title{\Huge \textbf{#1}}
\author{\authorTitle} \author{\authorTitle}