def run_dot(basename,type): dotname = basename + ".dot" outname = basename + "." + type dotchanged = True try: olddot = open(dotname + "~").read() dotchanged = olddot != open(dotname).read() dotchanged = dotchanged or not os.path.exists(outname) except IOError: pass if not dotchanged and type != "png": return print "Generating: ",outname cmd = 'dot -T%(type)s %(dotname)s > %(outname)s' % locals() os.system(cmd) copyfile(dotname,dotname + "~")
def run_dot(basename,type): dotname = basename + ".dot" outname = basename + "." + type dotchanged = True try: olddot = open(dotname + "~").read() dotchanged = olddot != open(dotname).read() dotchanged = dotchanged or not os.path.exists(outname) except IOError: pass if not dotchanged: return print "Generating: ",outname cmd = 'dot -T%(type)s %(dotname)s > %(outname)s' % locals() os.system(cmd) copyfile(dotname,dotname + "~")