def run (self): msg.progress(_("running %s") % self.cmd[0]) rc = subprocess.call(self.cmd, stdout=msg.stdout) if rc != 0: msg.error(_("execution of %s failed") % self.cmd[0]) return 1 return 0
def run(self): cmd = [self.cmdexec] msg.progress(_("running %s on %s") % (cmd[0], self.source)) for opt in self.doc.paper.split(): cmd.extend(["-t", opt]) cmd.extend(self.options + ["-o", self.target, self.source]) msg.debug(" ".join(cmd)) rc = subprocess.call(cmd, stdout=msg.stdout) if rc != 0: msg.error(_("%s failed on %s") % (cmd[0], self.source)) return 1 return 0
def run (self): cmd = [self.cmdexec] msg.progress(_("running %s on %s") % (cmd[0], self.source)) for opt in self.doc.paper.split(): cmd.extend(["-t", opt]) cmd.extend(self.options + ["-o", self.target, self.source]) msg.debug(" ".join(cmd)) rc = subprocess.call(cmd, stdout=msg.stdout) if rc != 0: msg.error(_("%s failed on %s") % (cmd[0], self.source)) return 1 return 0
def run (self): """ This method actually runs BibTeX with the appropriate environment variables set. """ msg.progress(_("running BibTeX on %s") % self.base) doc = {} if len(self.bib_path) != 1: os.environ["BIBINPUTS"] = string.join(self.bib_path + [os.getenv("BIBINPUTS", "")], ":") if len(self.bst_path) != 1: os.environ["BSTINPUTS"] = string.join(self.bst_path + [os.getenv("BSTINPUTS", "")], ":") rc = subprocess.call(["bibtex", self.base], stdout=msg.stdout) if rc != 0: msg.error(_("There were errors making the bibliography.")) return 1 self.run_needed = 0 self.doc.must_compile = 1 return 0
def run(self): """ This method actually runs BibTeX with the appropriate environment variables set. """ msg.progress(_("running BibTeX on %s") % self.base) doc = {} if len(self.bib_path) != 1: os.environ["BIBINPUTS"] = string.join( self.bib_path + [os.getenv("BIBINPUTS", "")], ":") if len(self.bst_path) != 1: os.environ["BSTINPUTS"] = string.join( self.bst_path + [os.getenv("BSTINPUTS", "")], ":") rc = subprocess.call(["bibtex", self.base], stdout=msg.stdout) if rc != 0: msg.error(_("There were errors making the bibliography.")) return 1 self.run_needed = 0 self.doc.must_compile = 1 return 0
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 0 if not self.run_needed(): return 0 msg.progress(_("processing index %s") % self.source) if self.tool == "makeindex": cmd = ["makeindex", "-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: string.join(self.path + [os.getenv(path_var, "")], ":") } else: env = {} msg.debug(" ".join(cmd)) # Makeindex outputs everything to stderr, even progress messages rc = subprocess.call(cmd, stderr=msg.stdout) if (rc != 0): msg.error(_("could not make index %s") % self.target) return 1 # Beware with UTF-8 encoding, makeindex with headings can be messy if self.doc.encoding == "utf8" and self.style: f = file(self.target, "r") error = 0 for line in f: try: line.decode("utf8") except: error = 1 break f.close() if error: print "here" # Retry without style msg.log(_("%s on UTF8 failed. Retry...") % self.tool) self.style = "" self.md5 = None return self.post_compile() self.doc.must_compile = 1 return 0