/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to tools/generate_docs.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-07-13 14:31:55 UTC
  • mfrom: (4529.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090713143155-gtc55thzlq7n04jr
(vila) Isolate some tests from TZ

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/usr/bin/python
2
2
 
3
3
# Copyright 2005 Canonical Ltd.
4
 
 
 
4
#
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
7
7
# the Free Software Foundation; either version 2 of the License, or
8
8
# (at your option) any later version.
9
 
 
 
9
#
10
10
# This program is distributed in the hope that it will be useful,
11
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
13
# GNU General Public License for more details.
14
 
 
 
14
#
15
15
# You should have received a copy of the GNU General Public License
16
16
# along with this program; if not, write to the Free Software
17
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 
18
 
18
19
"""%(prog)s - generate information from built-in bzr help
19
20
 
20
21
%(prog)s creates a file with information on bzr in one of
32
33
Run "%(prog)s --help" for the option reference.
33
34
"""
34
35
 
 
36
import bzrlib.commands
35
37
import sys
36
38
from optparse import OptionParser
37
39
 
38
 
import tools.doc_generate
 
40
from bzrlib import doc_generate
39
41
 
40
42
def main(argv):
41
 
    parser = OptionParser(usage="%prog [options] OUTPUT_FORMAT")
 
43
    parser = OptionParser(usage="""%prog [options] OUTPUT_FORMAT
 
44
 
 
45
Available OUTPUT_FORMAT:
 
46
 
 
47
    man              man page
 
48
    rstx             man page in ReStructuredText format
 
49
    bash_completion  bash completion script""")
42
50
 
43
51
    parser.add_option("-s", "--show-filename",
44
52
                      action="store_true", dest="show_filename", default=False,
61
69
    if len(args) != 2:
62
70
        parser.print_help()
63
71
        sys.exit(1)
 
72
    
 
73
    bzrlib.commands.install_bzr_command_hooks()
64
74
 
65
75
    infogen_type = args[1]
66
 
    infogen_mod = tools.doc_generate.get_module(infogen_type)
 
76
    infogen_mod = doc_generate.get_module(infogen_type)
67
77
 
68
78
    if options.filename:
69
79
        outfilename = options.filename
76
86
        outfile = open(outfilename,"w")
77
87
 
78
88
    if options.show_filename and (outfilename != "-"):
79
 
        print >>sys.stdout, outfilename
 
89
        sys.stdout.write(outfilename)
 
90
        sys.stdout.write('\n')
80
91
    
81
92
    infogen_mod.infogen(options, outfile)
82
93
 
86
97
    Prints out the examples stored in the docstring. 
87
98
 
88
99
    """
89
 
    print >>sys.stdout, __doc__ % {"prog":sys.argv[0]}
 
100
    sys.stdout.write(__doc__ % {"prog":sys.argv[0]})
 
101
    sys.stdout.write('\n')
90
102
    sys.exit(0)
91
103
 
92
104
if __name__ == '__main__':