以编程方式确定 Bazaar 插件目录
有没有办法以编程方式确定 Bazaar 目录? 如果有一个bazaar命令来确定插件目录,这将是最好的解决方案。
Is there a way to determine the Bazaar directory programmatically?
If there is a bazaar command to determine the plugin directory, this would be the best solution.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
在以下目录中搜索 Bazaar 插件:
您也可以通过
BZR_PLUGIN_PATH
环境变量设置 bazaar 插件目录。有关集市插件的更多信息:http://bazaar-vcs.org/BzrPlugins
Bazaar plugins are searched for in the following directories:
You can set the bazaar plugins directory via
BZR_PLUGIN_PATH
environement variable, also.More on bazaar plugins: http://bazaar-vcs.org/BzrPlugins
根据集市网站,
默认情况下,在
~/.bazaar/plugins
中查找用户插件,但可能会被环境变量BZR_PLUGIN_PATH
覆盖。因此测试该变量是否已设置,否则返回默认值。在 python 中:
编辑:这适用于基于 UNIX 的系统,对于 Windows,使用插件路径是
$APPDATA/bazaar/2.0/plugins
。系统范围的插件位于
bzrlib/plugins
中,请参阅页面下方的安装插件此处< /a>.使用distutils
获取前缀(例如 /usr/lib/python2.4/site-packages/bzrlib/plugins/):(感谢 MYYN 提供其他文档页面)
According to the bazaar website,
user plugins are looked for in
~/.bazaar/plugins
by default, but may be overridden by the environment variableBZR_PLUGIN_PATH
.So test if this variable is set, otherwise return the default. In python:
Edit: this works for unix based systems, for windows the uses plugin path is
$APPDATA/bazaar/2.0/plugins
.The system wide plugin is in
bzrlib/plugins
, see Installing a plugin down the page here. Usedistutils
to get the prefix (e.g. /usr/lib/python2.4/site-packages/bzrlib/plugins/) :(Thanks to The MYYN for providing the other documentation page)
查看
bzr 版本
的Bazaar 配置:
输出。另请参阅bzrlib/version.py
中的函数show_version
。对于配置目录,请使用:
或者,对于用户插件路径(请参阅 bzrlib/plugin.py):
有关插件路径的完整列表:
Have a look at the
Bazaar configuration:
output ofbzr version
. Also see functionshow_version
inbzrlib/version.py
.For the configuration directory use:
Or, for the user plugin path (see
bzrlib/plugin.py
):For a full list of plugin paths:
如果您的系统中安装了 bzr,您可以使用以下 Python 代码片段来获取 bzr 查找插件的目录列表:
If you have bzr installed in your system you can use following Python snippet to get the list of directories where bzr looking for plugins: