Updated gradaudit.py

to use absolute paths in include statements, fixed a typo.
parent 95c26e2f
......@@ -5,6 +5,7 @@ main_writer.py and req_writer.py.
import re
import csv
import util
def get_courses():
......@@ -14,7 +15,9 @@ def get_courses():
def get_required_courses(degree, major, year):
filename = '{0}/{1}/{2}/{1}{2}req.lp'.format(degree, major, year)
directory = util.get_package_dir()
filename = '{0}/{1}/{2}/{3}/{2}{3}req.lp'.format(
directory, degree, major, year)
try:
contents = open(filename).read()
except IOError:
......@@ -25,7 +28,7 @@ def get_required_courses(degree, major, year):
def parse_transcript(transcript):
if isinstance(transcript, str) is str:
if isinstance(transcript, str):
transcript = transcript.splitlines()
csvr = list(csv.reader(transcript))
......@@ -66,9 +69,10 @@ def gen_main(student, degree, major, year, spec, courses):
taken_list = taken_list[:-1]
taken_list += ']).\n'
postamble = "#include 'counting.lp'.\n"\
"#include '{0}/{1}/{2}/{1}{2}rules.lp'.\n\n"\
'?- _main({3}).\n'.format(degree, major, year, student)
directory = util.get_package_dir()
postamble = "#include '{0}/counting.lp'.\n"\
"#include '{0}/{1}/{2}/{3}/{2}{3}rules.lp'.\n\n"\
'?- _main({4}).\n'.format(directory, degree, major, year, student)
mainlp = '\n'.join(
[student_fact, spec_string, has_taken, taken_list, postamble])
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment