~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to tools/generate_docs.py

  • Committer: Patch Queue Manager
  • Date: 2011-12-19 00:49:48 UTC
  • mfrom: (6379.2.1 lazy-eol-filters)
  • Revision ID: pqm@pqm.ubuntu.com-20111219004948-irl4u0gumo2a4sni
(jelmer) Lazily load bzrlib.filters.eol. (Jelmer Vernooij)

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