|
[Rivet-svn] r3009 - in trunk: . binblackhole at projects.hepforge.org blackhole at projects.hepforge.orgTue Mar 8 23:04:17 GMT 2011
Author: buckley Date: Tue Mar 8 23:04:16 2011 New Revision: 3009 Log: Adding some extra checks for external packages in make-plots. Modified: trunk/ChangeLog trunk/bin/make-plots Modified: trunk/ChangeLog ============================================================================== --- trunk/ChangeLog Mon Mar 7 15:40:30 2011 (r3008) +++ trunk/ChangeLog Tue Mar 8 23:04:16 2011 (r3009) @@ -1,3 +1,7 @@ +2011-03-08 Andy Buckley <andy at insectnation.org> + + * Adding some extra checks for external packages in make-plots. + 2011-03-07 Andy Buckley <andy at insectnation.org> * Changing the accuracy of the beam energy checking to 1%, to make Modified: trunk/bin/make-plots ============================================================================== --- trunk/bin/make-plots Mon Mar 7 15:40:30 2011 (r3008) +++ trunk/bin/make-plots Tue Mar 8 23:04:16 2011 (r3009) @@ -1778,7 +1778,10 @@ ## Handle Minion Font if opts.OUTPUT_FONT == "MINION": dvcmd.append('-Pminion') + ## Choose format + # TODO: Rationalise this monstrosity! + # TODO: Use a multi-format string and object handler cf. slhaplot (see, SUSY *is* useful...) if opts.OUTPUT_FORMAT == "PS": dvcmd += ["-o", "%s.ps" % filename] logging.debug(" ".join(dvcmd)) @@ -1994,39 +1997,76 @@ logging.error(parser.get_usage()) sys.exit(2) -# ## Test for latex and dvips -# latex/dvips -# ## Test for ps2pdf -# if opts.OUTPUT_FORMAT == "PDF": -# ps2pdf -# ## Test for ps2eps -# if opts.OUTPUT_FORMAT == "EPS": -# ps2eps - - import subprocess - - ## Check minion font - if opts.OUTPUT_FONT == "MINION": - p = subprocess.Popen(["kpsewhich", "minion.sty"], stdout=subprocess.PIPE) - p.wait() - if p.returncode != 0: - logging.warning('Warning: Using "--minion" requires minion.sty to be installed. Ignoring it.') - opts.OUTPUT_FONT = "PALATINO" - - ## Check for HEP LaTeX packages - opts.LATEXPKGS = [] - for pkg in ["hepnicenames", "hepunits", "underscore"]: - p = subprocess.Popen(["kpsewhich", "%s.sty" % pkg], stdout=subprocess.PIPE) - p.wait() - if p.returncode == 0: - opts.LATEXPKGS.append(pkg) - - ## Check for Palatino old style figures and small caps - if opts.OUTPUT_FONT == "PALATINO": - p = subprocess.Popen(["kpsewhich", "ot1pplx.fd"], stdout=subprocess.PIPE) - p.wait() - if p.returncode == 0: - opts.OUTPUT_FONT = "PALATINO_OSF" + + ## Test for external programs (kpsewhich, latex, dvips, ps2pdf/ps2eps, and convert) + if opts.OUTPUT_FORMAT != "TEX": + try: + import subprocess + ## latex + p = subprocess.Popen(["which", "latex"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + rtn = p.wait() + if rtn != 0: + logging.error("ERROR: required program 'latex' could not be found. Exiting...") + sys.exit(1) + ## dvips + p = subprocess.Popen(["which", "dvips"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + rtn = p.wait() + if rtn != 0: + logging.error("ERROR: required program 'dvips' could not be found. Exiting...") + sys.exit(1) + + ## ps2pdf / ps2eps + if "PDF" in opts.OUTPUT_FORMAT: + p = subprocess.Popen(["which", "ps2pdf"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + rtn = p.wait() + if rtn != 0: + logging.error("ERROR: required program 'ps2pdf' (for PDF output) could not be found. Exiting...") + sys.exit(1) + elif "EPS" in opts.OUTPUT_FORMAT: + p = subprocess.Popen(["which", "ps2eps"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + rtn = p.wait() + if rtn != 0: + logging.error("ERROR: required program 'ps2eps' (for EPS output) could not be found. Exiting...") + sys.exit(1) + ## PNG output converter + if "PNG" in opts.OUTPUT_FORMAT: + p = subprocess.Popen(["which", "convert"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + rtn = p.wait() + if rtn != 0: + logging.error("ERROR: required program 'convert' (for PNG output) could not be found. Exiting...") + sys.exit(1) + + ## kpsewhich: required for LaTeX package testing + p = subprocess.Popen(["which", "kpsewhich"], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + rtn = p.wait() + if rtn != 0: + logging.warning("WARNING: required program 'kpsewhich' (for LaTeX package checks) could not be found") + else: + ## Check minion font + if opts.OUTPUT_FONT == "MINION": + p = subprocess.Popen(["kpsewhich", "minion.sty"], stdout=subprocess.PIPE) + p.wait() + if p.returncode != 0: + logging.warning('Warning: Using "--minion" requires minion.sty to be installed. Ignoring it.') + opts.OUTPUT_FONT = "PALATINO" + + ## Check for HEP LaTeX packages + opts.LATEXPKGS = [] + for pkg in ["hepnicenames", "hepunits", "underscore"]: + p = subprocess.Popen(["kpsewhich", "%s.sty" % pkg], stdout=subprocess.PIPE) + p.wait() + if p.returncode == 0: + opts.LATEXPKGS.append(pkg) + + ## Check for Palatino old style figures and small caps + if opts.OUTPUT_FONT == "PALATINO": + p = subprocess.Popen(["kpsewhich", "ot1pplx.fd"], stdout=subprocess.PIPE) + p.wait() + if p.returncode == 0: + opts.OUTPUT_FONT = "PALATINO_OSF" + except Exception, e: + logging.warning("Problem while testing for external packages. I'm going to try and continue without testing, but don't hold your breath...") + ## Fill queue datfiles = Queue.Queue(maxsize=-1)
More information about the Rivet-svn mailing list |