Commit 0fae3583 authored by lfilippo's avatar lfilippo

FIX #3 and the fact that templates where not passed w/o -v option

parent b1e4c38c
......@@ -163,18 +163,19 @@ def tex_figure(dd, dirname):
def modified_lines_option(filename, template_dir):
template = os.path.join(template_dir, filename)
#print(template)
cmd = ['diff', '--unchanged-line-format=',
'--old-line-format=',
"--new-line-format=%dn ",
template,
filename]
try:
print("Running '{}'...".format(" ".join(cmd)))
mod_lines = subprocess.check_output(cmd)
except subprocess.CalledProcessError as ret:
#print("Exception while running diff...")
mod_lines = ret.output
print(mod_lines)
#print(mod_lines)
mod_lines = mod_lines.split(" ")
mod_lines = [s for s in mod_lines if s != ""]
#print(mod_lines)
......
......@@ -78,6 +78,8 @@ if __name__ == '__main__':
# Untabify, TODO this should also be applied to other files
subprocess.call(["find", ".", "-name", "'*.py'", "-exec", "sed -i 's/\t/ /g'", "{}", ";"])
print("Template dir is: " + args.template_dir)
# Latexify, check if this is already a leaf directory
regex = '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}'
if re.match(regex, os.path.split(args.results)[-1]) and os.path.isfile(os.path.join(args.results, '.exam-setup-user')):
......@@ -86,6 +88,7 @@ if __name__ == '__main__':
name, nethz = read_info_file(os.path.join(args.results, '.exam-setup-user'))
student = "%s (%s)" % (name, nethz)
latex_creator.main(os.path.join(args.results, 'results-clean'), ip, student,
template_dir=args.template_dir,
original_files=file_hashes, lecture_title=args.lecture, verbose=args.v)
else:
name_table = get_name_table()
......@@ -97,8 +100,8 @@ if __name__ == '__main__':
if args.v:
print('========================================')
print('Found student directory: ' + si)
local_result_dir = os.path.join(args.results, si, 'results-clean')
ip = si
local_result_dir = os.path.join(args.results, si, 'results-clean')
ip = si
if si in name_table:
name, nethz = name_table[si]
student = "%s (%s)" % (name, nethz)
......
......@@ -127,10 +127,10 @@ if (( $+myoptions[-t] )) ; then
tmpfile=$(mktemp)
echo $hashes > $tmpfile
echo "using hashes"
echo ${results_dir} | parallel --bar --will-cite python2 $source_dir/latex_creator_main.py --hashes $tmpfile --results {} --lecture \'${lecture_title}\' $verbose > /dev/null
echo ${results_dir} | parallel --bar --will-cite python2 $source_dir/latex_creator_main.py --hashes $tmpfile --results {} --template-dir ${resources} --lecture \'${lecture_title}\' >> ${results}/python.log
rm $tmpfile
else
echo ${results_dir} | parallel --bar --will-cite python2 $source_dir/latex_creator_main.py --results {} --lecture \'${lecture_title}\' $verbose > /dev/null
echo ${results_dir} | parallel --bar --will-cite python2 $source_dir/latex_creator_main.py --results {} --lecture \'${lecture_title}\' $verbose >> ${results}/python.log
fi || exit 1
fi
fi
......
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