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


Python Utils.check_downloaded方法代码示例

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


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

示例1: Patches

# 需要导入模块: from slpkg.utils import Utils [as 别名]
# 或者: from slpkg.utils.Utils import check_downloaded [as 别名]
class Patches(object):

    def __init__(self, skip, flag):
        self.skip = skip
        self.flag = flag
        self.meta = _meta_
        self.version = self.meta.slack_rel
        self.patch_path = self.meta.slpkg_tmp_patches
        self.pkg_for_upgrade = []
        self.dwn_links = []
        self.upgrade_all = []
        self.count_added = 0
        self.count_upg = 0
        self.upgraded = []
        self.installed = []
        self.comp_sum = []
        self.uncomp_sum = []
        self.utils = Utils()
        Msg().checking()
        if self.version == "stable":
            self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
                                            "patches/")).reading()
        else:
            self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()

    def start(self):
        """
        Install new patches from official Slackware mirrors
        """
        try:
            self.store()
            Msg().done()
            if self.upgrade_all:
                print("\nThese packages need upgrading:\n")
                Msg().template(78)
                print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                    "| Package", " " * 17,
                    "New Version", " " * 8,
                    "Arch", " " * 4,
                    "Build", " " * 2,
                    "Repos", " " * 10,
                    "Size"))
                Msg().template(78)
                print("Upgrading:")
                self.views()
                unit, size = units(self.comp_sum, self.uncomp_sum)
                print("\nInstalling summary")
                print("=" * 79)
                print("{0}Total {1} {2} will be upgraded and {3} will be "
                      "installed.".format(self.meta.color["GREY"],
                                          self.count_upg,
                                          Msg().pkg(self.upgrade_all),
                                          self.count_added))
                print("Need to get {0} {1} of archives.".format(size[0],
                                                                unit[0]))
                print("After this process, {0} {1} of additional disk space "
                      "will be used.{2}".format(size[1], unit[1],
                                                self.meta.color["ENDC"]))
                print("")
                if Msg().answer() in ["y", "Y"]:
                    Download(self.patch_path, self.dwn_links,
                             repo="slack").start()
                    self.upgrade_all = self.utils.check_downloaded(
                        self.patch_path, self.upgrade_all)
                    self.upgrade()
                    self.kernel()
                    if self.meta.slackpkg_log in ["on", "ON"]:
                        self.slackpkg_update()
                    Msg().reference(self.installed, self.upgraded)
                    delete(self.patch_path, self.upgrade_all)
            else:
                slack_arch = ""
                if os.uname()[4] == "x86_64":
                    slack_arch = 64
                print("\nSlackware{0} '{1}' v{2} distribution is up to "
                      "date\n".format(slack_arch, self.version, slack_ver()))
        except KeyboardInterrupt:
            print("")   # new line at exit
            sys.exit(0)

    def store(self):
        """
        Store and return packages for upgrading
        """
        data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
        black = BlackList().packages(pkgs=data[0], repo="slack")
        for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
            status(0.0003)
            repo_pkg_name = split_package(name)[0]
            if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
                    repo_pkg_name not in black and
                    repo_pkg_name not in self.skip):
                self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""),
                                                          loc, name))
                self.comp_sum.append(comp)
                self.uncomp_sum.append(uncomp)
                self.upgrade_all.append(name)
                self.count_upg += 1
                if not find_package(repo_pkg_name, self.meta.pkg_path):
                    self.count_added += 1
#.........这里部分代码省略.........
开发者ID:fatman2021,项目名称:slpkg,代码行数:103,代码来源:patches.py

示例2: Patches

# 需要导入模块: from slpkg.utils import Utils [as 别名]
# 或者: from slpkg.utils.Utils import check_downloaded [as 别名]
class Patches(object):
    """Upgrade distribution from official Slackware mirrors
    """
    def __init__(self, skip, flag):
        self.skip = skip
        self.flag = flag
        self.meta = _meta_
        self.msg = Msg()
        self.version = self.meta.slack_rel
        self.patch_path = self.meta.slpkg_tmp_patches
        self.pkg_for_upgrade = []
        self.dwn_links = []
        self.upgrade_all = []
        self.count_added = 0
        self.count_upg = 0
        self.upgraded = []
        self.installed = []
        self.comp_sum = []
        self.uncomp_sum = []
        self.utils = Utils()
        self.msg.checking()
        if self.version == "stable":
            self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
                                            "patches/")).reading()
        else:
            self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()

    def start(self):
        """
        Install new patches from official Slackware mirrors
        """
        self.store()
        self.msg.done()
        if self.upgrade_all:
            if "--checklist" in self.flag:
                self.dialog_checklist()
            print("\nThese packages need upgrading:\n")
            self.msg.template(78)
            print("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}".format(
                "| Package", " " * 17,
                "New Version", " " * 8,
                "Arch", " " * 4,
                "Build", " " * 2,
                "Repos", " " * 10,
                "Size"))
            self.msg.template(78)
            print("Upgrading:")
            self.views()
            unit, size = units(self.comp_sum, self.uncomp_sum)
            print("\nInstalling summary")
            print("=" * 79)
            print("{0}Total {1} {2} will be upgraded and {3} will be "
                  "installed.".format(self.meta.color["GREY"],
                                      self.count_upg,
                                      self.msg.pkg(self.upgrade_all),
                                      self.count_added))
            print("Need to get {0} {1} of archives.".format(size[0],
                                                            unit[0]))
            print("After this process, {0} {1} of additional disk space "
                  "will be used.{2}".format(size[1], unit[1],
                                            self.meta.color["ENDC"]))
            print("")
            if self.msg.answer() in ["y", "Y"]:
                Download(self.patch_path, self.dwn_links,
                         repo="slack").start()
                self.upgrade_all = self.utils.check_downloaded(
                    self.patch_path, self.upgrade_all)
                self.upgrade()
                self.kernel()
                if self.meta.slackpkg_log in ["on", "ON"]:
                    self.slackpkg_update()
                self.msg.reference(self.installed, self.upgraded)
                delete_package(self.patch_path, self.upgrade_all)
                self.update_lists()
        else:
            slack_arch = ""
            if self.meta.arch == "x86_64":
                slack_arch = "64"
            print("\nSlackware{0} '{1}' v{2} distribution is up to "
                  "date\n".format(slack_arch, self.version, slack_ver()))

    def store(self):
        """
        Store and return packages for upgrading
        """
        data = repo_data(self.PACKAGES_TXT, "slack", self.flag)
        black = BlackList().packages(pkgs=data[0], repo="slack")
        for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
            status(0.0003)
            repo_pkg_name = split_package(name)[0]
            if (not os.path.isfile(self.meta.pkg_path + name[:-4]) and
                    repo_pkg_name not in black and
                    repo_pkg_name not in self.skip):
                self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""),
                                                          loc, name))
                self.comp_sum.append(comp)
                self.uncomp_sum.append(uncomp)
                self.upgrade_all.append(name)
                self.count_upg += 1
                if not find_package(repo_pkg_name + self.meta.sp,
#.........这里部分代码省略.........
开发者ID:websafe,项目名称:slpkg,代码行数:103,代码来源:patches.py


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