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


Python DebPackage.check_conflicts方法代码示例

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


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

示例1: installdeb

# 需要导入模块: from apt.debfile import DebPackage [as 别名]
# 或者: from apt.debfile.DebPackage import check_conflicts [as 别名]
 def installdeb(self, pkg):
     """
     Install the Debian package.
     
     :param pkg: The path to the package to install
     :type  pkg: str
     """
     
     # Get the DebPackage object and the filename
     dpkg     = DebPackage(filename=pkg, cache=self.cache)
     pkg_name = basename(pkg)
         
     # Look for package conflicts
     if not dpkg.check_conflicts():
         self.feedback.block(dpkg.conflicts, 'CONFLICT')
         self.feedback.error('Cannot install package <{0}>, conflicts with:'.format(pkg_name))
         return False
     
     # Get any version in cache
     cache_version = dpkg.compare_to_version_in_cache()
     action        = 'Installed'
     
     # Not installed
     if cache_version == dpkg.VERSION_NONE:
         self.feedback.info('Package <{0}> not installed'.format(pkg_name))
         
     # Upgrading
     if cache_version == dpkg.VERSION_OUTDATED:
         self.feedback.info('Package <{0}> outdated, upgrading'.format(pkg_name))
         action = 'Updated'
         
     # Same version
     if cache_version == dpkg.VERSION_SAME:
         return self.feedback.info('Package <{0}> already installed'.format(pkg_name))
     
     # Installed is newer
     if cache_version == dpkg.VERSION_NEWER:
         return self.feedback.info('Package <{0}> has newer version installed'.format(pkg_name))
         
     # Install the package
     dpkg.install()
     self.feedback.success('{0}: {1}'.format(action, pkg_name))
开发者ID:pombredanne,项目名称:lense-devtools,代码行数:44,代码来源:dpkg.py


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