/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: Jelmer Vernooij
  • Date: 2017-07-23 22:06:41 UTC
  • mfrom: (6738 trunk)
  • mto: This revision was merged to the branch mainline in revision 6739.
  • Revision ID: jelmer@jelmer.uk-20170723220641-69eczax9bmv8d6kk
Merge trunk, address review comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/usr/bin/python3
 
1
#!/usr/bin/python
2
2
 
3
3
# Copyright 2005 Canonical Ltd.
4
4
#
25
25
    bash_completion  bash completion script
26
26
    ...
27
27
 
28
 
Examples:
 
28
Examples: 
29
29
 
30
30
    python generated-docs.py man
31
31
    python generated-docs.py bash_completion
38
38
 
39
39
sys.path.insert(0, os.path.dirname(os.path.dirname(__file__)))
40
40
 
41
 
import breezy
 
41
# Don't remove the following import, it triggers a format registration that
 
42
# avoid http://pad.lv/956860
 
43
import breezy.bzr
42
44
from breezy import (
43
45
    commands,
44
46
    doc_generate,
77
79
        sys.exit(1)
78
80
 
79
81
    with breezy.initialize():
80
 
        # Import breezy.bzr for format registration, see <http://pad.lv/956860>
81
 
        from breezy import bzr as _
82
82
        commands.install_bzr_command_hooks()
83
83
        infogen_type = args[1]
84
84
        infogen_mod = doc_generate.get_module(infogen_type)
89
89
        if outfilename == "-":
90
90
            outfile = sys.stdout
91
91
        else:
92
 
            outfile = open(outfilename, "w")
 
92
            outfile = open(outfilename,"w")
93
93
        if options.show_filename and (outfilename != "-"):
94
94
            sys.stdout.write(outfilename)
95
95
            sys.stdout.write('\n')
99
99
def print_extended_help(option, opt, value, parser):
100
100
    """ Program help examples
101
101
 
102
 
    Prints out the examples stored in the docstring.
 
102
    Prints out the examples stored in the docstring. 
103
103
 
104
104
    """
105
 
    sys.stdout.write(__doc__ % {"prog": sys.argv[0]})
 
105
    sys.stdout.write(__doc__ % {"prog":sys.argv[0]})
106
106
    sys.stdout.write('\n')
107
107
    sys.exit(0)
108
108