/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: Andrew Bennetts
  • Date: 2009-10-21 11:13:40 UTC
  • mto: This revision was merged to the branch mainline in revision 4762.
  • Revision ID: andrew.bennetts@canonical.com-20091021111340-w7x4d5yf83qwjncc
Add test that WSGI glue allows request handlers to access paths above that request's. backing transport, so long as it is within the WSGI app's backing transport.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
 
"""%(prog)s - generate information from built-in brz help
 
19
"""%(prog)s - generate information from built-in bzr help
20
20
 
21
 
%(prog)s creates a file with information on brz in one of
 
21
%(prog)s creates a file with information on bzr in one of
22
22
several different output formats:
23
23
 
24
24
    man              man page
27
27
 
28
28
Examples: 
29
29
 
30
 
    python generated-docs.py man
31
 
    python generated-docs.py bash_completion
 
30
    python2.4 generated-docs.py man
 
31
    python2.4 generated-docs.py bash_completion
32
32
 
33
33
Run "%(prog)s --help" for the option reference.
34
34
"""
38
38
 
39
39
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
40
40
 
41
 
import breezy
42
 
from breezy import (
43
 
    commands,
44
 
    doc_generate,
45
 
    )
46
 
 
 
41
from bzrlib import commands, doc_generate
47
42
 
48
43
def main(argv):
49
44
    parser = OptionParser(usage="""%prog [options] OUTPUT_FORMAT
61
56
    parser.add_option("-o", "--output", dest="filename", metavar="FILE",
62
57
                      help="write output to FILE")
63
58
 
64
 
    parser.add_option("-b", "--brz-name",
65
 
                      dest="brz_name", default="brz", metavar="EXEC_NAME",
66
 
                      help="name of brz executable")
 
59
    parser.add_option("-b", "--bzr-name",
 
60
                      dest="bzr_name", default="bzr", metavar="EXEC_NAME",
 
61
                      help="name of bzr executable")
67
62
 
68
63
    parser.add_option("-e", "--examples",
69
64
                      action="callback", callback=print_extended_help,
76
71
        parser.print_help()
77
72
        sys.exit(1)
78
73
 
79
 
    with breezy.initialize():
80
 
        # Import breezy.bzr for format registration, see <http://pad.lv/956860>
81
 
        from breezy import bzr as _
82
 
        commands.install_bzr_command_hooks()
83
 
        infogen_type = args[1]
84
 
        infogen_mod = doc_generate.get_module(infogen_type)
85
 
        if options.filename:
86
 
            outfilename = options.filename
87
 
        else:
88
 
            outfilename = infogen_mod.get_filename(options)
89
 
        if outfilename == "-":
90
 
            outfile = sys.stdout
91
 
        else:
92
 
            outfile = open(outfilename,"w")
93
 
        if options.show_filename and (outfilename != "-"):
94
 
            sys.stdout.write(outfilename)
95
 
            sys.stdout.write('\n')
96
 
        infogen_mod.infogen(options, outfile)
97
 
 
 
74
    commands.install_bzr_command_hooks()
 
75
 
 
76
    infogen_type = args[1]
 
77
    infogen_mod = doc_generate.get_module(infogen_type)
 
78
 
 
79
    if options.filename:
 
80
        outfilename = options.filename
 
81
    else:
 
82
        outfilename = infogen_mod.get_filename(options)
 
83
 
 
84
    if outfilename == "-":
 
85
        outfile = sys.stdout
 
86
    else:
 
87
        outfile = open(outfilename,"w")
 
88
 
 
89
    if options.show_filename and (outfilename != "-"):
 
90
        sys.stdout.write(outfilename)
 
91
        sys.stdout.write('\n')
 
92
    
 
93
    infogen_mod.infogen(options, outfile)
98
94
 
99
95
def print_extended_help(option, opt, value, parser):
100
96
    """ Program help examples