/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 breezy/plugin.py

  • Committer: Jelmer Vernooij
  • Date: 2020-07-05 12:50:01 UTC
  • mfrom: (7490.40.46 work)
  • mto: (7490.40.48 work)
  • mto: This revision was merged to the branch mainline in revision 7519.
  • Revision ID: jelmer@jelmer.uk-20200705125001-7s3vo0p55szbbws7
Merge lp:brz/3.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
plugins.
35
35
"""
36
36
 
 
37
from __future__ import absolute_import
 
38
 
37
39
import os
38
40
import re
39
41
import sys
61
63
 
62
64
_MODULE_PREFIX = "breezy.plugins."
63
65
 
64
 
COMPILED_EXT = ".pyc"
 
66
if __debug__ or sys.version_info > (3,):
 
67
    COMPILED_EXT = ".pyc"
 
68
else:
 
69
    COMPILED_EXT = ".pyo"
65
70
 
66
71
 
67
72
def disable_plugins(state=None):
76
81
    state.plugins = {}
77
82
 
78
83
 
79
 
def load_plugins(path=None, state=None, warn_load_problems=True):
 
84
def load_plugins(path=None, state=None):
80
85
    """Load breezy plugins.
81
86
 
82
87
    The environment variable BRZ_PLUGIN_PATH is considered a delimited
103
108
    if (None, 'entrypoints') in _env_plugin_path():
104
109
        _load_plugins_from_entrypoints(state)
105
110
    state.plugins = plugins()
106
 
    if warn_load_problems:
107
 
        for plugin, errors in state.plugin_warnings.items():
108
 
            for error in errors:
109
 
                trace.warning('%s', error)
110
111
 
111
112
 
112
113
def _load_plugins_from_entrypoints(state):
193
194
def _env_disable_plugins(key='BRZ_DISABLE_PLUGINS'):
194
195
    """Gives list of names for plugins to disable from environ key."""
195
196
    disabled_names = []
196
 
    env = os.environ.get(key)
 
197
    env = osutils.path_from_environ(key)
197
198
    if env:
198
199
        for name in env.split(os.pathsep):
199
200
            name = _expect_identifier(name, key, env)
205
206
def _env_plugins_at(key='BRZ_PLUGINS_AT'):
206
207
    """Gives list of names and paths of specific plugins from environ key."""
207
208
    plugin_details = []
208
 
    env = os.environ.get(key)
 
209
    env = osutils.path_from_environ(key)
209
210
    if env:
210
211
        for pair in env.split(os.pathsep):
211
212
            if '@' in pair:
226
227
    'path', or None and one of the values 'user', 'core', 'entrypoints', 'site'.
227
228
    """
228
229
    path_details = []
229
 
    env = os.environ.get(key)
 
230
    env = osutils.path_from_environ(key)
230
231
    defaults = {
231
232
        "user": not env,
232
233
        "core": True,