コード例 #1
0
ファイル: queue.py プロジェクト: unixbhaskar/slpkg
 def add(self, pkgs):
     '''
     Add packages in queue if not exist
     '''
     queue_list = self.packages()
     pkgs = set(pkgs)
     print("\nAdd packages in queue:\n")
     with open(self.queue_list, "a") as queue:
         for pkg in pkgs:
             find = sbo_search_pkg(pkg)
             if pkg not in queue_list and find is not None:
                 print("{0}{1}{2}".format(GREEN, pkg, ENDC))
                 queue.write(pkg + "\n")
                 self.quit = True
             else:
                 print("{0}{1}{2}".format(RED, pkg, ENDC))
                 self.quit = True
         queue.close()
     if self.quit:
         print   # new line at exit
コード例 #2
0
 def add(self, pkgs):
     '''
     Add packages in queue if not exist
     '''
     queue_list = self.packages()
     pkgs = set(pkgs)
     print("\nAdd packages in queue:\n")
     with open(self.queue_list, "a") as queue:
         for pkg in pkgs:
             find = sbo_search_pkg(pkg)
             if pkg not in queue_list and find is not None:
                 print("{0}{1}{2}".format(GREEN, pkg, ENDC))
                 queue.write(pkg + "\n")
                 self.quit = True
             else:
                 print("{0}{1}{2}".format(RED, pkg, ENDC))
                 self.quit = True
         queue.close()
     if self.quit:
         print  # new line at exit
コード例 #3
0
ファイル: queue.py プロジェクト: unixbhaskar/slpkg
 def build(self):
     '''
     Build packages from queue
     '''
     packages = self.packages()
     if packages:
         for pkg in packages:
             if not os.path.exists(build_path):
                 os.mkdir(build_path)
             sbo_url = sbo_search_pkg(pkg)
             sbo_dwn = SBoLink(sbo_url).tar_gz()
             source_dwn = SBoGrep(pkg).source().split()
             sources = []
             os.chdir(build_path)
             script = sbo_dwn.split("/")[-1]
             Download(build_path, sbo_dwn).start()
             for src in source_dwn:
                 Download(build_path, src).start()
                 sources.append(src.split("/")[-1])
             BuildPackage(script, sources, build_path).build()
     else:
         print("\nPackages not found in the queue for building\n")
コード例 #4
0
 def build(self):
     '''
     Build packages from queue
     '''
     packages = self.packages()
     if packages:
         for pkg in packages:
             if not os.path.exists(build_path):
                 os.mkdir(build_path)
             sbo_url = sbo_search_pkg(pkg)
             sbo_dwn = SBoLink(sbo_url).tar_gz()
             source_dwn = SBoGrep(pkg).source().split()
             sources = []
             os.chdir(build_path)
             script = sbo_dwn.split("/")[-1]
             Download(build_path, sbo_dwn).start()
             for src in source_dwn:
                 Download(build_path, src).start()
                 sources.append(src.split("/")[-1])
             BuildPackage(script, sources, build_path).build()
     else:
         print("\nPackages not found in the queue for building\n")
コード例 #5
0
ファイル: tracking.py プロジェクト: fatman2021/slpkg
def track_dep(name, repo):
    """
    View tree of dependencies and also
    highlight packages with color green
    if allready installed and color red
    if not installed.
    """
    Msg().resolving()
    if repo == "sbo":
        dependencies_list = Requires(flag="").sbo(name)
        find_pkg = sbo_search_pkg(name)
    else:
        PACKAGES_TXT = Utils().read_file(_meta_.lib_path + "{0}_repo/"
                                         "PACKAGES.TXT".format(repo))
        names = Utils().package_name(PACKAGES_TXT)
        black = BlackList().packages(names, repo)
        dependencies_list = Dependencies(names, repo, black).binary(
            name, flag="")
        find_pkg = search_pkg(name, repo)
    Msg().done()
    if find_pkg:
        requires, dependencies = [], []
        requires = Utils().dimensional_list(dependencies_list)
        requires.reverse()
        dependencies = Utils().remove_dbs(requires)
        if dependencies == []:
            dependencies = ["No dependencies"]
        pkg_len = len(name) + 24
        print("")    # new line at start
        Msg().template(pkg_len)
        print("| Package {0}{1}{2} dependencies :".format(_meta_.color["CYAN"],
                                                          name,
                                                          _meta_.color["ENDC"]))
        Msg().template(pkg_len)
        print("\\")
        print(" +---{0}[ Tree of dependencies ]{1}".format(
            _meta_.color["YELLOW"], _meta_.color["ENDC"]))
        index = 0
        for pkg in dependencies:
            index += 1
            installed = ""
            if find_package(pkg + _meta_.sp, _meta_.pkg_path):
                if _meta_.use_colors in ["off", "OFF"]:
                    installed = "*"
                print(" |")
                print(" {0}{1}: {2}{3}{4} {5}".format("+--", index,
                                                      _meta_.color["GREEN"],
                                                      pkg, _meta_.color["ENDC"],
                                                      installed))
            else:
                print(" |")
                print(" {0}{1}: {2}{3}{4} {5}".format("+--", index,
                                                      _meta_.color["RED"], pkg,
                                                      _meta_.color["ENDC"],
                                                      installed))
        if _meta_.use_colors in ["off", "OFF"]:
            print("\n *: Installed\n")
        else:
            print("")    # new line at end
    else:
        print("\nNo package was found to match\n")