Skip to content
Snippets Groups Projects
Commit aa4abe27 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

cleanup

parent 2b41544c
No related branches found
No related tags found
No related merge requests found
Pipeline #2374 failed with stage
in 12 seconds
......@@ -3,7 +3,6 @@ from __future__ import print_function
import json, sys
import os.path
def readin(path, func=lambda x: x, orelse=None):
if os.path.exists(path):
with open(path, 'rb') as fin:
......@@ -12,6 +11,8 @@ def readin(path, func=lambda x: x, orelse=None):
return orelse
if __name__ == '__main__':
header_bin = readin('src/header.md')
footer_bin = readin('src/footer.md')
for lab_name in ('lab'+str(x) for x in xrange(7, start=1)):
dist_lp = 'dist/' + lab_name + '/'
......@@ -21,14 +22,8 @@ if __name__ == '__main__':
print('Aborting, no src file')
sys.exit()
header_bin = readin('src/header.md')
footer_bin = readin('src/footer.md')
# Make directories
try:
os.makedirs(dist_lp)
except OSError:
pass
os.system('mkdir -p '+dist_lp)
# Load data
data = readin('src/'+lab_name+'.json', json.load, orelse=[{}])
......@@ -49,5 +44,4 @@ if __name__ == '__main__':
labout.write(plab.encode('utf8'))
labout.write(footer_bin)
if os.system(('pandoc %s%s.md -s -o %s%s.pdf') % (dist_lp, ex_no, dist_lp, ex_no)) != 0:
sys.exit(1)
os.system(('pandoc %s%s.md -s -o %s%s.pdf') % (dist_lp, ex_no, dist_lp, ex_no))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment