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


Python SoloCommandDescriptor.register方法代码示例

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


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

示例1: _cleanup

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
        try:
            nsargs = parser.parse_args(self._args)
        except IOError as err:
            sys.stderr.write("%s\n" % (err,))
            return parser.print_help, []

        return self._call_exclusive, [self._cleanup]

    def _cleanup(self, entropy_client):
        """
        Solo Cleanup command.
        """
        dirs = [etpConst['logdir'], etpConst['entropyunpackdir']]
        for rel in etpConst['packagesrelativepaths']:
            # backward compatibility, packages are moved to packages/ dir,
            # including nonfree, restricted etc.
            dirs.append(os.path.join(etpConst['entropyworkdir'], rel))
            # new location
            dirs.append(os.path.join(
                    etpConst['entropypackagesworkdir'],
                    rel))
        cleanup(entropy_client, dirs)
        return 0

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloCleanup,
        SoloCleanup.NAME,
        _("remove downloaded packages and clean temp. directories"))
    )
开发者ID:B-Rich,项目名称:entropy,代码行数:32,代码来源:cleanup.py

示例2: teal

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
                back=True)

            file_name = os.path.basename(_file)
            package_path = os.path.join(
                savedir, file_name + ".db")
            ext_rc = entropy.tools.dump_entropy_metadata(
                _file, package_path)
            if not ext_rc:
                entropy_client.output(
                    "%s: %s" % (
                        teal(_("error during metadata extraction")),
                        purple(_file)),
                    header=darkred(" @@ "),
                    level="error", importance=1)
                return 1

            entropy_client.output(
                "%s: %s" % (
                    teal(_("metadata file generated")),
                    purple(package_path)),
                header=darkred(" @@ "))

        return 0

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloPkg,
        SoloPkg.NAME,
        _("execute advanced tasks on packages"))
    )
开发者ID:kpcyrd,项目名称:entropy,代码行数:32,代码来源:pkg.py

示例3: blue

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
                    continue

                key_slot = inst_repo.retrieveKeySlotAggregated(
                    inst_package_id)
                package_id, repository_id = entropy_client.atom_match(key_slot)
                if package_id != -1:
                    valid_matches.add((package_id, repository_id))

        if not valid_matches:
            entropy_client.output(
                "%s." % (
                    blue(_("All the available updates "
                           "have been already installed")),),
                header=darkred(" @@ "))
            return 0

        exit_st, _show_cfgupd = self._install_action(
            entropy_client, True, True,
            pretend, ask, False, quiet, False,
            False, False, fetch, False, False,
            False, 1, [], package_matches=list(valid_matches))
        return exit_st


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloSecurity,
        SoloSecurity.NAME,
        _("system security tools"))
    )
开发者ID:B-Rich,项目名称:entropy,代码行数:32,代码来源:security.py

示例4: blue

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
                    exit_st = pkg.start()
                    if exit_st != 0:
                        if ugc_thread is not None:
                            ugc_thread.join()
                        return 1, True

                finally:
                    if pkg is not None:
                        pkg.finalize()

        finally:
            if notif_acquired:
                notification_lock.release()

        if ugc_thread is not None:
            ugc_thread.join()

        entropy_client.output(
            "%s." % (
                blue(_("Installation complete")),),
            header=darkred(" @@ "))
        return 0, True


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloInstall,
        SoloInstall.NAME,
        _("install or update packages or package files"))
    )
开发者ID:geaaru,项目名称:entropy,代码行数:32,代码来源:install.py

示例5: _

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
                pkg = action_factory.get(
                    action_factory.SOURCE_ACTION,
                    match, opts=metaopts)

                xterm_header = "equo (%s) :: %d of %d ::" % (
                    _("sources download"), count, total)
                pkg.set_xterm_header(xterm_header)

                entropy_client.output(
                    darkgreen(atom),
                    count=(count, total),
                    header=darkred(" ::: ") + ">>> ")

                exit_st = pkg.start()
                if exit_st != 0:
                    return 1

            finally:
                if pkg is not None:
                    pkg.finalize()

        return 0


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloSource,
        SoloSource.NAME,
        _("download packages source code"))
    )
开发者ID:B-Rich,项目名称:entropy,代码行数:32,代码来源:source.py

示例6: not

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
            onlydeps, bdeps, recursive)
        if (run_queue is None) or (removal_queue is None):
            return 1
        elif not (run_queue or removal_queue):
            entropy_client.output(
                "%s." % (blue(_("Nothing to do")),),
                level="warning", header=darkgreen(" @@ "))
            return 0

        if pretend:
            entropy_client.output(
                "%s." % (blue(_("All done")),))
            return 0

        down_data = {}
        exit_st = self._download_packages(
            entropy_client, run_queue, down_data, multifetch,
            True)

        if exit_st == 0:
            self._signal_ugc(entropy_client, down_data)
        return exit_st


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloDownload,
        SoloDownload.NAME,
        _("download packages, essentially"))
    )
开发者ID:dMaggot,项目名称:entropy,代码行数:32,代码来源:download.py

示例7: set

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
            obj = spm_wanted_map.setdefault(stripped, set())
            obj.add(pkg)
        return spm_wanted_map

    def is_user_selected(self, pkg):
        """
        Determines whether a package is selected by user in SPM "world" file.
        """
        spm_package_key = entropy.dep.dep_getkey(pkg)
        spm_wanted_candidates = self._map.get(spm_package_key, set())

        # Avoid calling spm.match_installed_package() which can be
        # a little slow. Now the list is reduced.
        spm_wanted_matches = (self._spm_match_installed(x)
                              for x in spm_wanted_candidates
                              if x is not None)
        return pkg in spm_wanted_matches

    def _spm_match_installed(self, pkg):
        try:
            return self._spm.match_installed_package(pkg)
        except KeyError:
            return None

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloRescue,
        SoloRescue.NAME,
        _("tools to rescue the running system"))
    )
开发者ID:geaaru,项目名称:entropy,代码行数:32,代码来源:rescue.py

示例8: blue

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
        else:
            mytxt = "%s %s %s" % (
                blue(_("Installing available packages in")),
                darkred(_("10 seconds")),
                blue("..."),
            )
            entropy_client.output(mytxt, header=darkred(" @@ "))
            time.sleep(10)

        # avoid saving deps as installed by user
        matched_for_installation = self._match_packages_for_installation(
            entropy_client, False, sorted(found_deps))
        if not matched_for_installation:
            return 1
        exit_st, _show_cfgupd = self._install_action(
            entropy_client, True, True,
            self._pretend, self._ask,
            False, self._quiet, False,
            False, False, False, False, False,
            False, 1, [], package_matches=matched_for_installation)
        return exit_st


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloDeptest,
        SoloDeptest.NAME,
        _("look for unsatisfied dependencies"))
    )
开发者ID:geaaru,项目名称:entropy,代码行数:31,代码来源:deptest.py

示例9: list

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
            return True

        # filter: --by-user not provided -> if package has been installed
        # by user, exclude from list.
        if not self._byuser:
            data = list(filter(_user_filter, data))

        if self._sortbysize:
            data.sort(key = lambda x: x[0])

        if self._quiet:
            entropy_client.output(
                '\n'.join([x[2] for x in data]),
                level="generic")
        else:
            for disk_size, idpackage, atom in data:
                disk_size = entropy.tools.bytes_into_human(disk_size)
                entropy_client.output(
                    "# %s%s%s %s" % (
                        blue("["), brown(disk_size),
                        blue("]"), darkgreen(atom),))

        return 0

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloUnused,
        SoloUnused.NAME,
        _("look for unused packages (pay attention)"))
    )
开发者ID:Heather,项目名称:entropy,代码行数:32,代码来源:unused.py

示例10: _updates

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
    def _updates(self, entropy_client):
        """
        Solo Query Updates command.
        """
        quiet = self._nsargs.quiet
        verbose = self._nsargs.verbose

        if not quiet:
            entropy_client.output(brown(_("Available Updates")), header=darkred(" @@ "))

        outcome = entropy_client.calculate_updates(quiet=True)
        update, remove = outcome["update"], outcome["remove"]
        fine, critical_f = outcome["fine"], outcome["critical_found"]

        if quiet:
            entropy_client.output("%d" % (len(update),), level="generic")
            return 0

        toc = []
        toc.append((darkgreen(_("Packages to update:")), bold(const_convert_to_unicode(len(update)))))
        toc.append((darkred(_("Packages to remove:")), bold(const_convert_to_unicode(len(remove)))))
        if verbose:
            toc.append((blue(_("Packages already up-to-date:")), bold(const_convert_to_unicode(len(fine)))))
            toc.append((purple(_("Critical updates found:")), teal(const_convert_to_unicode(str(critical_f)))))
        print_table(entropy_client, toc)

        return 0


SoloCommandDescriptor.register(SoloCommandDescriptor(SoloQuery, SoloQuery.NAME, _("repository query tools")))
开发者ID:Rogentos,项目名称:entropy,代码行数:32,代码来源:query.py

示例11: _

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
                    "     %s" % (_("Would you like to install them ?"),)
                    )
                if exit_st == _("No"):
                    return 1
            else:
                mytxt = "%s %s %s" % (
                    blue(_("Installing available packages in")),
                    darkred(_("10 seconds")),
                    blue("..."),
                )
                entropy_client.output(
                    mytxt, header=darkred(" @@ "))
                time.sleep(10)

            exit_st, _show_cfgupd = self._install_action(
                entropy_client, True, True,
                pretend, ask, False, quiet, False,
                False, False, False, False, False,
                False, 1, [],
                package_matches=package_matches)

        return exit_st


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloLibtest,
        SoloLibtest.NAME,
        _("look for missing libraries"))
    )
开发者ID:dMaggot,项目名称:entropy,代码行数:32,代码来源:libtest.py

示例12: SoloCommandDescriptor

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
        # filtered out in solo.main. Will never get here
        parser.add_argument(
            "--color", action="store_true",
            default=None, help=_("force colored output"))

        descriptors = SoloCommandDescriptor.obtain()
        descriptors.sort(key = lambda x: x.get_name())
        group = parser.add_argument_group("command", "available commands")
        for descriptor in descriptors:
            if descriptor.get_class().HIDDEN:
                continue
            aliases = descriptor.get_class().ALIASES
            aliases_str = ", ".join([teal(x) for x in aliases])
            if aliases_str:
                aliases_str = " [%s]" % (aliases_str,)
            name = "%s%s" % (purple(descriptor.get_name()),
                aliases_str)
            desc = descriptor.get_description()
            group.add_argument(name, help=darkgreen(desc), action="store_true")
        parser.print_help()
        if not self._args:
            return 1
        return 0

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloHelp,
        SoloHelp.NAME,
        _("this help"))
    )
开发者ID:StefanCristian,项目名称:entropy,代码行数:32,代码来源:help.py

示例13: _show_notice_board_summary

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
    def _show_notice_board_summary(self, entropy_client, repository):
        """
        Show NoticeBoard information to user after repository update.
        """
        mytxt = "%s %s: %s" % (darkgreen(" @@ "),
            brown(_("Notice board")), bold(repository),)
        entropy_client.output(mytxt)

        mydict = self._check_notice_board_availability(
            entropy_client, repository)
        if not mydict:
            return

        for key in sorted(mydict.keys()):
            mydata = mydict.get(key)
            mytxt = "    [%s] [%s] %s: %s" % (
                blue(str(key)),
                brown(mydata['pubDate']),
                _("Title"),
                darkred(mydata['title']),
            )
            entropy_client.output(mytxt)

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloUpdate,
        SoloUpdate.NAME,
        _("update repositories"))
    )
开发者ID:B-Rich,项目名称:entropy,代码行数:31,代码来源:update.py

示例14: EntropyCacher

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
        cacher = EntropyCacher()
        try:
            cacher.save(SoloYell._CACHE_KEY, 0)
        except IOError:
            pass

    def _show_yell(self, *args):
        yell_id = SoloYell.read()
        max_id = max(list(SoloYell._MESSAGES.keys()))
        yell_message = SoloYell._MESSAGES.get(
            yell_id, max_id)
        # do not use entropy_client here
        # it is slow and might interfere with
        # other Client inits.
        text = TextInterface()
        text.output(
            yell_message,
            importance=1,
            level="warning")
        new_yell_id = yell_id + 1
        if new_yell_id <= max_id:
            SoloYell.write(new_yell_id)
        return 1

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloYell,
        SoloYell.NAME,
        _("yell at user"))
    )
开发者ID:B-Rich,项目名称:entropy,代码行数:32,代码来源:yell.py

示例15: _get_message

# 需要导入模块: from solo.commands.descriptor import SoloCommandDescriptor [as 别名]
# 或者: from solo.commands.descriptor.SoloCommandDescriptor import register [as 别名]
    def _get_message(self):
        """
        Reimplemented from SoloFunny.
        """
        t = """
 ________________________
< Hail to the king, baby! >
 ------------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\\
                ||----w |
                ||     ||
"""
        return t


SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloMoo,
        SoloMoo.NAME,
        _("moo at user"))
    )

SoloCommandDescriptor.register(
    SoloCommandDescriptor(
        SoloLxnay,
        SoloLxnay.NAME,
        _("bow to lxnay"))
    )
开发者ID:B-Rich,项目名称:entropy,代码行数:32,代码来源:moo.py


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