Example #1
0
      lno=0
      while True:
        try:
          os.symlink(dest.path+'/'+destport+'(in)',
                     outdir+node.path+'/'+outport+'(out%s%s)'%(lno if lno else '', link=="STAMP" and ' stamps' or ''))
          break
        except OSError,e:
          if e.errno!=errno.EEXIST:
            raise
        lno+=1
      lno=0
      while True:
        try:
          os.symlink(node.path+'/'+outport+'(out)',
                     outdir+dest.path+'/'+destport+'(in%s)'%(lno if lno else ''))
          break
        except OSError,e:
          if e.errno!=errno.EEXIST:
            raise
        lno+=1
      
      



tree=parsetree.parse_net_xml(infile)

nodes_to_fs(tree)

links_to_fs(tree)
Example #2
0
while args:
  a=args.pop(0)
  if a in ('-h','--help'):  usage()
  elif a=='-scalef':        scalef_base=float(args.pop(0))
  elif a=='-scalet':        scalet=True
  elif a=='-merge':         merge=True
  elif not netxml_name:     netxml_name=a
  elif not dot_name:        dot_name=a
  else:
    print >>sys.stderr,"unknown arg "+a
    usage()
 


root=parsetree.parse_net_xml(netxml_name)
dot_file=open(dot_name, "w")

  
# root.pr()

import simplify_tree

if merge: simplify_tree.merge_series(root)

def sanitize(name):
  # make a valid dot identifier
  name=name.replace('/','_')
  name=name.replace('-','_minus_')
  return name