當前位置: 首頁>>代碼示例>>Python>>正文


Python comps.CompsQuery類代碼示例

本文整理匯總了Python中dnf.comps.CompsQuery的典型用法代碼示例。如果您正苦於以下問題:Python CompsQuery類的具體用法?Python CompsQuery怎麽用?Python CompsQuery使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了CompsQuery類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _mark_install

    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,代碼行數:26,代碼來源:group.py

示例2: _mark_install

    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,代碼行數:26,代碼來源:group.py

示例3: test_all

    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,代碼行數:9,代碼來源:test_group.py

示例4: _upgrade

 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,代碼行數:9,代碼來源:group.py

示例5: test_all

    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,代碼行數:9,代碼來源:test_group.py

示例6: test_installed

 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,代碼行數:10,代碼來源:test_group.py

示例7: test_installed

    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,代碼行數:13,代碼來源:test_group.py

示例8: _mark_remove

    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,代碼行數:15,代碼來源:group.py

示例9: _mark_install

    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,代碼行數:19,代碼來源:group.py

示例10: _mark_remove

    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,代碼行數:21,代碼來源:group.py

示例11: _mark_install

    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,代碼行數:24,代碼來源:group.py

示例12: test_err

 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,代碼行數:5,代碼來源:test_group.py

示例13: test_installed

 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,代碼行數:6,代碼來源:test_group.py


注:本文中的dnf.comps.CompsQuery類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。