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


Python CompsQuery.get方法代码示例

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


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

示例1: _mark_install

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def _mark_install(self, patterns):
        prst = self.base._group_persistor
        q = CompsQuery(self.base.comps, prst,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env_id in res.environments:
            if not dnf.comps.install_or_skip(solver._environment_install,
                                             env_id, types):
                res.environments.remove(env_id)
        for group_id in res.groups:
            if not dnf.comps.install_or_skip(solver._group_install,
                                             group_id, types):
                res.groups.remove(group_id)

        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([prst.environment(g).ui_name
                                  for g in res.environments]))
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([prst.group(g).ui_name for g in res.groups]))
        prst.commit()
开发者ID:rhn,项目名称:dnf,代码行数:28,代码来源:group.py

示例2: _mark_install

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        def install_or_skip(install_fnc, grp_or_env):
            for grp in grp_or_env:
                try:
                    install_fnc(grp, types, None)
                except dnf.comps.CompsError as e:
                    logger.warning("%s, %s", str(e)[:-1], _("skipping."))
                    grp_or_env.remove(grp)

        install_or_skip(solver.environment_install, res.environments)
        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([g.ui_name for g in res.environments]))
        install_or_skip(solver.group_install, res.groups)
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([g.ui_name for g in res.groups]))
        persistor.commit()
开发者ID:achernet,项目名称:dnf,代码行数:28,代码来源:group.py

示例3: test_all

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def test_all(self):
        status_all = CompsQuery.AVAILABLE | CompsQuery.INSTALLED
        kinds_all = CompsQuery.ENVIRONMENTS | CompsQuery.GROUPS
        q = CompsQuery(self.comps, self.persistor, kinds_all, status_all)

        res = q.get('sugar*', '*er*')
        self.assertCountEqual(res.environments,
                              ('sugar-desktop-environment',))
        self.assertCountEqual(res.groups, ("Peppers", 'somerset'))
开发者ID:mavit,项目名称:dnf,代码行数:11,代码来源:test_group.py

示例4: _upgrade

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
 def _upgrade(self, patterns):
     q = CompsQuery(self.base.comps, self.base.group_persistor, CompsQuery.GROUPS, CompsQuery.INSTALLED)
     res = q.get(*patterns)
     cnt = 0
     for grp in res.groups:
         cnt += self.base.group_upgrade(grp)
     if not cnt:
         msg = _("No packages marked for upgrade.")
         raise dnf.cli.CliError(msg)
开发者ID:gekoraus,项目名称:dnf,代码行数:11,代码来源:group.py

示例5: test_all

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def test_all(self):
        status_all = CompsQuery.AVAILABLE | CompsQuery.INSTALLED
        kinds_all = CompsQuery.ENVIRONMENTS | CompsQuery.GROUPS
        q = CompsQuery(self.comps, self.prst, kinds_all, status_all)

        res = q.get('sugar*', '*er*')
        self.assertCountEqual(names(res.environments),
                              ('Sugar Desktop Environment',))
        self.assertCountEqual(names(res.groups), ("Pepper's", 'Solid Ground'))
开发者ID:Aftermath,项目名称:dnf,代码行数:11,代码来源:test_group.py

示例6: test_installed

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
 def test_installed(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.GROUPS,
                    CompsQuery.INSTALLED)
     self.base.read_mock_comps(False)
     grp = self.base.comps.group_by_pattern('somerset')
     self.base.group_install(grp.id, ('mandatory',))
     res = q.get('somerset')
     self.assertEmpty(res.environments)
     grp_ids = [grp.name_id for grp in res.groups]
     self.assertCountEqual(grp_ids, ('somerset',))
开发者ID:edynox,项目名称:dnf,代码行数:12,代码来源:test_group.py

示例7: test_installed

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def test_installed(self):
        q = CompsQuery(self.comps, self.history, CompsQuery.GROUPS,
                       CompsQuery.INSTALLED)
        self.base.read_mock_comps(False)
        grp = self.base.comps.group_by_pattern('somerset')
        self.base.group_install(grp.id, ('mandatory',))

        self._swdb_commit()

        res = q.get('somerset')
        self.assertEmpty(res.environments)
        grp_ids = list(res.groups)
        self.assertCountEqual(grp_ids, ('somerset',))
开发者ID:rpm-software-management,项目名称:dnf,代码行数:15,代码来源:test_group.py

示例8: _mark_remove

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def _mark_remove(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor, CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS, CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        for env in res.environments:
            solver.environment_remove(env)
        for grp in res.groups:
            solver.group_remove(grp)

        if res.environments:
            logger.info(_("Environments marked removed: %s"), ",".join([g.ui_name for g in res.environments]))
        if res.groups:
            logger.info(_("Groups marked removed: %s"), ",".join([g.ui_name for g in res.groups]))
        persistor.commit()
开发者ID:gekoraus,项目名称:dnf,代码行数:17,代码来源:group.py

示例9: _mark_install

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        dnf.comps.install_or_skip(solver.environment_install,
                                  res.environments, types)
        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([g.ui_name for g in res.environments]))
        dnf.comps.install_or_skip(solver.group_install, res.groups, types)
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([g.ui_name for g in res.groups]))
        persistor.commit()
开发者ID:Aftermath,项目名称:dnf,代码行数:21,代码来源:group.py

示例10: _mark_remove

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def _mark_remove(self, patterns):
        prst = self.base._group_persistor
        q = CompsQuery(self.base.comps, prst,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        for env_id in res.environments:
            solver._environment_remove(env_id)
        for grp_id in res.groups:
            solver._group_remove(grp_id)

        if res.environments:
            logger.info(_('Environments marked removed: %s'),
                        ','.join([prst.environment(e_id).ui_name
                                  for e_id in res.environments]))
        if res.groups:
            logger.info(_('Groups marked removed: %s'),
                        ','.join([prst.group(g_id).ui_name
                                  for g_id in res.groups]))
        prst.commit()
开发者ID:rhn,项目名称:dnf,代码行数:23,代码来源:group.py

示例11: _mark_install

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(
            self.base.comps,
            persistor,
            CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
            CompsQuery.AVAILABLE | CompsQuery.INSTALLED,
        )
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env in res.environments:
            if not dnf.comps.install_or_skip(solver.environment_install, env, types):
                res.environments.remove(env)
        for group in res.groups:
            if not dnf.comps.install_or_skip(solver.group_install, group, types):
                res.groups.remove(group)

        if res.environments:
            logger.info(_("Environments marked installed: %s"), ",".join([g.ui_name for g in res.environments]))
        if res.groups:
            logger.info(_("Groups marked installed: %s"), ",".join([g.ui_name for g in res.groups]))
        persistor.commit()
开发者ID:gekoraus,项目名称:dnf,代码行数:26,代码来源:group.py

示例12: test_err

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
 def test_err(self):
     q = CompsQuery(self.comps, self.persistor, CompsQuery.ENVIRONMENTS,
                    CompsQuery.AVAILABLE)
     with self.assertRaises(dnf.exceptions.CompsError):
         q.get('*er*')
开发者ID:mavit,项目名称:dnf,代码行数:7,代码来源:test_group.py

示例13: test_installed

# 需要导入模块: from dnf.comps import CompsQuery [as 别名]
# 或者: from dnf.comps.CompsQuery import get [as 别名]
 def test_installed(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.GROUPS,
                    CompsQuery.INSTALLED)
     res = q.get('somerset')
     self.assertEmpty(res.environments)
     self.assertCountEqual(res.groups, ('somerset',))
开发者ID:gbraad,项目名称:dnf,代码行数:8,代码来源:test_group.py


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