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

  • Committer: John Arbash Meinel
  • Date: 2008-10-28 19:39:57 UTC
  • mfrom: (3804 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3805.
  • Revision ID: john@arbash-meinel.com-20081028193957-zg2eygq5cgz2bnpu
Merge bzr.dev 3804

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2004, 2005, 2007 Canonical Ltd
 
1
# Copyright (C) 2004, 2005, 2007, 2008 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
33
33
import os
34
34
import sys
35
35
 
 
36
from bzrlib import osutils
 
37
 
36
38
from bzrlib.lazy_import import lazy_import
 
39
 
37
40
lazy_import(globals(), """
38
41
import imp
39
42
import re
43
46
from bzrlib import (
44
47
    config,
45
48
    debug,
46
 
    osutils,
 
49
    errors,
47
50
    trace,
48
51
    )
49
52
from bzrlib import plugins as _mod_plugins
172
175
 
173
176
 
174
177
def load_from_dir(d):
175
 
    """Load the plugins in directory d."""
 
178
    """Load the plugins in directory d.
 
179
    
 
180
    d must be in the plugins module path already.
 
181
    """
176
182
    # Get the list of valid python suffixes for __init__.py?
177
183
    # this includes .py, .pyc, and .pyo (depending on if we are running -O)
178
184
    # but it doesn't include compiled modules (.so, .dll, etc)
210
216
            exec "import bzrlib.plugins.%s" % name in {}
211
217
        except KeyboardInterrupt:
212
218
            raise
 
219
        except errors.IncompatibleAPI, e:
 
220
            trace.warning("Unable to load plugin %r. It requested API version "
 
221
                "%s of module %s but the minimum exported version is %s, and "
 
222
                "the maximum is %s" %
 
223
                (name, e.wanted, e.api, e.minimum, e.current))
213
224
        except Exception, e:
 
225
            trace.warning("%s" % e)
214
226
            ## import pdb; pdb.set_trace()
215
227
            if re.search('\.|-| ', name):
216
228
                sanitised_name = re.sub('[-. ]', '_', name)