~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/plugin.py

  • Committer: Martin Pool
  • Date: 2005-08-12 15:24:19 UTC
  • Revision ID: mbp@sourcefrog.net-20050812152419-8f65f048a739f44d
- add revert command to tutorial

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
    
60
60
    from bzrlib.trace import log_error, mutter, log_exception
61
61
    from bzrlib.errors import BzrError
62
 
    from bzrlib import plugins
63
62
 
64
 
    dirs = os.environ.get('BZR_PLUGIN_PATH', DEFAULT_PLUGIN_PATH).split(":")
65
 
    dirs.insert(0, os.path.dirname(plugins.__file__))
 
63
    bzrpath = os.environ.get('BZR_PLUGIN_PATH', DEFAULT_PLUGIN_PATH)
66
64
 
67
65
    # The problem with imp.get_suffixes() is that it doesn't include
68
66
    # .pyo which is technically valid
72
70
    suffixes = imp.get_suffixes()
73
71
    suffixes.append(('.pyo', 'rb', imp.PY_COMPILED))
74
72
    package_entries = ['__init__.py', '__init__.pyc', '__init__.pyo']
75
 
    for d in dirs:
 
73
    for d in bzrpath.split(os.pathsep):
76
74
        # going through them one by one allows different plugins with the same
77
75
        # filename in different directories in the path
78
76
        mutter('looking for plugins in %s' % d)
116
114
                finally:
117
115
                    if plugin_info[0] is not None:
118
116
                        plugin_info[0].close()
119
 
 
120
 
                mutter('loaded succesfully')
121
 
            except:
 
117
            except Exception, e:
122
118
                log_error('Unable to load plugin %r from %r' % (name, d))
 
119
                log_error(str(e))
123
120
                log_exception()
124
121