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


Python PackageManager.install方法代码示例

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


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

示例1: install

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import install [as 别名]
    def install(self, with_packages=None, without_packages=None,
                skip_default_packages=False):
        with_packages = set(
            self.pkg_aliases_to_names(with_packages or []))
        without_packages = set(
            self.pkg_aliases_to_names(without_packages or []))

        upkgs = with_packages | without_packages
        ppkgs = set(self.get_packages().keys())
        if not upkgs.issubset(ppkgs):
            raise exception.UnknownPackage(", ".join(upkgs - ppkgs))

        requirements = []
        for name, opts in self.get_packages().items():
            if name in without_packages:
                continue
            elif (name in with_packages or (not skip_default_packages and
                                            opts.get("default"))):
                requirements.append(name)

        pm = PackageManager()
        for name in requirements:
            pm.install(name)

        # register installed platform
        data = get_state_item("installed_platforms", [])
        if self.get_type() not in data:
            data.append(self.get_type())
            set_state_item("installed_platforms", data)

        return len(requirements)
开发者ID:dh1tw,项目名称:platformio,代码行数:33,代码来源:base.py

示例2: install

# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import install [as 别名]
    def install(self, with_packages, without_packages, skip_default_packages):
        with_packages = set(self.pkg_aliases_to_names(with_packages))
        without_packages = set(self.pkg_aliases_to_names(without_packages))

        upkgs = with_packages | without_packages
        ppkgs = set(self.PACKAGES.keys())
        if not upkgs.issubset(ppkgs):
            raise UnknownPackage(", ".join(upkgs - ppkgs))

        requirements = []
        for name, opts in self.PACKAGES.items():
            if name in without_packages:
                continue
            elif (name in with_packages or (not skip_default_packages and
                                            opts['default'])):
                requirements.append((name, opts['path']))

        pm = PackageManager(self.get_name())
        for (package, path) in requirements:
            pm.install(package, path)
        return len(requirements)
开发者ID:bettabacon,项目名称:platformio,代码行数:23,代码来源:base.py


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