~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugin.py

  • Committer: Jelmer Vernooij
  • Date: 2016-04-03 16:32:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6617.
  • Revision ID: jelmer@jelmer.uk-20160403163231-h72bo0uyek2gikw0
Don't put French text in doc/en/user-reference when LANGUAGE=fr_CH.UTF_8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
 
 
18
17
"""bzr python plugin support.
19
18
 
20
19
When load_plugins() is invoked, any python module in any directory in
30
29
called.
31
30
"""
32
31
 
 
32
from __future__ import absolute_import
 
33
 
33
34
import os
34
35
import sys
35
36
 
48
49
    errors,
49
50
    trace,
50
51
    )
 
52
from bzrlib.i18n import gettext
51
53
from bzrlib import plugins as _mod_plugins
52
54
""")
53
55
 
137
139
        try:
138
140
            name, path = spec.split('@')
139
141
        except ValueError:
140
 
            raise errors.BzrCommandError(
141
 
                '"%s" is not a valid <plugin_name>@<plugin_path> description '
 
142
            raise errors.BzrCommandError(gettext(
 
143
                '"%s" is not a valid <plugin_name>@<plugin_path> description ')
142
144
                % spec)
143
145
        specs.append((name, path))
144
146
    return specs
506
508
            result = self.module.__doc__
507
509
        if result[-1] != '\n':
508
510
            result += '\n'
509
 
        # there is code duplicated here and in bzrlib/help_topic.py's
510
 
        # matching Topic code. This should probably be factored in
511
 
        # to a helper function and a common base class.
512
 
        if additional_see_also is not None:
513
 
            see_also = sorted(set(additional_see_also))
514
 
        else:
515
 
            see_also = None
516
 
        if see_also:
517
 
            result += 'See also: '
518
 
            result += ', '.join(see_also)
519
 
            result += '\n'
 
511
        from bzrlib import help_topics
 
512
        result += help_topics._format_see_also(additional_see_also)
520
513
        return result
521
514
 
522
515
    def get_help_topic(self):
523
 
        """Return the modules help topic - its __name__ after bzrlib.plugins.."""
 
516
        """Return the module help topic: its basename."""
524
517
        return self.module.__name__[len('bzrlib.plugins.'):]
525
518
 
526
519
 
639
632
        return None
640
633
 
641
634
    def load_module(self, fullname):
642
 
        """Load a plugin from a specific directory."""
 
635
        """Load a plugin from a specific directory (or file)."""
643
636
        # We are called only for specific paths
644
637
        plugin_path = self.specific_paths[fullname]
645
638
        loading_path = None