示例#1
0
    def compile(self, report_filename):
        prefix = os.path.splitext(report_filename)[0]

        latex_filename = "%s.tex" % prefix
        dvi_filename = "%s.dvi" % prefix
        ps_filename = "%s.ps" % prefix
        pdf_filename = "%s.pdf" % prefix
        out_filename = "%s.out" % prefix
        aux_filename = "%s.aux" % prefix
        log_filename = "%s.log" % prefix

        rosettahelper.writeFile(latex_filename, self.getLaTeXCode())

        for i in range(3):
            self.popen(["latex", "-output-directory", self.outdir, latex_filename], logstdout=True, logstderr=True)
            self.checkFileExists(dvi_filename)
        os.remove(latex_filename)

        self.popen(["dvips", "-Ppdf", dvi_filename], logstdout=True, logstderr=True)
        self.checkFileExists(ps_filename)
        os.remove(dvi_filename)

        self.popen(["ps2pdf", ps_filename])
        self.checkFileExists(pdf_filename)
        os.remove(ps_filename)

        self.PDFReport = rosettahelper.readFile(report_filename)
        self.log("Report saved as %s." % report_filename)

        os.remove(out_filename)
        os.remove(aux_filename)
        os.remove(log_filename)
示例#2
0
 def save(self, filepath):
     rosettahelper.writeFile(filepath, self.getLaTeXCode())