-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathbuild
executable file
·41 lines (31 loc) · 1.05 KB
/
build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/usr/bin/env python
"""
Parallel build of the HTML slide decks and Jupyter notebooks (and optionally PDF slide decks)
"""
# Python Standard Library
import os
import shlex
import subprocess
import sys
def sh(cmd):
return subprocess.Popen(shlex.split(cmd))
targets = [file[:-3] for file in os.listdir() if file[0].isdigit() and file.endswith(".md")]
print("Building notebooks and HTML slide decks")
processes = []
for target in targets:
cmd = ["./build.py"]
if "--fast" in sys.argv[1:]:
cmd.append("--fast")
cmd.append(f"{target}.md")
processes.append(subprocess.Popen(cmd)) # start in the background
status = (0 if all(p.wait() == 0 for p in processes) else 1)
if status != 0:
sys.exit(status)
if "--pdf" in sys.argv[1:]:
print("Building PDF slide decks")
processes = []
for target in targets:
cmd = f"decktape --chrome-arg=--no-sandbox --size 1600x900 automatic {target}.html {target}.pdf"
process = sh(cmd)
processes.append(process)
sys.exit(0 if all(p.wait() == 0 for p in processes) else 1)