~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/export_pot.py

  • Committer: Vincent Ladeuil
  • Date: 2011-09-29 15:50:58 UTC
  • mfrom: (6177 +trunk)
  • mto: This revision was merged to the branch mainline in revision 6178.
  • Revision ID: v.ladeuil+lp@free.fr-20110929155058-zgbecmx1huzktegm
Merge trunk and resolve conflicts

Show diffs side-by-side

added added

removed removed

Lines of Context:
169
169
    _command_options(outf, path, cmd)
170
170
 
171
171
 
172
 
def _command_helps(outf):
 
172
def _command_helps(outf, plugin_name=None):
173
173
    """Extract docstrings from path.
174
174
 
175
175
    This respects the Bazaar cmdtable/table convention and will
182
182
        command = _mod_commands.get_cmd_object(cmd_name, False)
183
183
        if command.hidden:
184
184
            continue
 
185
        if plugin_name is not None:
 
186
            # only export builtins if we are not exporting plugin commands
 
187
            continue
185
188
        note(gettext("Exporting messages from builtin command: %s"), cmd_name)
186
189
        _write_command_help(outf, command)
187
190
 
189
192
    core_plugins = glob(plugin_path + '/*/__init__.py')
190
193
    core_plugins = [os.path.basename(os.path.dirname(p))
191
194
                        for p in core_plugins]
192
 
    # core plugins
 
195
    # plugins
193
196
    for cmd_name in _mod_commands.plugin_command_names():
194
197
        command = _mod_commands.get_cmd_object(cmd_name, False)
195
198
        if command.hidden:
196
199
            continue
197
 
        if command.plugin_name() not in core_plugins:
 
200
        if plugin_name is not None and command.plugin_name() != plugin_name:
 
201
            # if we are exporting plugin commands, skip plugins we have not specified.
 
202
            continue
 
203
        if plugin_name is None and command.plugin_name() not in core_plugins:
198
204
            # skip non-core plugins
199
205
            # TODO: Support extracting from third party plugins.
200
206
            continue
246
252
            _poentry(outf, 'dummy/help_topics/'+key+'/summary.txt',
247
253
                     1, summary)
248
254
 
249
 
def export_pot(outf):
 
255
def export_pot(outf, plugin=None):
250
256
    global _FOUND_MSGID
251
257
    _FOUND_MSGID = set()
252
 
    _standard_options(outf)
253
 
    _command_helps(outf)
254
 
    _error_messages(outf)
255
 
    _help_topics(outf)
 
258
    if plugin is None:
 
259
        _standard_options(outf)
 
260
        _command_helps(outf)
 
261
        _error_messages(outf)
 
262
        _help_topics(outf)
 
263
    else:
 
264
        _command_helps(outf, plugin)