当前位置: 首页>>代码示例>>Python>>正文


Python LibraryManager.get_info方法代码示例

本文整理汇总了Python中platformio.libmanager.LibraryManager.get_info方法的典型用法代码示例。如果您正苦于以下问题:Python LibraryManager.get_info方法的具体用法?Python LibraryManager.get_info怎么用?Python LibraryManager.get_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在platformio.libmanager.LibraryManager的用法示例。


在下文中一共展示了LibraryManager.get_info方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: lib_update

# 需要导入模块: from platformio.libmanager import LibraryManager [as 别名]
# 或者: from platformio.libmanager.LibraryManager import get_info [as 别名]
def lib_update(ctx, libid):
    lm = LibraryManager()
    for id_, latest_version in (lm.get_latest_versions() or {}).items():
        if libid and int(id_) not in libid:
            continue

        info = lm.get_info(int(id_))

        click.echo("Updating [ %s ] %s library:" % (
            click.style(id_, fg="yellow"),
            click.style(info['name'], fg="cyan")))

        current_version = info['version']
        if latest_version is None:
            click.secho("Unknown library", fg="red")
            continue

        click.echo("Versions: Current=%s, Latest=%s \t " % (
            current_version, latest_version), nl=False)

        if current_version == latest_version:
            click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
            continue
        else:
            click.echo("[%s]" % (click.style("Out-of-date", fg="red")))

        ctx.invoke(lib_uninstall, libid=[int(id_)])
        ctx.invoke(lib_install, libid=[int(id_)])
开发者ID:DamnedScholar,项目名称:platformio,代码行数:30,代码来源:lib.py

示例2: lib_show

# 需要导入模块: from platformio.libmanager import LibraryManager [as 别名]
# 或者: from platformio.libmanager.LibraryManager import get_info [as 别名]
def lib_show(libid):
    lm = LibraryManager()
    info = lm.get_info(libid)
    click.secho(info['name'], fg="cyan")
    click.echo("-" * len(info['name']))

    _authors = []
    for author in info['authors']:
        _data = []
        for key in ("name", "email", "url", "maintainer"):
            if not author[key]:
                continue
            if key == "email":
                _data.append("<%s>" % author[key])
            elif key == "maintainer":
                _data.append("(maintainer)")
            else:
                _data.append(author[key])
        _authors.append(" ".join(_data))
    click.echo("Authors: %s" % ", ".join(_authors))

    click.echo("Keywords: %s" % ", ".join(info['keywords']))
    if "frameworks" in info:
        click.echo("Frameworks: %s" % ", ".join(info['frameworks']))
    if "platforms" in info:
        click.echo("Platforms: %s" % ", ".join(info['platforms']))
    click.echo("Version: %s" % info['version'])
    click.echo()
    click.echo(info['description'])
    click.echo()
开发者ID:DamnedScholar,项目名称:platformio,代码行数:32,代码来源:lib.py

示例3: lib_install

# 需要导入模块: from platformio.libmanager import LibraryManager [as 别名]
# 或者: from platformio.libmanager.LibraryManager import get_info [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")
开发者ID:DamnedScholar,项目名称:platformio,代码行数:29,代码来源:lib.py

示例4: lib_uninstall

# 需要导入模块: from platformio.libmanager import LibraryManager [as 别名]
# 或者: from platformio.libmanager.LibraryManager import get_info [as 别名]
def lib_uninstall(libid):
    lm = LibraryManager()
    for id_ in libid:
        info = lm.get_info(id_)
        if lm.uninstall(id_):
            click.secho("The library #%s '%s' has been successfully "
                        "uninstalled!" % (str(id_), info['name']), fg="green")
开发者ID:DamnedScholar,项目名称:platformio,代码行数:9,代码来源:lib.py

示例5: lib_update

# 需要导入模块: from platformio.libmanager import LibraryManager [as 别名]
# 或者: from platformio.libmanager.LibraryManager import get_info [as 别名]
def lib_update():
    lm = LibraryManager(get_lib_dir())

    lib_ids = [str(item['id']) for item in lm.get_installed().values()]
    if not lib_ids:
        return

    versions = get_api_result("/lib/version/" + str(",".join(lib_ids)))
    for id_ in lib_ids:
        info = lm.get_info(int(id_))

        click.echo("Updating  [ %s ] %s library:" % (
            click.style(id_, fg="yellow"),
            click.style(info['name'], fg="cyan")))

        current_version = info['version']
        latest_version = versions[id_]

        if latest_version is None:
            click.secho("Unknown library", fg="red")
            continue

        click.echo("Versions: Current=%s, Latest=%s \t " % (
            current_version, latest_version), nl=False)

        if current_version == latest_version:
            click.echo("[%s]" % (click.style("Up-to-date", fg="green")))
            continue
        else:
            click.echo("[%s]" % (click.style("Out-of-date", fg="red")))

        lib_uninstall([int(id_)])
        lib_install([int(id_)])
开发者ID:bettabacon,项目名称:platformio,代码行数:35,代码来源:lib.py


注:本文中的platformio.libmanager.LibraryManager.get_info方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。