94
def _append_new_path(paths, new_path):
95
"""Append a new path if it set and not already known."""
96
if new_path is not None and new_path not in paths:
97
paths.append(new_path)
101
def get_core_plugin_path():
103
bzr_exe = bool(getattr(sys, 'frozen', None))
104
if bzr_exe: # expand path for bzr.exe
105
# We need to use relative path to system-wide plugin
106
# directory because bzrlib from standalone bzr.exe
107
# could be imported by another standalone program
108
# (e.g. bzr-config; or TortoiseBzr/Olive if/when they
109
# will become standalone exe). [bialix 20071123]
110
# __file__ typically is
111
# C:\Program Files\Bazaar\lib\library.zip\bzrlib\plugin.pyc
112
# then plugins directory is
113
# C:\Program Files\Bazaar\plugins
114
# so relative path is ../../../plugins
115
core_path = osutils.abspath(osutils.pathjoin(
116
osutils.dirname(__file__), '../../../plugins'))
117
else: # don't look inside library.zip
118
# search the plugin path before the bzrlib installed dir
119
core_path = os.path.dirname(_mod_plugins.__file__)
123
def get_site_plugin_path():
124
"""Returns the path for the site installed plugins."""
127
from distutils.sysconfig import get_python_lib
129
# If distutuils is not available, we just don't know where they are
132
site_path = osutils.pathjoin(get_python_lib(), 'bzrlib', 'plugins')
136
def get_user_plugin_path():
137
return osutils.pathjoin(config.config_dir(), 'plugins')
94
140
def get_standard_plugins_path():
95
141
"""Determine a plugin path suitable for general use."""
96
142
path = os.environ.get('BZR_PLUGIN_PATH',