~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to dotgraph.py

  • Committer: Aaron Bentley
  • Date: 2005-09-01 14:11:13 UTC
  • Revision ID: abentley@panoramicfeedback.com-20050901141113-bc37c80383a77aaf
Tweaked missing-dot handling

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
from urllib import urlencode
4
4
from xml.sax.saxutils import escape
5
5
import os.path
 
6
import errno
 
7
 
 
8
class NoDot(Exception):
 
9
    def __init__(self):
 
10
        Exception.__init__(self, "Can't find dot!")
6
11
 
7
12
class Node(object):
8
13
    def __init__(self, name, color=None, label=None, rev_id=None):
70
75
    try:
71
76
        dot_proc = Popen(cmdline, stdin=PIPE)
72
77
    except OSError, e:
73
 
        if e.errno == 2:
74
 
            print "You need 'dot' to create ancestry graphs"
75
 
        return
 
78
        if e.errno == errno.ENOENT:
 
79
            raise NoDot()
 
80
        else:
 
81
            raise
76
82
    for line in input:
77
83
        dot_proc.stdin.write(line)
78
84
    dot_proc.stdin.close()