本文整理汇总了Python中platformio.pkgmanager.PackageManager.uninstall方法的典型用法代码示例。如果您正苦于以下问题:Python PackageManager.uninstall方法的具体用法?Python PackageManager.uninstall怎么用?Python PackageManager.uninstall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类platformio.pkgmanager.PackageManager
的用法示例。
在下文中一共展示了PackageManager.uninstall方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: uninstall
# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import uninstall [as 别名]
def uninstall(self):
platform = self.get_type()
installed_platforms = PlatformFactory.get_platforms(
installed=True).keys()
if platform not in installed_platforms:
raise exception.PlatformNotInstalledYet(platform)
deppkgs = set()
for item in installed_platforms:
if item == platform:
continue
p = PlatformFactory.newPlatform(item)
deppkgs = deppkgs.union(set(p.get_packages().keys()))
pm = PackageManager()
for name in self.get_packages().keys():
if not pm.is_installed(name) or name in deppkgs:
continue
pm.uninstall(name)
# unregister installed platform
installed_platforms.remove(platform)
set_state_item("installed_platforms", installed_platforms)
return True
示例2: uninstall
# 需要导入模块: from platformio.pkgmanager import PackageManager [as 别名]
# 或者: from platformio.pkgmanager.PackageManager import uninstall [as 别名]
def uninstall(self):
platform = self.get_name()
pm = PackageManager(platform)
for package, data in pm.get_installed(platform).items():
pm.uninstall(package, data['path'])
pm.unregister_platform(platform)
rmtree(pm.get_platform_dir())
return True