本文整理汇总了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)
示例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)