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


Python splitting.split_package函数代码示例

本文整理汇总了Python中slpkg.splitting.split_package函数的典型用法代码示例。如果您正苦于以下问题:Python split_package函数的具体用法?Python split_package怎么用?Python split_package使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: install_packages

 def install_packages(self):
     """Install or upgrade packages
     """
     installs, upgraded = [], []
     for inst in (self.dep_install + self.install):
         package = (self.tmp_path + inst).split()
         pkg_ver = "{0}-{1}".format(split_package(inst)[0],
                                    split_package(inst)[1])
         self.checksums(inst)
         if os.path.isfile(self.meta.pkg_path + inst[:-4]):
             print("[ {0}reinstalling{1} ] --> {2}".format(
                 self.meta.color["GREEN"], self.meta.color["ENDC"], inst))
             installs.append(pkg_ver)
             PackageManager(package).upgrade("--reinstall")
         elif GetFromInstalled(split_package(inst)[0]).name():
             print("[ {0}upgrading{1} ] --> {2}".format(
                 self.meta.color["YELLOW"], self.meta.color["ENDC"], inst))
             upgraded.append(pkg_ver)
             PackageManager(package).upgrade("--install-new")
         else:
             print("[ {0}installing{1} ] --> {2}".format(
                 self.meta.color["GREEN"], self.meta.color["ENDC"], inst))
             installs.append(pkg_ver)
             PackageManager(package).upgrade("--install-new")
     return [installs, upgraded]
开发者ID:BrentonEarl,项目名称:slpkg,代码行数:25,代码来源:install.py

示例2: pkg_upgrade

def pkg_upgrade(repo, skip, flag):
    """
    Checking packages for upgrade
    """
    Msg().checking()
    PACKAGES_TXT = RepoInit(repo).fetch()[0]
    pkgs_for_upgrade = []
    # name = data[0]
    # location = data[1]
    # size = data[2]
    # unsize = data[3]
    data = repo_data(PACKAGES_TXT, repo, flag="")
    for pkg in installed():
        status(0.0005)
        inst_pkg = split_package(pkg)
        for name in data[0]:
            if name:    # this tips because some pkg_name is empty
                repo_pkg = split_package(name[:-4])
            if (repo_pkg[0] == inst_pkg[0] and
                LooseVersion(repo_pkg[1]) > LooseVersion(inst_pkg[1]) and
                repo_pkg[3] >= inst_pkg[3] and
                    inst_pkg[0] not in skip and
                    repo_pkg[1] != "blacklist"):
                pkgs_for_upgrade.append(repo_pkg[0])
    Msg().done()
    if "--checklist" in flag:
        pkgs_for_upgrade = choose_upg(pkgs_for_upgrade)
    return pkgs_for_upgrade
开发者ID:websafe,项目名称:slpkg,代码行数:28,代码来源:check.py

示例3: store

def store(*args):
    '''
    Store and return packages for upgrading
    '''
    (dwn, upgrade, comp_sum, uncomp_sum) = ([] for i in range(4))
    if args[4] == "stable":    # stables versions upgrade
        for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
            if (not os.path.isfile(pkg_path + name[:-4]) and split_package(
                    name)[0] not in BlackList().packages()):
                dwn.append("{0}{1}/{2}".format(
                    mirrors("", "", args[4]), loc, name))
                comp_sum.append(comp)
                uncomp_sum.append(uncomp)
                upgrade.append(name)
    else:   # current version upgrade
        installed = []
        # get all installed packages and store the package name.
        for pkg in os.listdir(pkg_path):
            installed.append(split_package(pkg)[0])
        for name, loc, comp, uncomp in zip(args[0], args[1], args[2], args[3]):
            # If the package from the current repository is installed
            # (check with the name) but not is in the path (check with
            # all package like 'apr-1.5.0-x86_64-1') then add to list for
            # upgrade.
            # etc. 'apr' in list 'installed' ?? if yes 'apr-1.5.0-x86_64-1'
            # exist in /var/log/packages ?? if no add to upgrade.
            if split_package(name)[0] in installed:
                if (not os.path.isfile(pkg_path + name[:-4]) and
                        split_package(name)[0] not in BlackList().packages()):
                    dwn.append("{0}{1}/{2}".format(
                        mirrors("", "", args[4]), loc, name))
                    comp_sum.append(comp)
                    uncomp_sum.append(uncomp)
                    upgrade.append(name)
    return [dwn, upgrade, comp_sum, uncomp_sum]
开发者ID:unixbhaskar,项目名称:slpkg,代码行数:35,代码来源:patches.py

示例4: pkg_upgrade

def pkg_upgrade(repo, skip):
    """
    Checking packages for upgrade
    """
    try:
        Msg().checking()
        PACKAGES_TXT = RepoInit(repo).fetch()[0]
        pkgs_for_upgrade = []
        # name = data[0]
        # location = data[1]
        # size = data[2]
        # unsize = data[3]
        data = repo_data(PACKAGES_TXT, repo, flag="")
        for pkg in installed():
            status(0.0005)
            inst_pkg = split_package(pkg)
            for name in data[0]:
                if name:  # this tips because some pkg_name is empty
                    repo_pkg = split_package(name[:-4])
                if (
                    repo_pkg[0] == inst_pkg[0]
                    and LooseVersion(repo_pkg[1]) > LooseVersion(inst_pkg[1])
                    and repo_pkg[3] >= inst_pkg[3]
                    and inst_pkg[0] not in skip
                ):
                    pkgs_for_upgrade.append(repo_pkg[0])
        Msg().done()
        return pkgs_for_upgrade
    except KeyboardInterrupt:
        print("")  # new line at exit
        sys.exit(0)
开发者ID:fatman2021,项目名称:slpkg,代码行数:31,代码来源:check.py

示例5: store

 def store(self, packages):
     """Store and return packages for install
     """
     dwn, install, comp_sum, uncomp_sum = ([] for i in range(4))
     # name = data[0]
     # location = data[1]
     # size = data[2]
     # unsize = data[3]
     for pkg in packages:
         for pk, loc, comp, uncomp in zip(self.data[0], self.data[1],
                                          self.data[2], self.data[3]):
             if (pk and pkg == split_package(pk)[0] and
                     pk not in install and
                     split_package(pk)[0] not in self.blacklist):
                 dwn.append("{0}{1}/{2}".format(self.mirror, loc, pk))
                 install.append(pk)
                 comp_sum.append(comp)
                 uncomp_sum.append(uncomp)
     if not install:
         for pkg in packages:
             for pk, loc, comp, uncomp in zip(self.data[0], self.data[1],
                                              self.data[2], self.data[3]):
                 name = split_package(pk)[0]
                 if (pk and pkg in name and name not in self.blacklist):
                     dwn.append("{0}{1}/{2}".format(self.mirror, loc, pk))
                     install.append(pk)
                     comp_sum.append(comp)
                     uncomp_sum.append(uncomp)
     dwn.reverse()
     install.reverse()
     comp_sum.reverse()
     uncomp_sum.reverse()
     return [dwn, install, comp_sum, uncomp_sum]
开发者ID:BrentonEarl,项目名称:slpkg,代码行数:33,代码来源:install.py

示例6: not_downgrade

 def not_downgrade(self, package):
     """Don't downgrade packages if repository version is lower than
     installed"""
     name = split_package(package)[0]
     rep_ver = split_package(package)[1]
     ins_ver = GetFromInstalled(name).version()[1:]
     if not ins_ver:
         ins_ver = "0"
     if LooseVersion(rep_ver) < LooseVersion(ins_ver):
         self.msg.template(78)
         print("| Package {0} don't downgrade, "
               "setting by user".format(name))
         self.msg.template(78)
         return True
开发者ID:dslackw,项目名称:slpkg,代码行数:14,代码来源:install.py

示例7: list_of_installed

 def list_of_installed(self, repo, name):
     """Return installed packages
     """
     all_installed_names = []
     all_installed_packages = find_package("", self.meta.pkg_path)
     for inst in all_installed_packages:
         if repo == "sbo" and inst.endswith("_SBo"):
             name = split_package(inst)[0]
             all_installed_names.append(name)
         else:
             if name:
                 all_installed_names.append(split_package(inst)[0])
             else:
                 all_installed_names.append(inst)
     return all_installed_names
开发者ID:dslackw,项目名称:slpkg,代码行数:15,代码来源:manager.py

示例8: _view_removed

 def _view_removed(self):
     """View packages before removed
     """
     print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
         self.meta.color["CYAN"], ", ".join(self.binary),
         self.meta.color["ENDC"]))
     removed, packages = self._get_removed()
     if packages and "--checklist" in self.extra:
         removed = []
         data = packages
         text = "Press 'spacebar' to unchoose packages from remove"
         title = "Remove"
         backtitle = "{0} {1}".format(self.meta.__all__,
                                      self.meta.__version__)
         status = True
         pkgs = DialogUtil(data, text, title, backtitle, status).checklist()
         if pkgs:
             for rmv in pkgs:
                 removed.append(split_package(rmv)[0])
             self.meta.default_answer = "y"
     else:
         for rmv, pkg in zip(removed, packages):
             print("[ {0}delete{1} ] --> {2}".format(
                 self.meta.color["RED"], self.meta.color["ENDC"], pkg))
             self._sizes(pkg)
         self._calc_sizes()
         self._remove_summary()
     return removed
开发者ID:websafe,项目名称:slpkg,代码行数:28,代码来源:manager.py

示例9: add

 def add(self, repo, pkg):
     """Split packages by repository
     """
     if repo == "sbo":
         return pkg
     else:
         return split_package(pkg)[0]
开发者ID:fabioalvaro,项目名称:slpkg,代码行数:7,代码来源:load.py

示例10: views

 def views(self, install, comp_sum):
     """Views packages
     """
     pkg_sum = uni_sum = upg_sum = 0
     # fix repositories align
     repo = self.repo + (" " * (6 - (len(self.repo))))
     for pkg, comp in zip(install, comp_sum):
         pkg_repo = split_package(pkg[:-4])
         if find_package(pkg[:-4], self.meta.pkg_path):
             pkg_sum += 1
             COLOR = self.meta.color["GREEN"]
         elif pkg_repo[0] == GetFromInstalled(pkg_repo[0]).name():
             COLOR = self.meta.color["YELLOW"]
             upg_sum += 1
         else:
             COLOR = self.meta.color["RED"]
             uni_sum += 1
         ver = GetFromInstalled(pkg_repo[0]).version()
         print("  {0}{1}{2}{3} {4}{5} {6}{7}{8}{9}{10}{11:>11}{12}".format(
             COLOR, pkg_repo[0] + ver, self.meta.color["ENDC"],
             " " * (23-len(pkg_repo[0] + ver)), pkg_repo[1],
             " " * (18-len(pkg_repo[1])), pkg_repo[2],
             " " * (8-len(pkg_repo[2])), pkg_repo[3],
             " " * (7-len(pkg_repo[3])), repo,
             comp, " K")).rstrip()
     return [pkg_sum, upg_sum, uni_sum]
开发者ID:BrentonEarl,项目名称:slpkg,代码行数:26,代码来源:install.py

示例11: choose_upg

def choose_upg(packages):
    """Create checklist to choose packages for upgrade
    """
    selected_packages, data = [], []
    if packages:
        for pkg in packages:
            name = GetFromInstalled(pkg).name()
            ver = GetFromInstalled(pkg).version()
            binary = "{0}{1}".format(name, ver)
            installed = find_package(binary + _meta_.sp, _meta_.pkg_path)[0]
            data.append(installed)
        text = "Press 'spacebar' to unchoose packages from upgrade"
        title = " Upgrade "
        backtitle = "{0} {1}".format(_meta_.__all__, _meta_.__version__)
        status = True
        pkgs = DialogUtil(data, text, title, backtitle,
                          status).checklist()
        pkgs = [] if pkgs is None else pkgs
        for pkg in pkgs:
            name = split_package(pkg)[0]
            if name in packages:
                selected_packages.append(name)
        if not selected_packages:
            raise SystemExit()
        print("")
    return selected_packages
开发者ID:dslackw,项目名称:slpkg,代码行数:26,代码来源:upgrade_checklist.py

示例12: get_deps

 def get_deps(self):
     """Grap package requirements from repositories
     """
     if self.repo == "rlw":
         # Robby"s repository dependencies as shown in the central page
         # http://rlworkman.net/pkgs/
         dependencies = {
             "abiword": "wv",
             "claws-mail": "libetpan",
             "inkscape": "gtkmm atkmm pangomm cairomm mm-common libsigc++ "
                         "libwpg lxml gsl numpy BeautifulSoup",
             "texlive": "libsigsegv texi2html",
             "xfburn": "libburn libisofs"
         }
         if self.name in dependencies.keys():
             return dependencies[self.name].split()
         else:
             return ""
     else:
         PACKAGES_TXT = Utils().read_file("{0}{1}_repo/PACKAGES.TXT".format(
             _meta_.lib_path, self.repo))
         for line in PACKAGES_TXT.splitlines():
             if line.startswith("PACKAGE NAME:"):
                 pkg_name = split_package(line[14:].strip())[0]
             if line.startswith("PACKAGE REQUIRED:"):
                 if pkg_name == self.name:
                     if line[18:].strip():
                         return self._req_fix(line)
开发者ID:BrentonEarl,项目名称:slpkg,代码行数:28,代码来源:greps.py

示例13: _get_removed

 def _get_removed(self):
     """Manage removed packages by extra options
     """
     removed, packages = [], []
     if "--tag" in self.extra:
         for pkg in find_package("", self.meta.pkg_path):
             for tag in self.binary:
                 if pkg.endswith(tag):
                     removed.append(split_package(pkg)[0])
                     packages.append(pkg)
         if not removed:
             self.msg.pkg_not_found("", "'tag'", "Can't remove", "\n")
             raise SystemExit(1)
     else:
         for pkg in self.binary:
             name = GetFromInstalled(pkg).name()
             ver = GetFromInstalled(pkg).version()
             package = find_package("{0}{1}{2}".format(
                 name, ver, self.meta.sp), self.meta.pkg_path)
             if pkg and name == pkg:
                 removed.append(pkg)
                 packages.append(package[0])
             else:
                 self.msg.pkg_not_found("", pkg, "Can't remove", "\n")
                 raise SystemExit(1)
     return removed, packages
开发者ID:dslackw,项目名称:slpkg,代码行数:26,代码来源:manager.py

示例14: store

def store(dependencies_list):
    '''
    In the end lest a check of the packages that are on the list
    are already installed.
    '''
    (upgrade_name,
     package_for_upgrade,
     upgrade_version,
     upgrade_arch
     ) = ([] for i in range(4))
    for pkg in dependencies_list:
        ver = SBoGrep(pkg).version()
        prgnam = ("{0}-{1}".format(pkg, ver))
        # if package not installed
        # take version from repository
        pkg_version = ver
        arch = os.uname()[4]
        if arch.startswith("i") and arch.endswith("86"):
            arch = "i486"
        if find_package(prgnam, pkg_path) == []:
            for sbo in os.listdir(pkg_path):
                if (sbo.startswith(pkg + sp) and
                        sbo.endswith("_SBo")):
                    # search if packages installed
                    # if yes grab package name and version
                    pkg_version = split_package(sbo)[1]
            upgrade_name.append(pkg)
            package_for_upgrade.append("{0}-{1}".format(pkg, pkg_version))
            upgrade_version.append(ver)
            upgrade_arch.append(arch)
    return [upgrade_name, package_for_upgrade, upgrade_version, upgrade_arch]
开发者ID:unixbhaskar,项目名称:slpkg,代码行数:31,代码来源:check.py

示例15: __init__

 def __init__(self, packages, repo, flag):
     self.packages = packages
     pkg_security(packages)
     self.repo = repo
     self.flag = flag
     self.meta = _meta_
     self.msg = Msg()
     self.version = self.meta.slack_rel
     self.tmp_path = self.meta.slpkg_tmp_packages
     for fl in self.flag:
         if fl.startswith("--directory-prefix="):
             self.tmp_path = fl.split("=")[1]
             if not self.tmp_path.endswith("/"):
                 self.tmp_path += "/"
     self.dwn, self.dep_dwn = [], []
     self.install, self.dep_install = [], []
     self.comp_sum, self.dep_comp_sum = [], []
     self.uncomp_sum, self.dep_uncomp_sum = [], []
     self.dependencies = []
     self.deps_dict = {}
     self.answer = ""
     self.msg.reading()
     self.PACKAGES_TXT, self.mirror = RepoInit(self.repo).fetch()
     self.data = repo_data(self.PACKAGES_TXT, self.repo, self.flag)
     self.repo_pkg_names = []
     for name in self.data[0]:
         self.repo_pkg_names.append(split_package(name)[0])
     self.blacklist = BlackList().packages(self.data[0], self.repo)
     self.matching = False
开发者ID:dslackw,项目名称:slpkg,代码行数:29,代码来源:install.py


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