本文整理汇总了Python中platformio.libmanager.LibraryManager.install方法的典型用法代码示例。如果您正苦于以下问题:Python LibraryManager.install方法的具体用法?Python LibraryManager.install怎么用?Python LibraryManager.install使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类platformio.libmanager.LibraryManager
的用法示例。
在下文中一共展示了LibraryManager.install方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: lib_install
# 需要导入模块: from platformio.libmanager import LibraryManager [as 别名]
# 或者: from platformio.libmanager.LibraryManager import install [as 别名]
def lib_install(ctx, libid, version):
lm = LibraryManager()
for id_ in libid:
click.echo(
"Installing library [ %s ]:" % click.style(str(id_), fg="green"))
try:
if not lm.install(id_, version):
continue
info = lm.get_info(id_)
click.secho(
"The library #%s '%s' has been successfully installed!"
% (str(id_), info['name']), fg="green")
if "dependencies" in info:
click.secho("Installing dependencies:", fg="yellow")
_dependencies = info['dependencies']
if not isinstance(_dependencies, list):
_dependencies = [_dependencies]
for item in _dependencies:
try:
lib_install_dependency(ctx, item)
except AssertionError:
raise exception.LibInstallDependencyError(str(item))
except exception.LibAlreadyInstalled:
click.secho("Already installed", fg="yellow")