diff --git a/pyreport/main.py b/pyreport/main.py index 65704bf..9f0d4dc 100644 --- a/pyreport/main.py +++ b/pyreport/main.py @@ -518,10 +518,12 @@ def tex2pdf(filename, options): print "Doing pdf %s" % filename execute("epstopdf %s.eps" % filename) - safe_unlink(filename+".tex") - safe_unlink(filename+".log") - safe_unlink(filename+".aux") - safe_unlink(filename+".out") + # clean up temporary files + if options.cleanup: + safe_unlink(filename+".tex") + safe_unlink(filename+".log") + safe_unlink(filename+".aux") + safe_unlink(filename+".out") def epstopdf(figure_name): @@ -1063,8 +1065,11 @@ def compile2pdf(self, output_list, fileobject, options): self.compile2tex( output_list, fileobject, options) fileobject.close() tex2pdf(options.outfilename, options) - map(safe_unlink, self.figure_list) - self.figure_list = () + + # clean up stuff + if options.cleanup: + map(safe_unlink, self.figure_list) + self.figure_list = () compilers = { diff --git a/pyreport/options.py b/pyreport/options.py index 9805ccd..fa41377 100644 --- a/pyreport/options.py +++ b/pyreport/options.py @@ -118,6 +118,9 @@ def verbose_execute(string): dest="silent",action="store_true", default=False, help="""Suppress the display of warning and errors in the report""") +option_parser.add_option("--noclean", + action="store_false", dest="cleanup", default=True, + help="don't clean temporary files (e.g. image files and tex file)") option_parser.add_option( "--noecho", dest="noecho",action="store_true", default=False,