Created generator allias

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-01-29 21:21:51 +01:00
parent 9eeae12baf
commit 4809e3cbc2
2 changed files with 20 additions and 11 deletions

View file

@ -47,14 +47,18 @@ class SBoGrep:
self.unst = ["UNSUPPORTED", "UNTESTED"]
self.SLACKBUILDS_TXT = Utils().read_file(self.sbo_txt)
def names(self):
"""Grab all packages name
def _names_grabbing(self):
"""Generator that collecting all packages names
"""
pkg_names = []
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):
pkg_names.append(line[17:].strip())
return pkg_names
yield line[17:].strip()
def names(self):
"""Alias method convert generator and return
a list
"""
return list(self._names_grabbing())
def source(self):
"""Grab sources downloads links
@ -138,7 +142,7 @@ class SBoGrep:
return md5sum64
def description(self):
"""Grab package verion
"""Grab package version
"""
for line in self.SLACKBUILDS_TXT.splitlines():
if line.startswith(self.line_name):

View file

@ -65,11 +65,7 @@ class SBoInstall:
self.arch = SBoArch().get()
self.build_folder = self.meta.build_path
self._SOURCES = self.meta.SBo_SOURCES
for fl in self.flag:
if fl.startswith("--directory-prefix="):
self.build_folder = fl.split("=")[1]
if not self.build_folder.endswith("/"):
self.build_folder += "/"
self.init_flags()
self.unst = ["UNSUPPORTED", "UNTESTED"]
self.master_packages = []
self.deps = []
@ -86,6 +82,15 @@ class SBoInstall:
self.data = SBoGrep(name="").names()
self.blacklist = BlackList().packages(pkgs=self.data, repo="sbo")
def init_flags(self):
"""Flags initialization
"""
for fl in self.flag:
if fl.startswith("--directory-prefix="):
self.build_folder = fl.split("=")[1]
if not self.build_folder.endswith("/"):
self.build_folder += "/"
def start(self, is_upgrade):
"""Start view, build and install SBo packages
"""