aboutsummaryrefslogtreecommitdiff
path: root/texall
diff options
context:
space:
mode:
Diffstat (limited to 'texall')
-rwxr-xr-xtexall92
1 files changed, 55 insertions, 37 deletions
diff --git a/texall b/texall
index 739ec5f..47ad016 100755
--- a/texall
+++ b/texall
@@ -229,34 +229,47 @@ class AnalyseLogErrors(Analyser):
if re_error.search(text):
self.d.errors = True
+class Request():
+ def __init__(self, progname, priority=0, invocation=None, reason=None):
+ self.progname = progname
+ self.priority = priority
+ self.invocation = invocation
+ self.reason = reason
+
class AnalyseLogRequests(Analyser):
def __init__(self, d):
d.requests = {}
- d.requestreason = {}
Analyser.__init__(self, d)
- self.inrequest = False
- def addrequest(self, name, priority, reason=None):
+ def addrequest(self, name, priority, invocation=None, reason=None):
if self.d.requests.has_key(name):
- if self.d.requests[name] < priority:
- self.d.requests[name] = priority
+ oldreq = self.d.requests[name]
+ if oldreq.priority < priority:
+ oldreq.priority = priority
if reason:
- self.d.reqeustreason[name] = reason
- elif not self.d.requestreason[name]:
- self.d.requestreason[name] = reason
+ oldreq.reason = reason
+ if invocation:
+ oldreq.invocation = invocation
+ else:
+ if not oldreq.reason:
+ oldreq.reason = reason
+ if not oldreq.invocation:
+ oldreq.invocation = invocation
else:
- self.d.requests[name] = priority
- self.d.requestreason[name] = reason
+ self.d.requests[name] = Request(name, priority, invocation, reason)
def parse(self, text):
for m in re_logmatcher.finditer(text):
if m.group() == 'LaTeX Warning: There were undefined references.':
- self.addrequest("latex", 0, " (because of undefined references)")
+ self.addrequest("latex", 0, reason=" (because of undefined references)")
elif m.group() == 'LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right.':
- self.addrequest("latex", 0, " (because of changed labels)")
+ self.addrequest("latex", 0, reason=" (because of changed labels)")
+ elif m.group()[-5:] == ".bbl.":
+ self.addrequest("bibtex", 1, reason=" (because of missing .bbl)")
+ self.addrequest("latex", 0, reason=" (because of updated .bbl)")
elif m.group(1)!=None:
self.addrequest(m.group(2), int(m.group(1)))
elif m.group(3)!=None:
pri = int(m.group(3))
- binary = m.group(4)
+ progname = m.group(4)
binary = None
options = []
infile = None
@@ -275,10 +288,21 @@ class AnalyseLogRequests(Analyser):
options[1:1] = [ "--wolfgang" ]
if infile != None:
options.append(infile)
- self.addrequest(tuple(options), pri)
+ self.addrequest(progname, pri, invocation=tuple(options))
def finish(self, _):
if self.d.errors:
- self.addrequest("latex", 0, " (because of errors in .log file)")
+ self.addrequest("latex", 0, reason=" (because of errors in .log file)")
+ reqdict=self.d.requests
+ maxpri=0
+ for req in reqdict.itervalues():
+ if req.priority > maxpri:
+ maxpri = req.priority
+ reqlist = []
+ for pri in range(maxpri, -1 , -1):
+ for req in reqdict.itervalues():
+ if req.priority == pri:
+ reqlist.append(req)
+ self.d.requests = reqlist
loganalysers = (AnalyseLogErrors, AnalyseLogRequests)
@@ -639,27 +663,21 @@ def processTex(dirname, texname, data=None, reason=""):
while reqs:
logdata = analyseLog(dirname, logname)
reqs = logdata.requests
- if not reqs: break
- pri = reqs.values()
- pri.sort(reverse=True)
- lastp = pri[0] + 1
- for p in pri:
- if p == lastp: continue
- lastp = p
- for req in reqs.keys():
- rp = reqs[req]
- if rp == p:
- reason = ""
- if opts.verbosity:
- reason = logdata.requestreason[req]
- if not reason:
- reason = " (because of request in .log file, priority %d)"%rp
- if req == "latex":
- runtex(tex, texname, realname, dirname, reason=reason)
- elif isinstance(req, tuple):
- run(req, dirname, reason)
- else:
- error(jobpath+".log", "unsupported request: %s"%req)
+ for req in reqs:
+ reason = ""
+ if opts.verbosity:
+ if req.reason:
+ reason = req.reason
+ else:
+ reason = " (because of request in .log file, priority %d)"%req.priority
+ if req.invocation:
+ run(req.invocation, dirname, reason)
+ elif req.progname == "latex":
+ runtex(tex, texname, realname, dirname, reason=reason)
+ elif req.progname == "bibtex":
+ run( ("bibtex", jobname), dirname, reason)
+ else:
+ error(jobpath+".log", "unsupported request: %s"%req)
numrun+=1
if numrun==MAXRUNS:
error(texpath, "does not stabilise after %i runs"%MAXRUNS)
@@ -909,7 +927,7 @@ try:
re_needsps = re.compile('\\\\usepackage(\\[.*?\\])?\\{[^}]*pstricks[^}]*\\}')
re_rmligs = re.compile('\\\usepackage((\\[.*?\\])?\\{n?german\\}|\\[[^]]*?german[^]]*?\\]\\{babel\\})')
- re_logmatcher = re.compile("^LaTeX Warning: There were undefined references\.$|^LaTeX Warning: Label\(s\) may have changed\. Rerun to get cross-references right\.$|^REQ:(\d+):(\w+):REQ|^REQ:(\d+):(\w+):(.*?):REQ$", re.M | re.S)
+ re_logmatcher = re.compile("^LaTeX Warning: There were undefined references\.$|^LaTeX Warning: Label\(s\) may have changed\. Rerun to get cross-references right\.$|^REQ:(\d+):(\w+):REQ|^REQ:(\d+):(\w+):(.*?):REQ$|^No file [^\n]+\.bbl\.$", re.M | re.S)
re_longreq = re.compile("^(binary|option|infile)=(.*?)$", re.M)
re_error = re.compile('^! ', re.M)