[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Build: Better error handling from build scripts. (issue 5812043)
From: |
julien . rioux |
Subject: |
Build: Better error handling from build scripts. (issue 5812043) |
Date: |
Tue, 13 Mar 2012 20:54:28 +0000 |
Reviewers: phileholmes_googlemail.com,
Message:
Please review.
Description:
Build: Better error handling from build scripts.
Please review this at http://codereview.appspot.com/5812043/
Affected files:
M scripts/build/bib2texi.py
M scripts/build/genicon.py
M scripts/build/mf-to-table.py
M scripts/build/mf2pt1.pl
Index: scripts/build/bib2texi.py
diff --git a/scripts/build/bib2texi.py b/scripts/build/bib2texi.py
index
ab8a6b902be6752e2a0aedb1298c3baf3428d340..c71976dec123f64b50457d055ffa45dd6f5aa14a
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):
Index: scripts/build/genicon.py
diff --git a/scripts/build/genicon.py b/scripts/build/genicon.py
index
543735240fea9542c7931c4a99dd978e85b8fa63..b96730b7690261b1d0c063dadd1c8874b4da4ee7
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] :
Index: scripts/build/mf-to-table.py
diff --git a/scripts/build/mf-to-table.py b/scripts/build/mf-to-table.py
index
44f0edc33aa3e4ae26c5da88a5a7849aa27f99e2..f191d0aa8fcc3a0941e01f8c4f829d5cd90a8e8f
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
Index: scripts/build/mf2pt1.pl
diff --git a/scripts/build/mf2pt1.pl b/scripts/build/mf2pt1.pl
index
3a39a126d4f89bfd13575152b6f253a98593d318..befe8bc3e20721ec38b5fae30d8cc41d03c362e9
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] }
- Build: Better error handling from build scripts. (issue 5812043),
julien . rioux <=