aboutsummaryrefslogtreecommitdiffstats
path: root/waflib/extras/biber.py
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-09-15 14:51:03 +0200
committerDavid Robillard <d@drobilla.net>2018-09-15 14:51:03 +0200
commitbe0edc0483a9b0b16171e0a7624e1cac9750d8e0 (patch)
tree2f639b07d13e56ce068347304bd6d4bf89c7ed2c /waflib/extras/biber.py
parentd3e4e496a19a266ffac7c04fb7d54926e39f55a2 (diff)
parentc2b0355b0de23f6ec83b5fa5be038bcce208e26f (diff)
downloadserd-be0edc0483a9b0b16171e0a7624e1cac9750d8e0.tar.gz
serd-be0edc0483a9b0b16171e0a7624e1cac9750d8e0.tar.bz2
serd-be0edc0483a9b0b16171e0a7624e1cac9750d8e0.zip
Merge commit 'c2b0355b0de23f6ec83b5fa5be038bcce208e26f' as 'waflib'
Diffstat (limited to 'waflib/extras/biber.py')
-rw-r--r--waflib/extras/biber.py58
1 files changed, 58 insertions, 0 deletions
diff --git a/waflib/extras/biber.py b/waflib/extras/biber.py
new file mode 100644
index 00000000..fd9db4e0
--- /dev/null
+++ b/waflib/extras/biber.py
@@ -0,0 +1,58 @@
+#!/usr/bin/env python
+# encoding: utf-8
+# Thomas Nagy, 2011 (ita)
+
+"""
+Latex processing using "biber"
+"""
+
+import os
+from waflib import Task, Logs
+
+from waflib.Tools import tex as texmodule
+
+class tex(texmodule.tex):
+ biber_fun, _ = Task.compile_fun('${BIBER} ${BIBERFLAGS} ${SRCFILE}',shell=False)
+ biber_fun.__doc__ = """
+ Execute the program **biber**
+ """
+
+ def bibfile(self):
+ return None
+
+ def bibunits(self):
+ self.env.env = {}
+ self.env.env.update(os.environ)
+ self.env.env.update({'BIBINPUTS': self.texinputs(), 'BSTINPUTS': self.texinputs()})
+ self.env.SRCFILE = self.aux_nodes[0].name[:-4]
+
+ if not self.env['PROMPT_LATEX']:
+ self.env.append_unique('BIBERFLAGS', '--quiet')
+
+ path = self.aux_nodes[0].abspath()[:-4] + '.bcf'
+ if os.path.isfile(path):
+ Logs.warn('calling biber')
+ self.check_status('error when calling biber, check %s.blg for errors' % (self.env.SRCFILE), self.biber_fun())
+ else:
+ super(tex, self).bibfile()
+ super(tex, self).bibunits()
+
+class latex(tex):
+ texfun, vars = Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}', shell=False)
+class pdflatex(tex):
+ texfun, vars = Task.compile_fun('${PDFLATEX} ${PDFLATEXFLAGS} ${SRCFILE}', shell=False)
+class xelatex(tex):
+ texfun, vars = Task.compile_fun('${XELATEX} ${XELATEXFLAGS} ${SRCFILE}', shell=False)
+
+def configure(self):
+ """
+ Almost the same as in tex.py, but try to detect 'biber'
+ """
+ v = self.env
+ for p in ' biber tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split():
+ try:
+ self.find_program(p, var=p.upper())
+ except self.errors.ConfigurationError:
+ pass
+ v['DVIPSFLAGS'] = '-Ppdf'
+