From 7c7eee207ad56663315eeab99ac276b4ad8a1131 Mon Sep 17 00:00:00 2001 From: Dimitri Merejkowsky Date: Mon, 3 Dec 2018 18:20:58 +0100 Subject: [PATCH] Rewrite build script in Python Just becuse --- sessions/build.py | 24 ++++++++++++++++++++++++ sessions/build.sh | 14 -------------- 2 files changed, 24 insertions(+), 14 deletions(-) create mode 100644 sessions/build.py delete mode 100755 sessions/build.sh diff --git a/sessions/build.py b/sessions/build.py new file mode 100644 index 0000000..854ae7c --- /dev/null +++ b/sessions/build.py @@ -0,0 +1,24 @@ +import sys +import os +import subprocess + + +def main(): + if len(sys.argv) < 2: + sys.exit("Usage: build.py NUMBER") + + number = sys.argv[1] + + os.makedirs("build", exist_ok=True) + cmd = [] + if sys.platform == "darwin": + # From mactex + cmd.append("texi2pdf") + else: + cmd.append("pdflatex") + cmd.append(f"../python-{number}") + subprocess.run(cmd, cwd="build", check=True) + + +if __name__ == "__main__": + main() diff --git a/sessions/build.sh b/sessions/build.sh deleted file mode 100755 index eb514c1..0000000 --- a/sessions/build.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/zsh - -set -e - -if [[ -z $1 ]]; then - echo "Usage: build.sh NUMBER" - exit 1 -fi - -( - mkdir -p build - cd build - texi2pdf ../python-${1}.tex -)