def make_compare_entry(ifile, device, dpi, band): ofile = "%s.%s.%d.%d" % (ifile, device, dpi, band) print "creating entry: " + ofile + "...", sys.stdout.flush() gs = gstestgs.Ghostscript() gs.log_stdout = gsconf.log_stdout gs.log_stderr = gsconf.log_stderr gs.command = gsconf.baselinegs gs.infile = gsconf.comparefiledir + ifile gs.outfile = ofile gs.device = device gs.dpi = dpi gs.band = band if not gssum.exists(ofile): if gs.process(): try: gssum.add_file(ofile) rasterdb.put_file(ofile) os.unlink(ofile) print "done." except OSError: print "no output produced." else: print "error." else: print "exists."
def make_compare_entry(dbname,ifile, device, dpi, band): ofile = "%s.%s.%d.%d" % (ifile, device, dpi, band) print "creating entry: " + ofile + "...", sys.stdout.flush() gs = gstestgs.Ghostscript() gs.gsroot = gsconf.gsroot gs.log_stdout = gsconf.gs_stdout gs.log_stderr = gsconf.gs_stderr gs.command = gsconf.headinstallpath gs.infile = gsconf.comparefiledir + ifile gs.outfile = ofile gs.device = device gs.dpi = dpi gs.band = band if not gssum.exists(ofile,dbname): if gs.process(): try: gssum.add_file(ofile,dbname) rasterdb.put_file(ofile) os.unlink(ofile) print "done." except OSError: print "no output produced." else: print "error." else: print "exists."
def update_databases(outputfile, device, dpi, band, revision, options): log = open(gsconf.baseline_log, "a") outputdevice = " ".join((device, str(dpi), str(band))) message = time.ctime( ) + " " + testfile + " " + outputdevice + " updated " + revision if options and options.dryrun: print "dryrun", message else: log.write(message + "\n") log.close() baselinedb = gsconf.baselinedb if options and options.dryrun: pass else: gssum.add_file(outputfile, baselinedb) if options and options.dryrun: pass else: rasterdb.put_file(outputfile) if not options.nocleanup: os.unlink(outputfile)
def update_databases(outputfile,device,dpi,band,revision,options): log = open(gsconf.baseline_log, "a") outputdevice=" ".join((device,str(dpi),str(band))) message=time.ctime() + " " + testfile +" "+outputdevice+ " updated "+revision if options and options.dryrun: print "dryrun",message else: log.write(message+"\n") log.close() baselinedb=gsconf.baselinedb if options and options.dryrun: pass else: gssum.add_file(outputfile,baselinedb) if options and options.dryrun: pass else: rasterdb.put_file(outputfile) if not options.nocleanup: os.unlink(outputfile)
def make_pdfcompare_entry(dbname, ifile, device, dpi, band): ofile = "%s.pdf.%s.%d.%d" % (ifile, device, dpi, band) print "creating entry: " + ofile + "...", sys.stdout.flush() if gssum.exists(ofile, dbname): print "exists." return gs = gstestgs.Ghostscript() gs.gsroot = gsconf.gsroot gs.log_stdout = gsconf.gs_stdout gs.log_stderr = gsconf.gs_stderr gs.command = gsconf.headinstallpath gs.infile = gsconf.comparefiledir + ifile gs.dpi = dpi gs.band = band # make file->PDF tfile = ofile + ".pdf" gs.outfile = tfile gs.device = 'pdfwrite' gs.dpi = None if not gs.process(): print "error." return gs.infile = tfile gs.outfile = ofile gs.device = device gs.dpi = dpi if gs.process(): try: gssum.add_file(ofile, dbname) rasterdb.put_file(ofile) os.unlink(tfile) os.unlink(ofile) print "done." except OSError: print "no output produced." else: print "error."
def make_pdfcompare_entry(ifile, device, dpi, band): ofile = "%s.pdf.%s.%d.%d" % (ifile, device, dpi, band) print "creating entry: " + ofile + "...", sys.stdout.flush() if gssum.exists(ofile): print "exists." return gs = gstestgs.Ghostscript() gs.log_stdout = gsconf.log_stdout gs.log_stderr = gsconf.log_stderr gs.command = gsconf.baselinegs gs.infile = gsconf.comparefiledir + ifile gs.dpi = dpi gs.band = band # make file->PDF tfile = ofile + ".pdf" gs.outfile = tfile gs.device = "pdfwrite" gs.dpi = None if not gs.process(): print "error." return gs.infile = tfile gs.outfile = ofile gs.device = device gs.dpi = dpi if gs.process(): try: gssum.add_file(ofile) rasterdb.put_file(ofile) os.unlink(tfile) os.unlink(ofile) print "done." except OSError: print "no output produced." else: print "error."