~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr-man.py

  • Committer: Aaron Bentley
  • Date: 2005-09-29 21:07:17 UTC
  • mfrom: (1393.1.6)
  • mto: (1185.25.1)
  • mto: This revision was merged to the branch mainline in revision 1419.
  • Revision ID: abentley@panoramicfeedback.com-20050929210717-cd73981590f17017
Merged the weave changes

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
    print >>sys.stderr, "bzr-man.py: error: cannot find a suitable python interpreter"
43
43
    print >>sys.stderr, "  (need %d.%d or later)" % NEED_VERS
44
44
    sys.exit(1)
45
 
os.unsetenv(REINVOKE)
 
45
if hasattr(os, "unsetenv"):
 
46
    os.unsetenv(REINVOKE)
46
47
 
47
48
import bzrlib, bzrlib.help
48
49
 
90
91
 
91
92
    def parse_line(self, line):
92
93
        m = self.usage_exp.match(line)
 
94
        if line == '':
 
95
                return
93
96
        if m:
94
97
            if self.state == 0:
95
98
                if self.usage:
96
99
                    self.command_usage.append((self.command,self.usage,self.descr))
97
100
                    self.all_commands.append(self.command)
98
 
                self.usage = line
 
101
                self.usage = " ".join(line.split(" ")[1:])
99
102
                self.command = m.groups()[0]
100
103
            else:
101
 
                raise Error, "matching usage line in state %d" % state
 
104
                raise RuntimeError, "matching usage line in state %d" % state
102
105
            self.state = 1
103
106
            return
104
107
        m = self.descr_exp.match(line)
106
109
            if self.state == 1:
107
110
                self.descr = m.groups()[0]
108
111
            else:
109
 
                raise Error, "matching descr line in state %d" % state
 
112
                raise RuntimeError, "matching descr line in state %d" % state
110
113
            self.state = 0
111
114
            return
112
 
        raise Error, "Cannot parse this line"
 
115
        raise RuntimeError, "Cannot parse this line ('%s')." % line
113
116
 
114
117
    def end_parse(self):
115
118
        if self.state == 0:
117
120
                self.command_usage.append((self.command,self.usage,self.descr))
118
121
                self.all_commands.append(self.command)
119
122
        else:
120
 
            raise Error, "ending parse in state %d" % state
 
123
            raise RuntimeError, "ending parse in state %d" % state
121
124
 
122
125
    def write_to_manpage(self, outfile):
123
126
        bzrcmd = self.params["bzrcmd"]