-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.py
36 lines (27 loc) · 951 Bytes
/
build.py
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
import json
import os
import sys
def main(runner="build"):
with open("pdfs/info.json") as f:
pdfs = json.load(f)
for key, value in pdfs.items():
print(f'{key} is building')
# change directory
os.chdir(value["working_directory"])
# build pdf
command = f'xelatex {value["input_file"]}'
os.system(command)
# create folder
folder = "pdf" if runner == "release" else "pdfs"
if folder != "pdfs":
os.system(f'mkdir -p ../{folder}')
# copy pdf
command = f'cp -p {value["asset_path"]} ../{folder}/{value["asset_name"]}'
os.system(command)
# change to parent directory
os.chdir("..")
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "release":
main("release")
else:
main()