if (show_output):
sys.stdout.write ("Running bibtex on %s\n" % files)
+ sys.stdout.write (cmd)
#And invoke it
stat = os.system (cmd)
if stat <> 0:
- sys.exit(1)
+ sys.stderr.write ("Bibtex exited with nonzero exit status!")
+ sys.exit (1)
#TODO: do tex -> itexi on output
-# Following 2 lines copy tmpfile.bbl to the desired output file
+# Following lines copy tmpfile.bbl to the desired output file
bbl = open (tmpfile + '.bbl').read ()
+if bbl.strip () == '':
+ sys.stderr.write ("Bibtex generated an empty file!")
+ sys.exit (1)
+
open (output, 'w').write (bbl)
def cleanup (tmpfile):
def system (c):
print c
if os.system (c):
- raise 'barf'
+ raise Exception('The command exited with nonzero exit status!')
outputs = []
for sz in [48,32,16] :
def read_log_file (fn):
str = open (fn).read ()
- str = re.sub ('\n', '', str)
+ str = re.sub ('[\n\r]', '', str)
str = re.sub ('[\t ]+', ' ', str)
deps = []
}
group = ''
- for l in autolines:
+ for i, l in enumerate(autolines):
tags = l.split ('@:')
if tags[0] == 'group':
group = tags[1]
elif tags[0] == 'puorg':
group = ''
elif tags[0] == 'char':
- name = tags[9]
+ try:
+ name = tags[9]
+ except IndexError:
+ print 'Error in mf-to-table while processing file', fn
+ print 'Index 9 >', len(tags)-1, 'on line', i
+ print l
+ raise
if group:
name = group + '.' + name
sub get_bboxes ($)
{
execute_command 1, ("mpost", "-mem=mf2pt1", "-progname=mpost",
- "\\mode:=localfont; mag:=$mag; bpppix $bpppix; input $mffile");
+ "\\mode:=localfont; mag:=$mag; bpppix $bpppix; nonstopmode; input $mffile");
opendir (CURDIR, ".") || die "${progname}: $! ($filedir)\n";
@charfiles = sort
{ ($a=~ /\.(\d+)$/)[0] <=> ($b=~ /\.(\d+)$/)[0] }