From f609be21528800fc2199f020e5dd214ca27620e6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Thu, 21 Oct 2021 10:03:21 +0200
Subject: [PATCH 01/56] begin working on travis build script

---
 travis_build.sh | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
 create mode 100755 travis_build.sh

diff --git a/travis_build.sh b/travis_build.sh
new file mode 100755
index 0000000..225c0e2
--- /dev/null
+++ b/travis_build.sh
@@ -0,0 +1,19 @@
+# ! /bin/sh
+TRAVIS_BRANCH=algebraic-geometr
+
+rm -rf LatexPackagesBuild
+
+git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git LatexPackagesBuild
+cd LatexPackagesBuild
+FOUND=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${TRAVIS_BRANCH}$/p")
+
+echo ${FOUND}
+
+if [ "$FOUND" = "" ];then
+    git checkout --orphan ${TRAVIS_BRANCH}-build
+    ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r git rm --cached
+    ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r rm -rf
+else
+    echo "found"
+    git checkout -b ${FOUND}-build origin/${FOUND}-build
+fi

From 90cd2b92009d64538b1b31a8b45d6fa5d2aae114 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Thu, 21 Oct 2021 10:03:35 +0200
Subject: [PATCH 02/56] outline build info json

---
 build_scripts/build/build.py | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)

diff --git a/build_scripts/build/build.py b/build_scripts/build/build.py
index 812a3c3..88415b1 100644
--- a/build_scripts/build/build.py
+++ b/build_scripts/build/build.py
@@ -63,5 +63,28 @@ def build(src_dir: Path, build_dir: Path, check_existence: bool = True):
         print('[PyTeX] Writing class file {}'.format(formatter.file_name))
         formatter.make_default_macros()
         formatter.format_file(input_path=file, output_dir=output_dir)
+    build_info = {
+        'build_time': '',
+        'packages': {
+            'built': '',
+            'skipped': ''
+        },
+        'classes': {
+          'built': '',
+          'skipped': ''
+        },
+        'LatexPackages': {
+            'version': '',
+            'branch': '',
+            'commit': '',
+            'dirty': ''
+        },
+        'PyTeX': {
+            'version': '',
+            'branch': '',
+            'commit': '',
+            'dirty': ''
+        }
+    }
     print(f'[PyTeX] Successfully built {num_packages} packages (skipped {num_skipped_packages}) '
           f'and {num_classes} classes (skipped {num_skipped_classes}) in {build_dir}/')

From 0bde1c9cc5e57f2c8f200e80c2314a8321c1dee6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 09:57:35 +0200
Subject: [PATCH 03/56] start reworking of build scripts

---
 build.py                                 | 108 +++++++++++++++--
 build_scripts/build/build.py             | 141 ++++++++++++++---------
 build_scripts/build/build_information.py |  58 +++++++++-
 build_scripts/build/config.py            |   4 +
 build_scripts/git_hook/recent.py         |  28 ++++-
 build_scripts/utils/__init__.py          |   0
 6 files changed, 265 insertions(+), 74 deletions(-)
 mode change 100644 => 100755 build.py
 create mode 100644 build_scripts/utils/__init__.py

diff --git a/build.py b/build.py
old mode 100644
new mode 100755
index 256263a..3b88776
--- a/build.py
+++ b/build.py
@@ -1,15 +1,101 @@
-import sys
-from pathlib import Path
+#! /usr/bin/python3
+import argparse
+import pathlib
 
 from build_scripts.build import build
+from build_scripts.build.config import FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPEND_AUTHOR
+
+
+def main():
+    parser = argparse.ArgumentParser(description='Incrementally build LatexPackages with PyTeX')
+    input_group = parser.add_mutually_exclusive_group(required=True)
+    output_group = parser.add_mutually_exclusive_group()
+    input_group.add_argument(
+        '-s', '--source-dir',
+        metavar='SRC_DIR',
+        help='Relative or absolute path to source directory of .pysty or .pycls files',
+        type=pathlib.Path,
+        nargs='?',
+        default='./src',
+        dest='src_dir'
+    )
+    output_group.add_argument(
+        '-b', '--build-dir',
+        metavar='BUILD_DIR',
+        help='Relativ or absolute path to output directory for processed packages and classes',
+        type=pathlib.Path,
+        nargs='?',
+        default='./build',
+        dest='build_dir'
+    )
+    parser.add_argument(
+        '-r', '--recursive',
+        help='Recursively search subdirectories for files. Default: false',
+        action='store_true',
+        dest='recursive'
+    )
+    input_group.add_argument(
+        '-i', '--input-file',
+        metavar='FILE',
+        help='Filename to be built. Can be in valid .pysty or .pycls format',
+        type=pathlib.Path,
+        dest='input_file'
+    )
+    output_group.add_argument(
+        '-n', '--name',
+        help='Name of the package / class to be formatted.',
+        type=str,
+        choices=[FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPEND_AUTHOR],
+        default=FILENAME_TYPE_PREPEND_AUTHOR,
+        dest='latex_name'
+    )
+    parser.add_argument(
+        '-g', '--git-version',
+        help='Insert git version information into build. This assumes your input'
+             'files are located in a git repository. Default: false',
+        action='store_true',
+        dest='use_git'
+    )
+    parser.add_argument(
+        '-d', '--allow-dirty',
+        help='If git flag is set, allow building of a dirty repo. Default: false',
+        action='store_true',
+        dest='allow_dirty'
+    )
+    parser.add_argument(
+        '-p',
+        '--pytex-version',
+        help='Write PyTeX version information into built LaTeX files',
+        action='store_true',
+        dest='include_pytex_version'
+    )
+    parser.add_argument(
+        '-t', '--build-time',
+        help='Insert build time into built LaTeX files',
+        action='store_true',
+        dest='include_timestamp'
+    )
+    parser.add_argument(
+        '-l', '--license',
+        help='Insert MIT license into package header',
+        action='store_true',
+        dest='include_license'
+    )
+    parser.add_argument(
+        '-a', '--author',
+        help='Set author of packages',
+        type=str,
+        dest='author'
+    )
+    parser.add_argument(
+        '-f', '--force',
+        help='Overwrite unknown existing files without confirmation',
+        action='store_true',
+        dest='overwrite_existing_files'
+    )
+    args = parser.parse_args()
+    build(**vars(args))
+
 
 if __name__ == "__main__":
-    check_existence = True
-    if len(sys.argv) == 2:
-        if sys.argv[1] == '--only-new':
-            check_existence = False
-    build(
-        src_dir=Path('./src').resolve(),
-        build_dir=Path('./build').resolve(),
-        check_existence=check_existence
-    )
+    main()
diff --git a/build_scripts/build/build.py b/build_scripts/build/build.py
index 88415b1..367842b 100644
--- a/build_scripts/build/build.py
+++ b/build_scripts/build/build.py
@@ -1,69 +1,99 @@
 from pathlib import Path
 import git
+from typing import Optional, Union, List
 
 import PyTeX
 
 from build_scripts.git_hook import get_latest_commit, is_recent
 
-from .build_information import build_information
+from .build_information import build_information, BuildInfo
 
 
-def build(src_dir: Path, build_dir: Path, check_existence: bool = True):
-    print('[PyTeX] Getting git repository information...')
-    extra_header, repo_description = build_information()
-    print('[PyTeX] Building version {version} of LatexPackages'.format(version=repo_description))
-    print('[PyTeX] Latest commit message: ' + get_latest_commit(git.Repo()).message.strip())
-    if git.Repo().is_dirty(untracked_files=True):
-        extra_header += ['WARNING: Local changes to git repository detected.',
-                         '         The build will not be reproducible (!)']
-    num_packages = 0
-    num_skipped_packages = 0
-    num_classes = 0
-    num_skipped_classes = 0
+def pytex_msg(msg: str):
+    print('[PyTeX] ' + msg)
 
-    for file in src_dir.rglob('*.pysty'):
-        output_dir = build_dir / str(file.parent.relative_to(src_dir))
-        if not is_recent(file, git.Repo()):
-            if not check_existence:
-                print('[PyTex] Skipping file {file} since it was not modified since last build'.format(file=file.name))
-                num_skipped_packages += 1
-                continue
-            else:
-                if (output_dir / ('mkessler-' + str(file.with_suffix('.sty').name))).exists():
-                    print('[PyTex] Skipping file {file} since it was not modified since '
-                          'last build and already exists'.format(file=file.name))
-                    num_skipped_packages += 1
-                    continue
 
-        num_packages += 1
-        formatter = PyTeX.PackageFormatter(
-            package_name=file.with_suffix('').name,
-            extra_header=extra_header)
-        print('[PyTeX] Writing file {}'.format(formatter.file_name))
+class TexFileToFormat:
+    def __init__(self, src_path: Path, build_dir: Path):
+        self.src_path = src_path
+        self.build_path = build_dir
+
+    def format(self):
+        if '.pysty' in self.src_path.name:
+            formatter = PyTeX.PackageFormatter(
+                package_name=self.src_path.with_suffix('').name,
+                extra_header=[])  # TODO: extra header
+        else:
+            formatter = PyTeX.ClassFormatter(
+                class_name=self.src_path.with_suffix('').name,
+                extra_header=[])  # TODO
+        pytex_msg('Writing file {}'.format(formatter.file_name))
         formatter.make_default_macros()
-        formatter.format_file(file, output_dir)
-    for file in src_dir.rglob('*.pycls'):
-        output_dir = build_dir / str(file.parent.relative_to(src_dir))
-        if not is_recent(file, git.Repo()):
-            if not check_existence:
-                print('[PyTex] Skipping file {file} since it was not modified since last build'.format(file=file.name))
-                num_skipped_classes += 1
-                continue
-            else:
-                if (output_dir / ('mkessler-' + str(file.with_suffix('.cls').name))).exists():
-                    print('[PyTex] Skipping file {file} since it was not modified since '
-                          'last build and already exists'.format(file=file.name))
-                    num_skipped_classes += 1
-                    continue
-        output_dir = build_dir / str(file.parent.relative_to(src_dir))
-        num_classes += 1
-        formatter = PyTeX.ClassFormatter(
-            class_name=file.with_suffix('').name,
-            extra_header=extra_header)
-        print('[PyTeX] Writing class file {}'.format(formatter.file_name))
-        formatter.make_default_macros()
-        formatter.format_file(input_path=file, output_dir=output_dir)
-    build_info = {
+        formatter.format_file(self.src_path, self.build_path)
+
+
+def build(
+        src_dir: Optional[Path] = None,
+        build_dir: Optional[Path] = None,
+        input_file: Optional[Path] = None,
+        author: Optional[str] = None,
+        latex_name: str = 'prepend-author',           # name handling
+        recursive: bool = False,                      # input control
+        include_timestamp: bool = False,              # header
+        include_pytex_version: bool = False,          # header
+        include_license: bool = False,                # header
+        include_git_version: bool = False,            # header
+        include_pytex_info_text: bool = False,        # header
+        use_git: bool = False,                        # versioning
+        allow_dirty: bool = False,                    # versioning
+        overwrite_existing_files: bool = False,       # output control
+        build_all: bool = False,                      # output control / versioning
+        write_build_information: bool = True,         # meta
+        ):
+    pytex_msg('Getting git repository information...')
+    current_build_info = BuildInfo(
+        include_timestamp=include_timestamp,
+        include_pytex_version=include_pytex_version,
+        include_license=include_license,
+        include_git_version=include_git_version,
+        include_pytex_info_text=include_pytex_info_text,
+        author=author,
+        pytex_repo=None,  # TODO
+        packages_repo=None  # TODO
+    )
+    old_build_info = {}  # TODO: read this in from file
+    # extra_header += ['WARNING: Local changes to git repository detected.',
+    #                     '         The build will not be reproducible (!)']
+
+    files = []
+    if input_file:
+        files.append(input_file)
+    if src_dir:
+        if recursive:
+            for file in src_dir.rglob('*.pysty'):
+                files.append(file)
+            for file in src_dir.rglob('*.pycls'):
+                files.append(file)
+        else:
+            for file in src_dir.glob('*.pysty'):
+                files.append(file)
+            for file in src_dir.glob('*.pycls'):
+                files.append(file)
+
+    input_dir = src_dir if src_dir else input_file.parent
+    output_dir = build_dir if build_dir else input_file.parent
+    sources_to_build = []
+    for file in files:
+        sources_to_build.append(
+            TexFileToFormat(
+                src_path=file,
+                build_dir=output_dir / file.parent.relative_to(input_dir)
+            ))
+
+    for source in sources_to_build:
+        source.format()
+
+    current_build_info = {
         'build_time': '',
         'packages': {
             'built': '',
@@ -86,5 +116,4 @@ def build(src_dir: Path, build_dir: Path, check_existence: bool = True):
             'dirty': ''
         }
     }
-    print(f'[PyTeX] Successfully built {num_packages} packages (skipped {num_skipped_packages}) '
-          f'and {num_classes} classes (skipped {num_skipped_classes}) in {build_dir}/')
+    pytex_msg('Build done')
diff --git a/build_scripts/build/build_information.py b/build_scripts/build/build_information.py
index 217c3d9..46bc486 100644
--- a/build_scripts/build/build_information.py
+++ b/build_scripts/build/build_information.py
@@ -1,9 +1,10 @@
 import git
 import datetime
+from typing import Optional
 
 from build_scripts.git_hook import git_describe, get_latest_commit
 
-from .config import BUILD_DETAILS
+from .config import BUILD_DETAILS, DATE_FORMAT
 
 
 def build_information():
@@ -18,3 +19,58 @@ def build_information():
         packages_version=repo_description,
         packages_commit_hash=get_latest_commit(repo).hexsha[0:7]
     ), BUILD_DETAILS)), repo_description
+
+
+class BuildInfo:
+    def __init__(
+            self,
+            include_timestamp: bool = False,
+            include_pytex_version: bool = False,
+            include_license: bool = False,
+            include_git_version: bool = False,
+            include_pytex_info_text: bool = False,
+            author: Optional[str] = None,
+            pytex_repo: Optional[git.Repo] = None,
+            packages_repo: Optional[git.Repo] = None):
+        self.author = author
+
+        self._pytex_repo = pytex_repo
+        self._packages_repo = packages_repo
+        self._pytex_repo_commit = None
+        self._packages_repo_commit = None
+        self._pytex_repo_version = None
+        self._packages_repo_version = None
+
+        self._header = None
+
+        self.get_repo_commits()
+        self.get_repo_version()
+
+        self.create_header(
+            include_timestamp=include_timestamp,
+            include_pytex_version=include_pytex_version,
+            include_license=include_license,
+            include_git_version=include_git_version,
+            include_pytex_info_text=include_pytex_info_text
+        )
+
+    def get_repo_commits(self):
+        if self._packages_repo:
+            self._packages_repo_commit = get_latest_commit(self._packages_repo)
+        if self._pytex_repo:
+            self._pytex_repo_commit = get_latest_commit(self._pytex_repo)
+
+    def get_repo_version(self):
+        if self._packages_repo_commit:
+            self._packages_repo_version = git_describe(self._packages_repo_commit)
+        if self._pytex_repo_commit:
+            self._pytex_repo_version = git_describe(self._pytex_repo_commit)
+
+    def create_header(
+            self,
+            include_timestamp: bool = False,
+            include_pytex_version: bool = False,
+            include_license: bool = False,
+            include_git_version: bool = False,
+            include_pytex_info_text: bool = False):
+        pass
diff --git a/build_scripts/build/config.py b/build_scripts/build/config.py
index c69f02c..a6d8ad0 100644
--- a/build_scripts/build/config.py
+++ b/build_scripts/build/config.py
@@ -4,3 +4,7 @@ BUILD_DETAILS = [
     "  PyTeX version: {pytex_version} (commit {pytex_commit_hash})",
     "  LatexPackages version: {packages_version} (commit {packages_commit_hash})"
 ]
+
+FILENAME_TYPE_PREPEND_AUTHOR = 'prepend-author'
+FILENAME_TYPE_RAW_NAME = 'raw'
+DATE_FORMAT = '%Y/%m/%d %H:%M'
diff --git a/build_scripts/git_hook/recent.py b/build_scripts/git_hook/recent.py
index acc7480..2c86345 100644
--- a/build_scripts/git_hook/recent.py
+++ b/build_scripts/git_hook/recent.py
@@ -1,14 +1,30 @@
+import git
+
 from .git_version import get_latest_commit
+from typing import Union, Optional, List
 
 
-def is_recent(file, repo):
+def is_recent(file, repo, compare: Optional[Union[git.Commit, List[git.Commit]]] = None) -> Optional[bool]:
     modified_files = [item.a_path for item in repo.index.diff(None)]
     if file in modified_files:
         return True
 
-    for parent in get_latest_commit(repo).parents:
-        newly_committed_files = [item.a_path for item in repo.index.diff(parent)]
-        if file in newly_committed_files:
-            return True
-    return False
+    newly_committed_files = []
+    if type(compare) == git.Commit:
+        newly_committed_files = [item.a_path for item in repo.index.diff(compare)]
+    elif type(compare) == list:
+        for commit in compare:
+            for item in repo.index.diff(commit):
+                newly_committed_files.append(item.a_path)
+    elif type is None:
+        for parent in get_latest_commit(repo).parents:
+            for item in repo.index.diff(parent):
+                newly_committed_files.append(item.a_path)
+    else:
+        print("Invalid argument type for compare")
+        return None
 
+    if file in newly_committed_files:
+        return True
+    else:
+        return False
diff --git a/build_scripts/utils/__init__.py b/build_scripts/utils/__init__.py
new file mode 100644
index 0000000..e69de29

From 75149559e350d723ac3f842ccd7341294ac1e16c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 09:57:47 +0200
Subject: [PATCH 04/56] travis build script: retrieve old builds from orgin

---
 travis_build.sh | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/travis_build.sh b/travis_build.sh
index 225c0e2..7f4fbed 100755
--- a/travis_build.sh
+++ b/travis_build.sh
@@ -1,19 +1,19 @@
 # ! /bin/sh
-TRAVIS_BRANCH=algebraic-geometr
+TRAVIS_BRANCH=algebraic-geometry
 
 rm -rf LatexPackagesBuild
 
 git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git LatexPackagesBuild
 cd LatexPackagesBuild
-FOUND=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${TRAVIS_BRANCH}$/p")
+REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${TRAVIS_BRANCH}$/p")
 
-echo ${FOUND}
+echo ${REMOTE_BRANCH}
 
-if [ "$FOUND" = "" ];then
+if [ "$REMOTE_BRANCH" = "" ];then
     git checkout --orphan ${TRAVIS_BRANCH}-build
     ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r git rm --cached
     ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r rm -rf
 else
     echo "found"
-    git checkout -b ${FOUND}-build origin/${FOUND}-build
+    git checkout -b ${REMOTE_BRANCH}-build origin/${REMOTE_BRANCH}-build
 fi

From b5160f18161507e38d96423c83d0468d45fc22ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 10:01:49 +0200
Subject: [PATCH 05/56] migrate build scripts into PyTeX submodule

---
 PyTeX                                    |   2 +-
 build.py                                 |   4 +-
 build_scripts/build/__init__.py          |   5 -
 build_scripts/build/build.py             | 119 -----------------------
 build_scripts/build/build_information.py |  76 ---------------
 build_scripts/build/config.py            |  10 --
 build_scripts/git_hook/__init__.py       |   9 --
 build_scripts/git_hook/git_version.py    |  53 ----------
 build_scripts/git_hook/recent.py         |  30 ------
 build_scripts/travis/deploy_message.py   |   2 +-
 build_scripts/utils/__init__.py          |   0
 11 files changed, 4 insertions(+), 306 deletions(-)
 delete mode 100644 build_scripts/build/__init__.py
 delete mode 100644 build_scripts/build/build.py
 delete mode 100644 build_scripts/build/build_information.py
 delete mode 100644 build_scripts/build/config.py
 delete mode 100644 build_scripts/git_hook/__init__.py
 delete mode 100644 build_scripts/git_hook/git_version.py
 delete mode 100644 build_scripts/git_hook/recent.py
 delete mode 100644 build_scripts/utils/__init__.py

diff --git a/PyTeX b/PyTeX
index 05f53a9..90acc2b 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit 05f53a917113648a81ab96f353800d64dd9e6ec9
+Subproject commit 90acc2baf7920d3c0f385ece3ab060d2a5060aab
diff --git a/build.py b/build.py
index 3b88776..4d1bbf2 100755
--- a/build.py
+++ b/build.py
@@ -2,8 +2,8 @@
 import argparse
 import pathlib
 
-from build_scripts.build import build
-from build_scripts.build.config import FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPEND_AUTHOR
+from PyTeX.build.build import build
+from PyTeX.build.build.config import FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPEND_AUTHOR
 
 
 def main():
diff --git a/build_scripts/build/__init__.py b/build_scripts/build/__init__.py
deleted file mode 100644
index 3b3e07b..0000000
--- a/build_scripts/build/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from .build import build
-
-__all__ = [
-    'build'
-]
diff --git a/build_scripts/build/build.py b/build_scripts/build/build.py
deleted file mode 100644
index 367842b..0000000
--- a/build_scripts/build/build.py
+++ /dev/null
@@ -1,119 +0,0 @@
-from pathlib import Path
-import git
-from typing import Optional, Union, List
-
-import PyTeX
-
-from build_scripts.git_hook import get_latest_commit, is_recent
-
-from .build_information import build_information, BuildInfo
-
-
-def pytex_msg(msg: str):
-    print('[PyTeX] ' + msg)
-
-
-class TexFileToFormat:
-    def __init__(self, src_path: Path, build_dir: Path):
-        self.src_path = src_path
-        self.build_path = build_dir
-
-    def format(self):
-        if '.pysty' in self.src_path.name:
-            formatter = PyTeX.PackageFormatter(
-                package_name=self.src_path.with_suffix('').name,
-                extra_header=[])  # TODO: extra header
-        else:
-            formatter = PyTeX.ClassFormatter(
-                class_name=self.src_path.with_suffix('').name,
-                extra_header=[])  # TODO
-        pytex_msg('Writing file {}'.format(formatter.file_name))
-        formatter.make_default_macros()
-        formatter.format_file(self.src_path, self.build_path)
-
-
-def build(
-        src_dir: Optional[Path] = None,
-        build_dir: Optional[Path] = None,
-        input_file: Optional[Path] = None,
-        author: Optional[str] = None,
-        latex_name: str = 'prepend-author',           # name handling
-        recursive: bool = False,                      # input control
-        include_timestamp: bool = False,              # header
-        include_pytex_version: bool = False,          # header
-        include_license: bool = False,                # header
-        include_git_version: bool = False,            # header
-        include_pytex_info_text: bool = False,        # header
-        use_git: bool = False,                        # versioning
-        allow_dirty: bool = False,                    # versioning
-        overwrite_existing_files: bool = False,       # output control
-        build_all: bool = False,                      # output control / versioning
-        write_build_information: bool = True,         # meta
-        ):
-    pytex_msg('Getting git repository information...')
-    current_build_info = BuildInfo(
-        include_timestamp=include_timestamp,
-        include_pytex_version=include_pytex_version,
-        include_license=include_license,
-        include_git_version=include_git_version,
-        include_pytex_info_text=include_pytex_info_text,
-        author=author,
-        pytex_repo=None,  # TODO
-        packages_repo=None  # TODO
-    )
-    old_build_info = {}  # TODO: read this in from file
-    # extra_header += ['WARNING: Local changes to git repository detected.',
-    #                     '         The build will not be reproducible (!)']
-
-    files = []
-    if input_file:
-        files.append(input_file)
-    if src_dir:
-        if recursive:
-            for file in src_dir.rglob('*.pysty'):
-                files.append(file)
-            for file in src_dir.rglob('*.pycls'):
-                files.append(file)
-        else:
-            for file in src_dir.glob('*.pysty'):
-                files.append(file)
-            for file in src_dir.glob('*.pycls'):
-                files.append(file)
-
-    input_dir = src_dir if src_dir else input_file.parent
-    output_dir = build_dir if build_dir else input_file.parent
-    sources_to_build = []
-    for file in files:
-        sources_to_build.append(
-            TexFileToFormat(
-                src_path=file,
-                build_dir=output_dir / file.parent.relative_to(input_dir)
-            ))
-
-    for source in sources_to_build:
-        source.format()
-
-    current_build_info = {
-        'build_time': '',
-        'packages': {
-            'built': '',
-            'skipped': ''
-        },
-        'classes': {
-          'built': '',
-          'skipped': ''
-        },
-        'LatexPackages': {
-            'version': '',
-            'branch': '',
-            'commit': '',
-            'dirty': ''
-        },
-        'PyTeX': {
-            'version': '',
-            'branch': '',
-            'commit': '',
-            'dirty': ''
-        }
-    }
-    pytex_msg('Build done')
diff --git a/build_scripts/build/build_information.py b/build_scripts/build/build_information.py
deleted file mode 100644
index 46bc486..0000000
--- a/build_scripts/build/build_information.py
+++ /dev/null
@@ -1,76 +0,0 @@
-import git
-import datetime
-from typing import Optional
-
-from build_scripts.git_hook import git_describe, get_latest_commit
-
-from .config import BUILD_DETAILS, DATE_FORMAT
-
-
-def build_information():
-    repo = git.Repo()
-    repo_description = git_describe(get_latest_commit(repo))
-    pytex_repo = repo.submodule('PyTeX').module()
-    pytex_repo_description = git_describe(get_latest_commit(pytex_repo))
-    return list(map(lambda line: line.format(
-        build_time=datetime.datetime.now().strftime('%Y/%m/%d %H:%M'),
-        pytex_version=pytex_repo_description,
-        pytex_commit_hash=get_latest_commit(pytex_repo).hexsha[0:7],
-        packages_version=repo_description,
-        packages_commit_hash=get_latest_commit(repo).hexsha[0:7]
-    ), BUILD_DETAILS)), repo_description
-
-
-class BuildInfo:
-    def __init__(
-            self,
-            include_timestamp: bool = False,
-            include_pytex_version: bool = False,
-            include_license: bool = False,
-            include_git_version: bool = False,
-            include_pytex_info_text: bool = False,
-            author: Optional[str] = None,
-            pytex_repo: Optional[git.Repo] = None,
-            packages_repo: Optional[git.Repo] = None):
-        self.author = author
-
-        self._pytex_repo = pytex_repo
-        self._packages_repo = packages_repo
-        self._pytex_repo_commit = None
-        self._packages_repo_commit = None
-        self._pytex_repo_version = None
-        self._packages_repo_version = None
-
-        self._header = None
-
-        self.get_repo_commits()
-        self.get_repo_version()
-
-        self.create_header(
-            include_timestamp=include_timestamp,
-            include_pytex_version=include_pytex_version,
-            include_license=include_license,
-            include_git_version=include_git_version,
-            include_pytex_info_text=include_pytex_info_text
-        )
-
-    def get_repo_commits(self):
-        if self._packages_repo:
-            self._packages_repo_commit = get_latest_commit(self._packages_repo)
-        if self._pytex_repo:
-            self._pytex_repo_commit = get_latest_commit(self._pytex_repo)
-
-    def get_repo_version(self):
-        if self._packages_repo_commit:
-            self._packages_repo_version = git_describe(self._packages_repo_commit)
-        if self._pytex_repo_commit:
-            self._pytex_repo_version = git_describe(self._pytex_repo_commit)
-
-    def create_header(
-            self,
-            include_timestamp: bool = False,
-            include_pytex_version: bool = False,
-            include_license: bool = False,
-            include_git_version: bool = False,
-            include_pytex_info_text: bool = False):
-        pass
diff --git a/build_scripts/build/config.py b/build_scripts/build/config.py
deleted file mode 100644
index a6d8ad0..0000000
--- a/build_scripts/build/config.py
+++ /dev/null
@@ -1,10 +0,0 @@
-BUILD_DETAILS = [
-    "Build details:",
-    "  Build time: {build_time}",
-    "  PyTeX version: {pytex_version} (commit {pytex_commit_hash})",
-    "  LatexPackages version: {packages_version} (commit {packages_commit_hash})"
-]
-
-FILENAME_TYPE_PREPEND_AUTHOR = 'prepend-author'
-FILENAME_TYPE_RAW_NAME = 'raw'
-DATE_FORMAT = '%Y/%m/%d %H:%M'
diff --git a/build_scripts/git_hook/__init__.py b/build_scripts/git_hook/__init__.py
deleted file mode 100644
index 851f2bc..0000000
--- a/build_scripts/git_hook/__init__.py
+++ /dev/null
@@ -1,9 +0,0 @@
-from .git_version import git_describe, get_history, get_latest_commit
-from .recent import is_recent
-
-__all__ = [
-    'git_describe',
-    'get_history',
-    'get_latest_commit',
-    'is_recent'
-]
diff --git a/build_scripts/git_hook/git_version.py b/build_scripts/git_hook/git_version.py
deleted file mode 100644
index ad9f179..0000000
--- a/build_scripts/git_hook/git_version.py
+++ /dev/null
@@ -1,53 +0,0 @@
-import git
-from typing import Dict
-
-
-def get_latest_commit(repo):
-    if repo.head.is_detached:
-        return repo.head.commit
-    else:
-        return repo.head.ref.commit
-
-
-def get_history(commit: git.objects.commit.Commit, priority=0, depth=0) -> Dict:
-    commit_history = {commit.hexsha: {
-        'priority': priority,
-        'depth': depth
-    }}
-    try:
-        if len(commit.parents) > 0:
-            commit_history.update(get_history(commit.parents[0], priority, depth + 1))
-            for parent in commit.parents[1:]:
-                commit_history.update(get_history(parent, priority + 1, depth + 1))
-    except ValueError:
-        pass
-    return commit_history
-
-
-def git_describe(commit: git.objects.commit.Commit):
-    commit_history = get_history(commit)
-    latest_tag = None
-    for tag in commit.repo.tags:
-        sha = tag.commit.hexsha
-        if sha in commit_history.keys():
-            if latest_tag is None:
-                latest_tag = tag
-            elif commit_history[sha]['priority'] < commit_history[latest_tag.commit.hexsha]['priority']:
-                latest_tag = tag
-            elif commit_history[sha]['priority'] > commit_history[latest_tag.commit.hexsha]['priority']:
-                pass  # move on
-            elif commit_history[sha]['depth'] < commit_history[latest_tag.commit.hexsha]['depth']:
-                latest_tag = tag
-            elif commit_history[sha]['depth'] > commit_history[latest_tag.commit.hexsha]['depth']:
-                pass  # move on
-            elif tag.object.tagged_date > latest_tag.object.tagged_date:
-                latest_tag = tag
-    if latest_tag is None:
-        return "No tags found - cannot describe anything."
-    else:
-        msg = latest_tag.name
-        if commit_history[latest_tag.commit.hexsha]['depth'] != 0:
-            msg += "-{depth}".format(depth=commit_history[latest_tag.commit.hexsha]['depth'])
-        if commit.repo.is_dirty(untracked_files=True):
-            msg += '-*'
-        return msg
diff --git a/build_scripts/git_hook/recent.py b/build_scripts/git_hook/recent.py
deleted file mode 100644
index 2c86345..0000000
--- a/build_scripts/git_hook/recent.py
+++ /dev/null
@@ -1,30 +0,0 @@
-import git
-
-from .git_version import get_latest_commit
-from typing import Union, Optional, List
-
-
-def is_recent(file, repo, compare: Optional[Union[git.Commit, List[git.Commit]]] = None) -> Optional[bool]:
-    modified_files = [item.a_path for item in repo.index.diff(None)]
-    if file in modified_files:
-        return True
-
-    newly_committed_files = []
-    if type(compare) == git.Commit:
-        newly_committed_files = [item.a_path for item in repo.index.diff(compare)]
-    elif type(compare) == list:
-        for commit in compare:
-            for item in repo.index.diff(commit):
-                newly_committed_files.append(item.a_path)
-    elif type is None:
-        for parent in get_latest_commit(repo).parents:
-            for item in repo.index.diff(parent):
-                newly_committed_files.append(item.a_path)
-    else:
-        print("Invalid argument type for compare")
-        return None
-
-    if file in newly_committed_files:
-        return True
-    else:
-        return False
diff --git a/build_scripts/travis/deploy_message.py b/build_scripts/travis/deploy_message.py
index 19f0327..e2ed535 100644
--- a/build_scripts/travis/deploy_message.py
+++ b/build_scripts/travis/deploy_message.py
@@ -1,5 +1,5 @@
 import os
-from build_scripts.git_hook import get_latest_commit
+from PyTeX.build.git_hook import get_latest_commit
 
 
 def get_deploy_message(repo):
diff --git a/build_scripts/utils/__init__.py b/build_scripts/utils/__init__.py
deleted file mode 100644
index e69de29..0000000

From a10709dd3bef1fdf6c3abe6bc5f7126609367d6f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 10:12:09 +0200
Subject: [PATCH 06/56] resolve paths to absolute ones

---
 build.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/build.py b/build.py
index 4d1bbf2..22c3d73 100755
--- a/build.py
+++ b/build.py
@@ -93,8 +93,11 @@ def main():
         action='store_true',
         dest='overwrite_existing_files'
     )
-    args = parser.parse_args()
-    build(**vars(args))
+    args = vars(parser.parse_args())
+    for arg in args.keys():
+        if type(args[arg]) == pathlib.PosixPath:
+            args[arg] = args[arg].resolve()
+    build(**args)
 
 
 if __name__ == "__main__":

From 4dde7d2e118b5838cf7120e00e3a619c1546a829 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 11:59:11 +0200
Subject: [PATCH 07/56] fix wrong complementary arguments

---
 build.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/build.py b/build.py
index 22c3d73..33edf49 100755
--- a/build.py
+++ b/build.py
@@ -9,7 +9,6 @@ from PyTeX.build.build.config import FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPE
 def main():
     parser = argparse.ArgumentParser(description='Incrementally build LatexPackages with PyTeX')
     input_group = parser.add_mutually_exclusive_group(required=True)
-    output_group = parser.add_mutually_exclusive_group()
     input_group.add_argument(
         '-s', '--source-dir',
         metavar='SRC_DIR',
@@ -19,7 +18,7 @@ def main():
         default='./src',
         dest='src_dir'
     )
-    output_group.add_argument(
+    parser.add_argument(
         '-b', '--build-dir',
         metavar='BUILD_DIR',
         help='Relativ or absolute path to output directory for processed packages and classes',
@@ -41,7 +40,7 @@ def main():
         type=pathlib.Path,
         dest='input_file'
     )
-    output_group.add_argument(
+    parser.add_argument(
         '-n', '--name',
         help='Name of the package / class to be formatted.',
         type=str,

From 19d0211709d29b6578087d6991eb7a5252d2b0a3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 11:59:25 +0200
Subject: [PATCH 08/56] update submodule

---
 PyTeX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PyTeX b/PyTeX
index 90acc2b..7b277ad 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit 90acc2baf7920d3c0f385ece3ab060d2a5060aab
+Subproject commit 7b277ad8b66a94811ddedad71a0ad04ff588b7c3

From f538c8d224b3c749742e93bcb05297162bfd6be8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 12:56:24 +0200
Subject: [PATCH 09/56] update submodule

---
 PyTeX                           | 2 +-
 src/environments/fancythm.pysty | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/PyTeX b/PyTeX
index 7b277ad..408a154 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit 7b277ad8b66a94811ddedad71a0ad04ff588b7c3
+Subproject commit 408a154548c7c222c6beb606f7eff3bcd239f100
diff --git a/src/environments/fancythm.pysty b/src/environments/fancythm.pysty
index e362180..532420e 100644
--- a/src/environments/fancythm.pysty
+++ b/src/environments/fancythm.pysty
@@ -265,3 +265,5 @@ __END_OPTIONS_X__
     \newtheorem{reminder}{\if__PACKAGE_PREFIX__english Reminder\else Erinnerung\fi}
 
 \fi % end of default theorems
+
+% just a test

From f7cac79e807b5863b1d726f2af6a66f1ff6409f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 13:51:46 +0200
Subject: [PATCH 10/56] update submodule

---
 PyTeX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PyTeX b/PyTeX
index 408a154..f0c3226 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit 408a154548c7c222c6beb606f7eff3bcd239f100
+Subproject commit f0c32260fa149978d690a27a6422b391241ac493

From e7292fa4f5e9c679a8e98179b0003be1eabb1096 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 13:53:17 +0200
Subject: [PATCH 11/56] test

---
 src/environments/fancythm.pysty | 2 --
 1 file changed, 2 deletions(-)

diff --git a/src/environments/fancythm.pysty b/src/environments/fancythm.pysty
index 532420e..e362180 100644
--- a/src/environments/fancythm.pysty
+++ b/src/environments/fancythm.pysty
@@ -265,5 +265,3 @@ __END_OPTIONS_X__
     \newtheorem{reminder}{\if__PACKAGE_PREFIX__english Reminder\else Erinnerung\fi}
 
 \fi % end of default theorems
-
-% just a test

From f7ad23a478e79152f6c254a8e259476d31b24dbd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 13:56:19 +0200
Subject: [PATCH 12/56] update submodule

---
 PyTeX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PyTeX b/PyTeX
index f0c3226..de10ca7 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit f0c32260fa149978d690a27a6422b391241ac493
+Subproject commit de10ca75461de877297f31eb0b61ee5d9f16193d

From 8139152d809c115e6f5d950f668c6301e9f9a6e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 14:03:39 +0200
Subject: [PATCH 13/56] test

---
 src/environments/fancythm.pysty | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/environments/fancythm.pysty b/src/environments/fancythm.pysty
index e362180..532420e 100644
--- a/src/environments/fancythm.pysty
+++ b/src/environments/fancythm.pysty
@@ -265,3 +265,5 @@ __END_OPTIONS_X__
     \newtheorem{reminder}{\if__PACKAGE_PREFIX__english Reminder\else Erinnerung\fi}
 
 \fi % end of default theorems
+
+% just a test

From ae76e5b77b2da8da95c3afb9d4349e207a1b23f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 14:52:20 +0200
Subject: [PATCH 14/56] move parser into submodule

---
 PyTeX    |   2 +-
 build.py | 102 ++-----------------------------------------------------
 2 files changed, 4 insertions(+), 100 deletions(-)

diff --git a/PyTeX b/PyTeX
index de10ca7..12a03e7 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit de10ca75461de877297f31eb0b61ee5d9f16193d
+Subproject commit 12a03e79897dfc4cf3de218ed88ba7c56debfcad
diff --git a/build.py b/build.py
index 33edf49..83a03e8 100755
--- a/build.py
+++ b/build.py
@@ -1,103 +1,7 @@
 #! /usr/bin/python3
-import argparse
-import pathlib
-
-from PyTeX.build.build import build
-from PyTeX.build.build.config import FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPEND_AUTHOR
-
-
-def main():
-    parser = argparse.ArgumentParser(description='Incrementally build LatexPackages with PyTeX')
-    input_group = parser.add_mutually_exclusive_group(required=True)
-    input_group.add_argument(
-        '-s', '--source-dir',
-        metavar='SRC_DIR',
-        help='Relative or absolute path to source directory of .pysty or .pycls files',
-        type=pathlib.Path,
-        nargs='?',
-        default='./src',
-        dest='src_dir'
-    )
-    parser.add_argument(
-        '-b', '--build-dir',
-        metavar='BUILD_DIR',
-        help='Relativ or absolute path to output directory for processed packages and classes',
-        type=pathlib.Path,
-        nargs='?',
-        default='./build',
-        dest='build_dir'
-    )
-    parser.add_argument(
-        '-r', '--recursive',
-        help='Recursively search subdirectories for files. Default: false',
-        action='store_true',
-        dest='recursive'
-    )
-    input_group.add_argument(
-        '-i', '--input-file',
-        metavar='FILE',
-        help='Filename to be built. Can be in valid .pysty or .pycls format',
-        type=pathlib.Path,
-        dest='input_file'
-    )
-    parser.add_argument(
-        '-n', '--name',
-        help='Name of the package / class to be formatted.',
-        type=str,
-        choices=[FILENAME_TYPE_RAW_NAME, FILENAME_TYPE_PREPEND_AUTHOR],
-        default=FILENAME_TYPE_PREPEND_AUTHOR,
-        dest='latex_name'
-    )
-    parser.add_argument(
-        '-g', '--git-version',
-        help='Insert git version information into build. This assumes your input'
-             'files are located in a git repository. Default: false',
-        action='store_true',
-        dest='use_git'
-    )
-    parser.add_argument(
-        '-d', '--allow-dirty',
-        help='If git flag is set, allow building of a dirty repo. Default: false',
-        action='store_true',
-        dest='allow_dirty'
-    )
-    parser.add_argument(
-        '-p',
-        '--pytex-version',
-        help='Write PyTeX version information into built LaTeX files',
-        action='store_true',
-        dest='include_pytex_version'
-    )
-    parser.add_argument(
-        '-t', '--build-time',
-        help='Insert build time into built LaTeX files',
-        action='store_true',
-        dest='include_timestamp'
-    )
-    parser.add_argument(
-        '-l', '--license',
-        help='Insert MIT license into package header',
-        action='store_true',
-        dest='include_license'
-    )
-    parser.add_argument(
-        '-a', '--author',
-        help='Set author of packages',
-        type=str,
-        dest='author'
-    )
-    parser.add_argument(
-        '-f', '--force',
-        help='Overwrite unknown existing files without confirmation',
-        action='store_true',
-        dest='overwrite_existing_files'
-    )
-    args = vars(parser.parse_args())
-    for arg in args.keys():
-        if type(args[arg]) == pathlib.PosixPath:
-            args[arg] = args[arg].resolve()
-    build(**args)
+import sys
 
+from PyTeX.build import parse_and_build
 
 if __name__ == "__main__":
-    main()
+    parse_and_build(sys.argv[1:])

From 1911da242332cafeb640e9a4a901c2a49d442914 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 18:51:25 +0200
Subject: [PATCH 15/56] move travis stuff into own folder

---
 {build_scripts => .travis/deploy}/__init__.py              | 0
 {build_scripts/travis => .travis/deploy}/deploy_message.py | 0
 travis_build.sh => .travis/travis_build.sh                 | 0
 build_scripts/travis/__init__.py                           | 5 -----
 4 files changed, 5 deletions(-)
 rename {build_scripts => .travis/deploy}/__init__.py (100%)
 rename {build_scripts/travis => .travis/deploy}/deploy_message.py (100%)
 rename travis_build.sh => .travis/travis_build.sh (100%)
 delete mode 100644 build_scripts/travis/__init__.py

diff --git a/build_scripts/__init__.py b/.travis/deploy/__init__.py
similarity index 100%
rename from build_scripts/__init__.py
rename to .travis/deploy/__init__.py
diff --git a/build_scripts/travis/deploy_message.py b/.travis/deploy/deploy_message.py
similarity index 100%
rename from build_scripts/travis/deploy_message.py
rename to .travis/deploy/deploy_message.py
diff --git a/travis_build.sh b/.travis/travis_build.sh
similarity index 100%
rename from travis_build.sh
rename to .travis/travis_build.sh
diff --git a/build_scripts/travis/__init__.py b/build_scripts/travis/__init__.py
deleted file mode 100644
index a756aa3..0000000
--- a/build_scripts/travis/__init__.py
+++ /dev/null
@@ -1,5 +0,0 @@
-from .deploy_message import get_deploy_message
-
-__all__ = [
-    'get_deploy_message'
-]

From 022bb0f9ff947094085b94d783b2bdfd569fb15f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 19:29:23 +0200
Subject: [PATCH 16/56] handle header correctly, i.e. do not only expand on
 macro

---
 .build/header_info.txt | 7 +++++++
 Makefile               | 6 +++++-
 PyTeX                  | 2 +-
 3 files changed, 13 insertions(+), 2 deletions(-)
 create mode 100644 .build/header_info.txt

diff --git a/.build/header_info.txt b/.build/header_info.txt
new file mode 100644
index 0000000..2b6390e
--- /dev/null
+++ b/.build/header_info.txt
@@ -0,0 +1,7 @@
+This LaTeX {latex_file_type} is free software and distributed under the MIT License. You
+may use it freely for your purposes. The latest version of the {latex_file_type} can be
+obtained via GitHub under
+   https://github.com/kesslermaximilian/LatexPackages
+For further information see the url above.
+Reportings of bugs, suggestions and improvements are welcome, see the README
+at the Git repository for further information.
diff --git a/Makefile b/Makefile
index dcf91a4..f3d5239 100644
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,11 @@
 .PHONY: build
+BUILD_FLAGS=--source-dir src --build-dir build --recursive --git-version --pytex-version --license --author "Maximilian Keßler" --pytex-info-text --extra-header ".build/header_info.txt" --name "prepend-author"
 
 build: .initsubmodulelock
-	@python3 build.py
+	@python3 build.py ${BUILD_FLAGS}
+
+dirty: .initsubmodulelock
+	@python3 build.py ${BUILD_FLAGS} --allow-dirty
 
 init: .initsubmodulelock .gitconfiglock
 
diff --git a/PyTeX b/PyTeX
index 12a03e7..126d420 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit 12a03e79897dfc4cf3de218ed88ba7c56debfcad
+Subproject commit 126d420b7a6ed2d4b2a42d534ab2e12344869643

From 47cb82c8cbbc1ee33eafebf55b1b102c9155f65f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 19:56:44 +0200
Subject: [PATCH 17/56] add travis script to retrive deploy message (for push
 to build repo)

---
 .travis/deploy/deploy_message.py | 8 +++++++-
 .travis/print_deploy_message.py  | 7 +++++++
 .travis/travis_build.sh          | 6 +++++-
 3 files changed, 19 insertions(+), 2 deletions(-)
 create mode 100644 .travis/print_deploy_message.py

diff --git a/.travis/deploy/deploy_message.py b/.travis/deploy/deploy_message.py
index e2ed535..92108e3 100644
--- a/.travis/deploy/deploy_message.py
+++ b/.travis/deploy/deploy_message.py
@@ -1,5 +1,11 @@
 import os
-from PyTeX.build.git_hook import get_latest_commit
+
+
+def get_latest_commit(repo):
+    if repo.head.is_detached:
+        return repo.head.commit
+    else:
+        return repo.head.ref.commit
 
 
 def get_deploy_message(repo):
diff --git a/.travis/print_deploy_message.py b/.travis/print_deploy_message.py
new file mode 100644
index 0000000..6323314
--- /dev/null
+++ b/.travis/print_deploy_message.py
@@ -0,0 +1,7 @@
+from deploy.deploy_message import get_deploy_message
+import git
+
+if __name__ == "__main__":
+    repo = git.Repo(search_parent_directories=True)
+    msg = get_deploy_message(repo)
+    print(msg)
diff --git a/.travis/travis_build.sh b/.travis/travis_build.sh
index 7f4fbed..48b0f42 100755
--- a/.travis/travis_build.sh
+++ b/.travis/travis_build.sh
@@ -1,6 +1,9 @@
 # ! /bin/sh
 TRAVIS_BRANCH=algebraic-geometry
+TRAVIS_BUILD_DIR=/home/maximilian/LatexPackages
 
+
+cd ${TRAVIS_BUILD_DIR}
 rm -rf LatexPackagesBuild
 
 git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git LatexPackagesBuild
@@ -10,10 +13,11 @@ REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/r
 echo ${REMOTE_BRANCH}
 
 if [ "$REMOTE_BRANCH" = "" ];then
+    echo "This is the first build on this branch, creating new branch in build repository to push to"
     git checkout --orphan ${TRAVIS_BRANCH}-build
     ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r git rm --cached
     ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r rm -rf
 else
-    echo "found"
+    echo "Checking out remote branch from last build"
     git checkout -b ${REMOTE_BRANCH}-build origin/${REMOTE_BRANCH}-build
 fi

From 54319760dc494eaea9167372fe7643902b014554 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 20:14:44 +0200
Subject: [PATCH 18/56] set up travis

---
 .travis.yml                           | 13 +++---------
 .travis/get_build_repo_from_origin.sh | 16 +++++++++++++++
 .travis/travis_build.sh               | 29 ++++++---------------------
 Makefile                              | 12 +++++++----
 4 files changed, 33 insertions(+), 37 deletions(-)
 create mode 100755 .travis/get_build_repo_from_origin.sh

diff --git a/.travis.yml b/.travis.yml
index 1fd2351..02b2b62 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,15 +15,8 @@ install:
     - pip install GitPython
       
 script:
-    - export COMMIT_MSG=$(python3 -c 'from git_version import get_deploy_message; print(get_deploy_message())')
-    - python3 -c 'from build import build; build("build/LatexPackages/")'
-    - cd build
-    - zip -r LatexPackages.zip LatexPackages
-    - tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
-    - cd ..
-
-after_success:
-    
+    - source ./.travis/get_build_repo_from_origin.sh
+    - source ./.travis/travis_build.sh
 
 deploy:
     - provider: pages
@@ -42,7 +35,7 @@ deploy:
     - provider: pages
       edge: true
       github-token: $GITHUB_TOKEN
-      local-dir: build/LatexPackages
+      local-dir: build/LatexPackagesBuild
       repo: kesslermaximilian/LatexPackagesBuild
       commiter_from_gh: true
       allow_empty_commit: true
diff --git a/.travis/get_build_repo_from_origin.sh b/.travis/get_build_repo_from_origin.sh
new file mode 100755
index 0000000..26a9db1
--- /dev/null
+++ b/.travis/get_build_repo_from_origin.sh
@@ -0,0 +1,16 @@
+# ! /bin/sh
+git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git build/LatexPackagesBuild
+cd build/LatexPackagesBuild
+REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${TRAVIS_BRANCH}$/p")
+
+echo ${REMOTE_BRANCH}
+
+if [ "$REMOTE_BRANCH" = "" ];then
+    echo "This is the first build on this branch, creating new branch in build repository to push to"
+    git checkout --orphan ${TRAVIS_BRANCH}-build
+    ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r git rm --cached
+    ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r rm -rf
+else
+    echo "Checking out remote branch from last build"
+    git checkout -b ${REMOTE_BRANCH}-build origin/${REMOTE_BRANCH}-build
+fi
diff --git a/.travis/travis_build.sh b/.travis/travis_build.sh
index 48b0f42..e90f320 100755
--- a/.travis/travis_build.sh
+++ b/.travis/travis_build.sh
@@ -1,23 +1,6 @@
-# ! /bin/sh
-TRAVIS_BRANCH=algebraic-geometry
-TRAVIS_BUILD_DIR=/home/maximilian/LatexPackages
-
-
-cd ${TRAVIS_BUILD_DIR}
-rm -rf LatexPackagesBuild
-
-git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git LatexPackagesBuild
-cd LatexPackagesBuild
-REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${TRAVIS_BRANCH}$/p")
-
-echo ${REMOTE_BRANCH}
-
-if [ "$REMOTE_BRANCH" = "" ];then
-    echo "This is the first build on this branch, creating new branch in build repository to push to"
-    git checkout --orphan ${TRAVIS_BRANCH}-build
-    ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r git rm --cached
-    ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r rm -rf
-else
-    echo "Checking out remote branch from last build"
-    git checkout -b ${REMOTE_BRANCH}-build origin/${REMOTE_BRANCH}-build
-fi
+export COMMIT_MSG=$(python3 print_deploy_message.py)
+make travis
+cd build
+zip -r LatexPackages.zip LatexPackagesBuild
+tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
+cd ..
diff --git a/Makefile b/Makefile
index f3d5239..9e8113d 100644
--- a/Makefile
+++ b/Makefile
@@ -1,11 +1,12 @@
 .PHONY: build
-BUILD_FLAGS=--source-dir src --build-dir build --recursive --git-version --pytex-version --license --author "Maximilian Keßler" --pytex-info-text --extra-header ".build/header_info.txt" --name "prepend-author"
+BUILD_FLAGS=--recursive --git-version --pytex-version --license --author "Maximilian Keßler" --pytex-info-text --extra-header ".build/header_info.txt" --name "prepend-author"
+BUILD_DIRS= --source-dir src --build-dir build
 
 build: .initsubmodulelock
-	@python3 build.py ${BUILD_FLAGS}
+	@python3 build.py ${BUILD_DIRS} ${BUILD_FLAGS}
 
 dirty: .initsubmodulelock
-	@python3 build.py ${BUILD_FLAGS} --allow-dirty
+	@python3 build.py ${BUILD_DIRS} ${BUILD_FLAGS} --allow-dirty
 
 init: .initsubmodulelock .gitconfiglock
 
@@ -25,4 +26,7 @@ config: .gitconfiglock
 
 
 clean:
-	-rm -r build/
+	@-rm -r build/
+
+travis:
+	@python3 build.py --source-dir src --build-dir build/LatexPackagesBuild ${BUILD_FLAGS}

From 0f9d3eefac421eaa132f722e95effc4cdd743f9f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 20:18:30 +0200
Subject: [PATCH 19/56] fix path

---
 .travis/get_build_repo_from_origin.sh | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.travis/get_build_repo_from_origin.sh b/.travis/get_build_repo_from_origin.sh
index 26a9db1..1ab021e 100755
--- a/.travis/get_build_repo_from_origin.sh
+++ b/.travis/get_build_repo_from_origin.sh
@@ -14,3 +14,4 @@ else
     echo "Checking out remote branch from last build"
     git checkout -b ${REMOTE_BRANCH}-build origin/${REMOTE_BRANCH}-build
 fi
+cd ../..

From b65089f5c5bcbad119c4163785d602db0d211a1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Fri, 22 Oct 2021 20:45:16 +0200
Subject: [PATCH 20/56] fix error in file paths

---
 .travis/travis_build.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.travis/travis_build.sh b/.travis/travis_build.sh
index e90f320..800aab1 100755
--- a/.travis/travis_build.sh
+++ b/.travis/travis_build.sh
@@ -1,4 +1,6 @@
+cd .travis
 export COMMIT_MSG=$(python3 print_deploy_message.py)
+cd ..
 make travis
 cd build
 zip -r LatexPackages.zip LatexPackagesBuild

From e17f7fb012009ab216be8e59c6c9a5cf0079c395 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 00:23:24 +0200
Subject: [PATCH 21/56] remove submodule PyTeX

---
 .gitmodules | 4 ----
 PyTeX       | 1 -
 2 files changed, 5 deletions(-)
 delete mode 100644 .gitmodules
 delete mode 160000 PyTeX

diff --git a/.gitmodules b/.gitmodules
deleted file mode 100644
index e5a2100..0000000
--- a/.gitmodules
+++ /dev/null
@@ -1,4 +0,0 @@
-[submodule "PyTeX"]
-	path = PyTeX
-    url = https://github.com/kesslermaximilian/PyTeX.git
-    branch= latex-packages
diff --git a/PyTeX b/PyTeX
deleted file mode 160000
index 126d420..0000000
--- a/PyTeX
+++ /dev/null
@@ -1 +0,0 @@
-Subproject commit 126d420b7a6ed2d4b2a42d534ab2e12344869643

From 5896b853b2b02aae24af0f90576433c57ffa87f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 00:24:59 +0200
Subject: [PATCH 22/56] add submodule pytex from gitlab

---
 .gitmodules | 3 +++
 PyTeX       | 1 +
 2 files changed, 4 insertions(+)
 create mode 100644 .gitmodules
 create mode 160000 PyTeX

diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000..c2a352b
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,3 @@
+[submodule "PyTeX"]
+	path = PyTeX
+	url = ssh://git@gitlab.com/latexci/packages/PyTeX.git
diff --git a/PyTeX b/PyTeX
new file mode 160000
index 0000000..ba0b49d
--- /dev/null
+++ b/PyTeX
@@ -0,0 +1 @@
+Subproject commit ba0b49dbfcb7aa62389698b9a76545d002020ec7

From fa76d879345e56b33324f5f64a95767fb4dca77c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 00:25:26 +0200
Subject: [PATCH 23/56] track latex packages branch

---
 .gitmodules | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitmodules b/.gitmodules
index c2a352b..008b99e 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,4 @@
 [submodule "PyTeX"]
 	path = PyTeX
-	url = ssh://git@gitlab.com/latexci/packages/PyTeX.git
+    url = ssh://git@gitlab.com/latexci/packages/PyTeX.git
+    branch = latex-packages

From 2b38738aa89ebf4472f9e975561baca84975db24 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 00:29:54 +0200
Subject: [PATCH 24/56] update submodule

---
 PyTeX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PyTeX b/PyTeX
index ba0b49d..c98fd28 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit ba0b49dbfcb7aa62389698b9a76545d002020ec7
+Subproject commit c98fd28245b4c26617aa5bed162c4249881bb754

From b8678b1f6c771d04da00aeb2f4f240ef0c2ba240 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 00:44:49 +0200
Subject: [PATCH 25/56] set up gitlab ci. first try

---
 .travis/travis_build.sh => .ci/ci_build.sh    |  4 +-
 {.travis => .ci}/deploy/__init__.py           |  0
 {.travis => .ci}/deploy/deploy_message.py     |  0
 .../get_build_repo_from_origin.sh             |  7 +-
 {.travis => .ci}/print_deploy_message.py      |  0
 .gitlab-ci.yml                                | 82 +++++++++++++++++++
 Makefile                                      |  2 +-
 7 files changed, 89 insertions(+), 6 deletions(-)
 rename .travis/travis_build.sh => .ci/ci_build.sh (89%)
 rename {.travis => .ci}/deploy/__init__.py (100%)
 rename {.travis => .ci}/deploy/deploy_message.py (100%)
 rename {.travis => .ci}/get_build_repo_from_origin.sh (74%)
 rename {.travis => .ci}/print_deploy_message.py (100%)
 create mode 100644 .gitlab-ci.yml

diff --git a/.travis/travis_build.sh b/.ci/ci_build.sh
similarity index 89%
rename from .travis/travis_build.sh
rename to .ci/ci_build.sh
index 800aab1..77f3c60 100755
--- a/.travis/travis_build.sh
+++ b/.ci/ci_build.sh
@@ -1,7 +1,7 @@
-cd .travis
+cd .ci
 export COMMIT_MSG=$(python3 print_deploy_message.py)
 cd ..
-make travis
+make ci-build
 cd build
 zip -r LatexPackages.zip LatexPackagesBuild
 tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
diff --git a/.travis/deploy/__init__.py b/.ci/deploy/__init__.py
similarity index 100%
rename from .travis/deploy/__init__.py
rename to .ci/deploy/__init__.py
diff --git a/.travis/deploy/deploy_message.py b/.ci/deploy/deploy_message.py
similarity index 100%
rename from .travis/deploy/deploy_message.py
rename to .ci/deploy/deploy_message.py
diff --git a/.travis/get_build_repo_from_origin.sh b/.ci/get_build_repo_from_origin.sh
similarity index 74%
rename from .travis/get_build_repo_from_origin.sh
rename to .ci/get_build_repo_from_origin.sh
index 1ab021e..2fe26aa 100755
--- a/.travis/get_build_repo_from_origin.sh
+++ b/.ci/get_build_repo_from_origin.sh
@@ -1,13 +1,14 @@
 # ! /bin/sh
-git clone https://github.com/kesslermaximilian/LatexPackagesBuild.git build/LatexPackagesBuild
+ssh git@gitlab.com
+git clone git@gitlab.com:latexci/packages/LatexPackagesBuild.git build/LatexPackagesBuild
 cd build/LatexPackagesBuild
-REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${TRAVIS_BRANCH}$/p")
+REMOTE_BRANCH=$(git branch -a | sed -n '/remotes\/origin\/.*-build/p' | sed 's/remotes\/origin\///g' | sed 's/-build//g' | sed 's/[[:space:]]//g' | sed -n "/^${CI_COMMIT_REF_NAME}$/p")
 
 echo ${REMOTE_BRANCH}
 
 if [ "$REMOTE_BRANCH" = "" ];then
     echo "This is the first build on this branch, creating new branch in build repository to push to"
-    git checkout --orphan ${TRAVIS_BRANCH}-build
+    git checkout --orphan ${CI_COMMIT_REF_NAME}-build
     ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r git rm --cached
     ls -ra | sed '/^\.git$/d' | sed '/^\.\.$/d' | sed '/^\.$/d' |  xargs -r rm -rf
 else
diff --git a/.travis/print_deploy_message.py b/.ci/print_deploy_message.py
similarity index 100%
rename from .travis/print_deploy_message.py
rename to .ci/print_deploy_message.py
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..0976970
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,82 @@
+stages:          # List of stages for jobs, and their order of execution
+  - get
+  - build
+  - deploy
+
+get-build-repo:       # This job runs in the build stage, which runs first.
+  stage: get
+  before_script:
+    - apt-get update -y && apt-get install -yqqf openssh-client git unzip sshpass rsync --fix-missing
+    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
+    - eval $(ssh-agent -s)
+    - echo "$GITLAB_DEPLOY_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
+
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+
+    - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+
+    - git config --global user.email "git@maximilian-kessler.de"
+    - git config --global user.name "Maximilian Keßler (via gitlab runner)"
+  script:
+      - "Getting old Build repo..."
+      - .ci/get_build_repo_from_origin.sh
+  tags:
+    - latex
+  artifacts:
+    paths:
+      - build/
+
+build-packages:      # This job runs in the deploy stage.
+  stage: build  # It only runs when *both* jobs in the test stage complete successfully.
+  before_script:
+    - apt-get update -y && apt-get install -yqqf openssh-client git unzip sshpass rsync --fix-missing
+    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
+    - eval $(ssh-agent -s)
+    - echo "$GITLAB_DEPLOY_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
+
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+
+    - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+
+    - git config --global user.email "git@maximilian-kessler.de"
+    - git config --global user.name "Maximilian Keßler (via gitlab runner)"
+  script:
+    - echo "Building packages incrementally..."
+    - .ci/ci_build.sh
+    - cd build/LatexPackagesBuild
+    - git add .
+    - git commit -m "${COMMIT_MESSAGE}"
+  artifacts:
+    paths:
+        - build/
+  tags:
+    - latex
+
+pages:
+  stage: deploy
+  artifacts:
+    paths:
+      - public
+  before_script:
+    - apt-get update -y && apt-get install -yqqf openssh-client git unzip sshpass rsync --fix-missing
+    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
+    - eval $(ssh-agent -s)
+    - echo "$GITLAB_DEPLOY_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
+
+    - mkdir -p ~/.ssh
+    - chmod 700 ~/.ssh
+
+    - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
+    - chmod 644 ~/.ssh/known_hosts
+
+    - git config --global user.email "git@maximilian-kessler.de"
+    - git config --global user.name "Maximilian Keßler (via gitlab runner)"
+  script:
+      - cd build/LatexPackagesBuild
+      - git push origin
+  tags:
+    - latex
diff --git a/Makefile b/Makefile
index 9e8113d..e98e350 100644
--- a/Makefile
+++ b/Makefile
@@ -28,5 +28,5 @@ config: .gitconfiglock
 clean:
 	@-rm -r build/
 
-travis:
+ci-build:
 	@python3 build.py --source-dir src --build-dir build/LatexPackagesBuild ${BUILD_FLAGS}

From 0081eca3da9b956534ece333804ca797046ff3bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 05:04:36 +0000
Subject: [PATCH 26/56] Update .gitlab-ci.yml

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0976970..8bf1e73 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -9,6 +9,7 @@ get-build-repo:       # This job runs in the build stage, which runs first.
     - apt-get update -y && apt-get install -yqqf openssh-client git unzip sshpass rsync --fix-missing
     - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
     - eval $(ssh-agent -s)
+    - echo "$GITLAB_DEPLOY_KEY"
     - echo "$GITLAB_DEPLOY_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
 
     - mkdir -p ~/.ssh

From e2031511bc43a8deac0f54ad27074d6520226c06 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 07:34:05 +0200
Subject: [PATCH 27/56] fix ci script

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0976970..6801a4a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -20,7 +20,7 @@ get-build-repo:       # This job runs in the build stage, which runs first.
     - git config --global user.email "git@maximilian-kessler.de"
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
-      - "Getting old Build repo..."
+      - echo "Getting old Build repo..."
       - .ci/get_build_repo_from_origin.sh
   tags:
     - latex

From ba297f86aa95aede3593113a0fb370528b358ffc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:35:20 +0200
Subject: [PATCH 28/56] fix wrong env variable

---
 .ci/deploy/deploy_message.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/deploy/deploy_message.py b/.ci/deploy/deploy_message.py
index 92108e3..042cfcf 100644
--- a/.ci/deploy/deploy_message.py
+++ b/.ci/deploy/deploy_message.py
@@ -14,6 +14,6 @@ def get_deploy_message(repo):
            "\n" \
            "Build branch {branch} ({hexsha}) from {repo_name}" \
         .format(old_msg=old_msg,
-                branch=os.environ['TRAVIS_BRANCH'],
+                branch=os.environ['CI_COMMIT_REF_NAME'],
                 hexsha=get_latest_commit(repo).hexsha[0:7],
                 repo_name='kesslermaximilian/LatexPackages')

From ea4051c55c5cb643bfbe0e50c827ad1e511aa781 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:38:33 +0200
Subject: [PATCH 29/56] fetch submodules

---
 .gitlab-ci.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 8327764..0dc37e8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,6 +3,9 @@ stages:          # List of stages for jobs, and their order of execution
   - build
   - deploy
 
+variables:
+    GIT_SUBMODULE_STRAGEY: recursive
+
 get-build-repo:       # This job runs in the build stage, which runs first.
   stage: get
   before_script:

From cf18cdf175e3d67e4f1a031c522680b9319a4602 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:41:50 +0200
Subject: [PATCH 30/56] test for submodule presence

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0dc37e8..29761a4 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,6 +50,7 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
+    - test -d PyTeX
     - .ci/ci_build.sh
     - cd build/LatexPackagesBuild
     - git add .

From fd5fdd63c5c430d16bfb92ee2d58084225aed3a5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:44:22 +0200
Subject: [PATCH 31/56] update submodule

---
 PyTeX | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/PyTeX b/PyTeX
index c98fd28..126d420 160000
--- a/PyTeX
+++ b/PyTeX
@@ -1 +1 @@
-Subproject commit c98fd28245b4c26617aa5bed162c4249881bb754
+Subproject commit 126d420b7a6ed2d4b2a42d534ab2e12344869643

From e7fb73b29a039dbfae8501ac6d41ffff219cf42f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:46:46 +0200
Subject: [PATCH 32/56] test

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 29761a4..29db287 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -50,7 +50,7 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - test -d PyTeX
+    - test -d PyTeX/build
     - .ci/ci_build.sh
     - cd build/LatexPackagesBuild
     - git add .

From 0fc2e5b27170893efd5a9d39c5e530472f9591a4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:53:35 +0200
Subject: [PATCH 33/56] use relative submodule name

---
 .gitmodules | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitmodules b/.gitmodules
index 008b99e..8a541a0 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,4 +1,4 @@
 [submodule "PyTeX"]
 	path = PyTeX
-    url = ssh://git@gitlab.com/latexci/packages/PyTeX.git
+    url = ../PyTeX.git
     branch = latex-packages

From 60c436a0f8f56851f354a1d34163a15f6bf92888 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:57:57 +0200
Subject: [PATCH 34/56] clone submodule

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 29db287..b7f08d5 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -3,8 +3,6 @@ stages:          # List of stages for jobs, and their order of execution
   - build
   - deploy
 
-variables:
-    GIT_SUBMODULE_STRAGEY: recursive
 
 get-build-repo:       # This job runs in the build stage, which runs first.
   stage: get
@@ -55,6 +53,8 @@ build-packages:      # This job runs in the deploy stage.
     - cd build/LatexPackagesBuild
     - git add .
     - git commit -m "${COMMIT_MESSAGE}"
+    variables:
+        GIT_SUBMODULE_STRAGEY: recursive
   artifacts:
     paths:
         - build/

From 44ea0df8ec011bafe05ac0c45b82b0af2adc400a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 08:58:52 +0200
Subject: [PATCH 35/56] fix

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b7f08d5..334225f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -53,8 +53,8 @@ build-packages:      # This job runs in the deploy stage.
     - cd build/LatexPackagesBuild
     - git add .
     - git commit -m "${COMMIT_MESSAGE}"
-    variables:
-        GIT_SUBMODULE_STRAGEY: recursive
+  variables:
+      GIT_SUBMODULE_STRAGEY: recursive
   artifacts:
     paths:
         - build/

From cba8c5ec2d35883bd0b2c854ab4196f004808ad2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:00:25 +0200
Subject: [PATCH 36/56] fix typo

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 334225f..4dec289 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -54,7 +54,7 @@ build-packages:      # This job runs in the deploy stage.
     - git add .
     - git commit -m "${COMMIT_MESSAGE}"
   variables:
-      GIT_SUBMODULE_STRAGEY: recursive
+      GIT_SUBMODULE_STRATEGY: recursive
   artifacts:
     paths:
         - build/

From 78e6680de97800999d2e3b20fc08091cce694d19 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:03:22 +0200
Subject: [PATCH 37/56] handle not commiting case

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4dec289..67f7b00 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -52,7 +52,7 @@ build-packages:      # This job runs in the deploy stage.
     - .ci/ci_build.sh
     - cd build/LatexPackagesBuild
     - git add .
-    - git commit -m "${COMMIT_MESSAGE}"
+    - git commit -m "${COMMIT_MESSAGE}" || echo "Nothing to commit, working dir clean"
   variables:
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:

From 5949aacc2f0216a53778bb8d6fa4b4eff56f540e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:05:44 +0200
Subject: [PATCH 38/56] show working dir

---
 .gitlab-ci.yml | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 67f7b00..0d869e8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -51,6 +51,7 @@ build-packages:      # This job runs in the deploy stage.
     - test -d PyTeX/build
     - .ci/ci_build.sh
     - cd build/LatexPackagesBuild
+    - echo "$PWD"
     - git add .
     - git commit -m "${COMMIT_MESSAGE}" || echo "Nothing to commit, working dir clean"
   variables:

From 937a9e4ec0e041436ccd6924ab03d0e8e3842c9c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:12:51 +0200
Subject: [PATCH 39/56] deploy

---
 .ci/ci_build.sh | 7 +++++--
 .gitlab-ci.yml  | 5 -----
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh
index 77f3c60..29413a5 100755
--- a/.ci/ci_build.sh
+++ b/.ci/ci_build.sh
@@ -3,6 +3,9 @@ export COMMIT_MSG=$(python3 print_deploy_message.py)
 cd ..
 make ci-build
 cd build
-zip -r LatexPackages.zip LatexPackagesBuild
+zip -r LatexPackages.zip LatexPackagesBuild -x LatexPackagesBuild.git
 tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
-cd ..
+cd LatexPackagesBuild
+git add .
+git commit -m ${COMMIT_MSG} || echo "Nothing new to commit"
+git push
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 0d869e8..9be0036 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,12 +48,7 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - test -d PyTeX/build
     - .ci/ci_build.sh
-    - cd build/LatexPackagesBuild
-    - echo "$PWD"
-    - git add .
-    - git commit -m "${COMMIT_MESSAGE}" || echo "Nothing to commit, working dir clean"
   variables:
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:

From e7ebd57c51c7bd6f89bea8770467930384e6991a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:23:23 +0200
Subject: [PATCH 40/56] correctly push to origin

---
 .ci/ci_build.sh | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh
index 29413a5..3336fca 100755
--- a/.ci/ci_build.sh
+++ b/.ci/ci_build.sh
@@ -3,9 +3,10 @@ export COMMIT_MSG=$(python3 print_deploy_message.py)
 cd ..
 make ci-build
 cd build
-zip -r LatexPackages.zip LatexPackagesBuild -x LatexPackagesBuild.git
+zip -r LatexPackages.zip LatexPackagesBuild -x LatexPackagesBuild/.git/
 tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
 cd LatexPackagesBuild
 git add .
 git commit -m ${COMMIT_MSG} || echo "Nothing new to commit"
-git push
+git push --set-upstream origin ${CI_COMMIT_REF_NAME}-build
+

From 72070ba9ab427b3f35da08820e55813df81d191a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:27:54 +0200
Subject: [PATCH 41/56] add some prints

---
 .ci/ci_build.sh | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh
index 3336fca..bf2b1e7 100755
--- a/.ci/ci_build.sh
+++ b/.ci/ci_build.sh
@@ -6,6 +6,8 @@ cd build
 zip -r LatexPackages.zip LatexPackagesBuild -x LatexPackagesBuild/.git/
 tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
 cd LatexPackagesBuild
+ls -r | xargs echo
+git status | xargs echo
 git add .
 git commit -m ${COMMIT_MSG} || echo "Nothing new to commit"
 git push --set-upstream origin ${CI_COMMIT_REF_NAME}-build

From f90e2957ac5a9eb1d770c24546222fc83cba1f4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:33:27 +0200
Subject: [PATCH 42/56] source script

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9be0036..cc1f53a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,7 +48,7 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - .ci/ci_build.sh
+    - source .ci/ci_build.sh
   variables:
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:

From d149df535c6ac526e095475f89e2859bb2d66e96 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:36:18 +0200
Subject: [PATCH 43/56] explicitly call script with sh

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index cc1f53a..c427162 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,7 +48,7 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - source .ci/ci_build.sh
+    - sh ci/ci_build.sh
   variables:
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:

From 79eb9615055d46ecc9ed63fc1d64034d66a03f7e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:39:01 +0200
Subject: [PATCH 44/56] fix typo

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index c427162..4be2c14 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,7 +48,8 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - sh ci/ci_build.sh
+    - sh .ci/ci_build.sh
+    - sleep 1h
   variables:
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:

From d3f380a54808973290b34b508c08236e66de9035 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:40:47 +0200
Subject: [PATCH 45/56] sleep build

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 4be2c14..26565de 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,8 +48,8 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - sh .ci/ci_build.sh
     - sleep 1h
+    - sh .ci/ci_build.sh
   variables:
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:

From 8b3d2257168cc6059ddca9542be9769fe43cf6b6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:45:09 +0200
Subject: [PATCH 46/56] more artifacts

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 26565de..485b122 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -28,7 +28,7 @@ get-build-repo:       # This job runs in the build stage, which runs first.
     - latex
   artifacts:
     paths:
-      - build/
+      - build/*
 
 build-packages:      # This job runs in the deploy stage.
   stage: build  # It only runs when *both* jobs in the test stage complete successfully.
@@ -54,7 +54,7 @@ build-packages:      # This job runs in the deploy stage.
       GIT_SUBMODULE_STRATEGY: recursive
   artifacts:
     paths:
-        - build/
+        - build/*
   tags:
     - latex
 

From 1a1bf9102d989457969cd66ffedd42bd7b15199b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 09:58:03 +0200
Subject: [PATCH 47/56] fix missing quotes when commiting

---
 .ci/ci_build.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh
index bf2b1e7..27762e5 100755
--- a/.ci/ci_build.sh
+++ b/.ci/ci_build.sh
@@ -9,6 +9,6 @@ cd LatexPackagesBuild
 ls -r | xargs echo
 git status | xargs echo
 git add .
-git commit -m ${COMMIT_MSG} || echo "Nothing new to commit"
+git commit -m "${COMMIT_MSG}" || echo "Nothing new to commit"
 git push --set-upstream origin ${CI_COMMIT_REF_NAME}-build
 

From 8da024a97c6dd5b0d82a2568dc7b925d6c118645 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:03:45 +0200
Subject: [PATCH 48/56] remove sleep

---
 .gitlab-ci.yml | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 485b122..ebf48a7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -48,7 +48,6 @@ build-packages:      # This job runs in the deploy stage.
     - git config --global user.name "Maximilian Keßler (via gitlab runner)"
   script:
     - echo "Building packages incrementally..."
-    - sleep 1h
     - sh .ci/ci_build.sh
   variables:
       GIT_SUBMODULE_STRATEGY: recursive

From 6fa3f7c7cdcb166b03bc3e3f72ba0b43bd994772 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:11:26 +0200
Subject: [PATCH 49/56] deploy zip to pages

---
 .gitlab-ci.yml                  | 31 ++++++++-----------------------
 src/environments/fancythm.pysty |  2 --
 2 files changed, 8 insertions(+), 25 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index ebf48a7..7254fb7 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -57,27 +57,12 @@ build-packages:      # This job runs in the deploy stage.
   tags:
     - latex
 
+
 pages:
-  stage: deploy
-  artifacts:
-    paths:
-      - public
-  before_script:
-    - apt-get update -y && apt-get install -yqqf openssh-client git unzip sshpass rsync --fix-missing
-    - 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client git -y )'
-    - eval $(ssh-agent -s)
-    - echo "$GITLAB_DEPLOY_KEY" | base64 -d | tr -d '\r' | ssh-add - > /dev/null
-
-    - mkdir -p ~/.ssh
-    - chmod 700 ~/.ssh
-
-    - ssh-keyscan gitlab.com >> ~/.ssh/known_hosts
-    - chmod 644 ~/.ssh/known_hosts
-
-    - git config --global user.email "git@maximilian-kessler.de"
-    - git config --global user.name "Maximilian Keßler (via gitlab runner)"
-  script:
-      - cd build/LatexPackagesBuild
-      - git push origin
-  tags:
-    - latex
+    artifacts:
+        paths:
+            - build/*
+        script:
+            - echo "deploying to pages"
+        tags:
+            -latex
diff --git a/src/environments/fancythm.pysty b/src/environments/fancythm.pysty
index 532420e..e362180 100644
--- a/src/environments/fancythm.pysty
+++ b/src/environments/fancythm.pysty
@@ -265,5 +265,3 @@ __END_OPTIONS_X__
     \newtheorem{reminder}{\if__PACKAGE_PREFIX__english Reminder\else Erinnerung\fi}
 
 \fi % end of default theorems
-
-% just a test

From 207005b423198c2c3a2f934b916d06bbb421865d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:12:37 +0200
Subject: [PATCH 50/56] fix wrong pages config

---
 .gitlab-ci.yml | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7254fb7..3bce31c 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -62,7 +62,7 @@ pages:
     artifacts:
         paths:
             - build/*
-        script:
-            - echo "deploying to pages"
-        tags:
-            -latex
+    script:
+        - echo "deploying to pages"
+    tags:
+        -latex

From 64ffc7ac56dea2187c3c51c052a9d49999541be1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:13:18 +0200
Subject: [PATCH 51/56] fix missig space character

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3bce31c..6765ee8 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -65,4 +65,4 @@ pages:
     script:
         - echo "deploying to pages"
     tags:
-        -latex
+        - latex

From d2841500a81e6f8ace75b7424a2620256d878e0f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:14:08 +0200
Subject: [PATCH 52/56] add pages stage

---
 .gitlab-ci.yml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 6765ee8..aae2e81 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,7 +1,7 @@
 stages:          # List of stages for jobs, and their order of execution
   - get
   - build
-  - deploy
+  - pages
 
 
 get-build-repo:       # This job runs in the build stage, which runs first.
@@ -59,6 +59,7 @@ build-packages:      # This job runs in the deploy stage.
 
 
 pages:
+    stage: pages
     artifacts:
         paths:
             - build/*

From de69cdada3a7a872bf902399d591f9902e309b78 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:20:33 +0200
Subject: [PATCH 53/56] deploy to pages

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index aae2e81..7b78c7b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -64,6 +64,6 @@ pages:
         paths:
             - build/*
     script:
-        - echo "deploying to pages"
+        - mv build/ public/
     tags:
         - latex

From f54ff80b795674c52fd0b9dbffda1396e750b74c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:22:38 +0200
Subject: [PATCH 54/56] fix

---
 .gitlab-ci.yml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 7b78c7b..032af96 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -62,7 +62,7 @@ pages:
     stage: pages
     artifacts:
         paths:
-            - build/*
+            - public/
     script:
         - mv build/ public/
     tags:

From dee443429033a4241a701327708e3fe5d7a798d2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:31:12 +0200
Subject: [PATCH 55/56] correct zipping

---
 .ci/ci_build.sh | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/.ci/ci_build.sh b/.ci/ci_build.sh
index 27762e5..55c43f3 100755
--- a/.ci/ci_build.sh
+++ b/.ci/ci_build.sh
@@ -3,11 +3,9 @@ export COMMIT_MSG=$(python3 print_deploy_message.py)
 cd ..
 make ci-build
 cd build
-zip -r LatexPackages.zip LatexPackagesBuild -x LatexPackagesBuild/.git/
+zip -r LatexPackages.zip LatexPackagesBuild/ -x '*.git*'
 tree -H '.' -I "index.html" -D --charset utf-8 -T "LatexPackages" > index.html
 cd LatexPackagesBuild
-ls -r | xargs echo
-git status | xargs echo
 git add .
 git commit -m "${COMMIT_MSG}" || echo "Nothing new to commit"
 git push --set-upstream origin ${CI_COMMIT_REF_NAME}-build

From 15801576ba3b1400c296349bec6d610e54efb483 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= <git@maximilian-kessler.de>
Date: Sun, 24 Oct 2021 10:33:12 +0200
Subject: [PATCH 56/56] deploy to pages only on master

---
 .gitlab-ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 032af96..9e6036f 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -67,3 +67,5 @@ pages:
         - mv build/ public/
     tags:
         - latex
+    only:
+        - master