def run (self): """ This method actually runs BibTeX with the appropriate environment variables set. """ msg.progress(_("running BibTeX on %s") % msg.simplify(self.base)) doc = {} if len(self.bib_path) != 1: doc["BIBINPUTS"] = string.join(self.bib_path + [os.getenv("BIBINPUTS", "")], ":") if len(self.bst_path) != 1: doc["BSTINPUTS"] = string.join(self.bst_path + [os.getenv("BSTINPUTS", "")], ":") if self.crossrefs is None: cmd = ["bibtex"] else: cmd = ["bibtex", "-min-crossrefs=" + self.crossrefs] cmd.append(self.doc.env.file_name(self.base)) msg.log(_("executing: %s") % " ".join(cmd), pkg="bibtex") process = Popen(cmd, stdout=PIPE, stderr=PIPE) process.communicate() if process.wait() != 0: msg.info(_("There were errors making the bibliography.")) return False self.run_needed = 0 self.doc.must_compile = 1 return True
def run(self): """ This method actually runs BibTeX with the appropriate environment variables set. """ msg.progress(_("running BibTeX on %s") % msg.simplify(self.base)) doc = {} if len(self.bib_path) != 1: doc["BIBINPUTS"] = string.join( self.bib_path + [os.getenv("BIBINPUTS", "")], ":") if len(self.bst_path) != 1: doc["BSTINPUTS"] = string.join( self.bst_path + [os.getenv("BSTINPUTS", "")], ":") if self.crossrefs is None: cmd = ["bibtex"] else: cmd = ["bibtex", "-min-crossrefs=" + self.crossrefs] # BibTeX comes with a straightjacket in some TeX distros and can't write # to absolute paths. strip the directory, and change into that dir. workdir = os.path.dirname(self.base) basename = os.path.basename(self.base) if self.doc.env.execute(['bibtex', basename], doc, pwd=workdir): msg.info(_("There were errors making the bibliography.")) return False self.run_needed = 0 self.doc.must_compile = 1 return True
def post_compile(self): """ Run makeindex if needed, with appropriate options and environment. """ if not os.path.exists(self.source): msg.log(_("strange, there is no %s") % self.source, pkg="index") return True if not self.run_needed(): return True msg.progress(_("processing index %s") % msg.simplify(self.source)) if self.tool == "makeindex": cmd = ["makeindex", "-q", "-o", self.target] + self.opts cmd.extend(["-t", self.transcript]) if self.style: cmd.extend(["-s", self.style]) cmd.append(self.source) path_var = "INDEXSTYLE" elif self.tool == "xindy": cmd = ["texindy", "--quiet"] for opt in self.opts: if opt == "-g": if self.lang != "": msg.warn(_("'language' overrides 'order german'"), pkg="index") else: self.lang = "german-din" elif opt == "-l": self.modules.append("letter-ordering") msg.warn(_( "use 'module letter-ordering' instead of 'order letter'" ), pkg="index") else: msg.error("unknown option to xindy: %s" % opt, pkg="index") for mod in self.modules: cmd.extend(["--module", mod]) if self.lang: cmd.extend(["--language", self.lang]) cmd.append(self.source) path_var = "XINDY_SEARCHPATH" if self.path != []: env = {path_var: ':'.join(self.path + [os.getenv(path_var, '')])} else: env = {} if self.doc.env.execute(cmd, env): msg.error(_("could not make index %s") % self.target) return False self.doc.must_compile = 1 return True
def post_compile (self): """ Run makeindex if needed, with appropriate options and environment. """ if not os.path.exists(self.source): msg.log(_("strange, there is no %s") % self.source, pkg="index") return True if not self.run_needed(): return True msg.progress(_("processing index %s") % msg.simplify(self.source)) if self.tool == "makeindex": cmd = ["makeindex", "-q", "-o", self.target] + self.opts cmd.extend(["-t", self.transcript]) if self.style: cmd.extend(["-s", self.style]) cmd.append(self.source) path_var = "INDEXSTYLE" elif self.tool == "xindy": cmd = ["texindy", "--quiet"] for opt in self.opts: if opt == "-g": if self.lang != "": msg.warn(_("'language' overrides 'order german'"), pkg="index") else: self.lang = "german-din" elif opt == "-l": self.modules.append("letter-ordering") msg.warn(_("use 'module letter-ordering' instead of 'order letter'"), pkg="index") else: msg.error("unknown option to xindy: %s" % opt, pkg="index") for mod in self.modules: cmd.extend(["--module", mod]) if self.lang: cmd.extend(["--language", self.lang]) cmd.append(self.source) path_var = "XINDY_SEARCHPATH" if self.path != []: env = { path_var: ':'.join(self.path + [os.getenv(path_var, '')]) } else: env = {} if self.doc.env.execute(cmd, env): msg.error(_("could not make index %s") % self.target) return False self.doc.must_compile = 1 return True
def run (self): """ This method actually runs BibTeX with the appropriate environment variables set. """ msg.progress(_("running BibTeX on %s") % msg.simplify(self.base)) doc = {} if len(self.bib_path) != 1: doc["BIBINPUTS"] = string.join(self.bib_path + [os.getenv("BIBINPUTS", "")], os.pathsep) if len(self.bst_path) != 1: doc["BSTINPUTS"] = string.join(self.bst_path + [os.getenv("BSTINPUTS", "")], os.pathsep) if self.crossrefs is None: cmd = ["bibtex"] else: cmd = ["bibtex", "-min-crossrefs=" + self.crossrefs] if self.doc.env.execute(['bibtex', self.base], doc): msg.info(_("There were errors making the bibliography.")) return False self.run_needed = 0 self.doc.must_compile = 1 return True
def run(self): """ This method actually runs BibTeX with the appropriate environment variables set. """ msg.progress(_("running BibTeX on %s") % msg.simplify(self.base)) doc = {} if len(self.bib_path) != 1: doc["BIBINPUTS"] = string.join( self.bib_path + [os.getenv("BIBINPUTS", "")], os.pathsep) if len(self.bst_path) != 1: doc["BSTINPUTS"] = string.join( self.bst_path + [os.getenv("BSTINPUTS", "")], os.pathsep) if self.crossrefs is None: cmd = ["bibtex"] else: cmd = ["bibtex", "-min-crossrefs=" + self.crossrefs] if self.doc.env.execute(['bibtex', self.base], doc): msg.info(_("There were errors making the bibliography.")) return False self.run_needed = 0 self.doc.must_compile = 1 return True