jack2 codebase
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
1.6KB

  1. #!/usr/bin/env python
  2. # encoding: utf-8
  3. # Thomas Nagy, 2011 (ita)
  4. """
  5. Latex processing using "biber"
  6. """
  7. import os
  8. from waflib import Task, Logs
  9. from waflib.Tools import tex as texmodule
  10. class tex(texmodule.tex):
  11. biber_fun, _ = Task.compile_fun('${BIBER} ${BIBERFLAGS} ${SRCFILE}',shell=False)
  12. biber_fun.__doc__ = """
  13. Execute the program **biber**
  14. """
  15. def bibfile(self):
  16. return None
  17. def bibunits(self):
  18. self.env.env = {}
  19. self.env.env.update(os.environ)
  20. self.env.env.update({'BIBINPUTS': self.texinputs(), 'BSTINPUTS': self.texinputs()})
  21. self.env.SRCFILE = self.aux_nodes[0].name[:-4]
  22. if not self.env['PROMPT_LATEX']:
  23. self.env.append_unique('BIBERFLAGS', '--quiet')
  24. path = self.aux_nodes[0].abspath()[:-4] + '.bcf'
  25. if os.path.isfile(path):
  26. Logs.warn('calling biber')
  27. self.check_status('error when calling biber, check %s.blg for errors' % (self.env.SRCFILE), self.biber_fun())
  28. else:
  29. super(tex, self).bibfile()
  30. super(tex, self).bibunits()
  31. class latex(tex):
  32. texfun, vars = Task.compile_fun('${LATEX} ${LATEXFLAGS} ${SRCFILE}', shell=False)
  33. class pdflatex(tex):
  34. texfun, vars = Task.compile_fun('${PDFLATEX} ${PDFLATEXFLAGS} ${SRCFILE}', shell=False)
  35. class xelatex(tex):
  36. texfun, vars = Task.compile_fun('${XELATEX} ${XELATEXFLAGS} ${SRCFILE}', shell=False)
  37. def configure(self):
  38. """
  39. Almost the same as in tex.py, but try to detect 'biber'
  40. """
  41. v = self.env
  42. for p in ' biber tex latex pdflatex xelatex bibtex dvips dvipdf ps2pdf makeindex pdf2ps'.split():
  43. try:
  44. self.find_program(p, var=p.upper())
  45. except self.errors.ConfigurationError:
  46. pass
  47. v['DVIPSFLAGS'] = '-Ppdf'