Ejemplo n.º 1
0
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."
Ejemplo n.º 2
0
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."
Ejemplo n.º 3
0
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)
Ejemplo n.º 5
0
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."
Ejemplo n.º 6
0
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."