~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/generate_docs.py

  • Committer: Vincent Ladeuil
  • Date: 2012-03-13 17:25:29 UTC
  • mfrom: (6499 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6501.
  • Revision ID: v.ladeuil+lp@free.fr-20120313172529-i0suyjnepsor25i7
Merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
40
40
 
41
 
from bzrlib import commands, doc_generate
 
41
import bzrlib
 
42
from bzrlib import (
 
43
    commands,
 
44
    doc_generate,
 
45
    )
 
46
 
42
47
 
43
48
def main(argv):
44
49
    parser = OptionParser(usage="""%prog [options] OUTPUT_FORMAT
71
76
        parser.print_help()
72
77
        sys.exit(1)
73
78
 
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)
 
79
    with bzrlib.initialize():
 
80
        commands.install_bzr_command_hooks()
 
81
        infogen_type = args[1]
 
82
        infogen_mod = doc_generate.get_module(infogen_type)
 
83
        if options.filename:
 
84
            outfilename = options.filename
 
85
        else:
 
86
            outfilename = infogen_mod.get_filename(options)
 
87
        if outfilename == "-":
 
88
            outfile = sys.stdout
 
89
        else:
 
90
            outfile = open(outfilename,"w")
 
91
        if options.show_filename and (outfilename != "-"):
 
92
            sys.stdout.write(outfilename)
 
93
            sys.stdout.write('\n')
 
94
        infogen_mod.infogen(options, outfile)
 
95
 
94
96
 
95
97
def print_extended_help(option, opt, value, parser):
96
98
    """ Program help examples