summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorJulien Rioux <jrioux@physics.utoronto.ca>2012-03-13 16:50:16 -0400
committerJulien Rioux <jrioux@physics.utoronto.ca>2012-03-19 09:53:24 -0400
commit2f84bbe9a6dc6ca2d9a49eae0bf094744e47f11d (patch)
treeeff053d294a27cbae44fda70b5f5805278dac388 /scripts
parentb360ccf2c5eb50493b07ac8dafe3f7a68954d0c9 (diff)
Build: Better error handling from build scripts.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build/bib2texi.py10
-rw-r--r--scripts/build/genicon.py2
-rw-r--r--scripts/build/mf-to-table.py12
-rw-r--r--scripts/build/mf2pt1.pl2
4 files changed, 19 insertions, 7 deletions
diff --git a/scripts/build/bib2texi.py b/scripts/build/bib2texi.py
index ab8a6b902b..c71976dec1 100644
--- a/scripts/build/bib2texi.py
+++ b/scripts/build/bib2texi.py
@@ -69,15 +69,21 @@ cmd = "TEXMFOUTPUT=%s bibtex %s %s" % (tmpdir, quiet_flag, tmpfile)
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):
diff --git a/scripts/build/genicon.py b/scripts/build/genicon.py
index 543735240f..b96730b769 100644
--- a/scripts/build/genicon.py
+++ b/scripts/build/genicon.py
@@ -15,7 +15,7 @@ os.chdir(dir)
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] :
diff --git a/scripts/build/mf-to-table.py b/scripts/build/mf-to-table.py
index 44f0edc33a..f191d0aa8f 100644
--- a/scripts/build/mf-to-table.py
+++ b/scripts/build/mf-to-table.py
@@ -27,7 +27,7 @@ import time
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 = []
@@ -61,14 +61,20 @@ def parse_logfile (fn):
}
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
diff --git a/scripts/build/mf2pt1.pl b/scripts/build/mf2pt1.pl
index 3a39a126d4..befe8bc3e2 100644
--- a/scripts/build/mf2pt1.pl
+++ b/scripts/build/mf2pt1.pl
@@ -427,7 +427,7 @@ ENDHEADER
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] }