Converted to generator

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-01-29 23:17:04 +01:00
parent 9504228619
commit 2fc4f64036

View file

@ -312,10 +312,8 @@ class SBoInstall:
def filenames(self, sources): def filenames(self, sources):
"""Return filenames from sources links """Return filenames from sources links
""" """
filename = []
for src in sources: for src in sources:
filename.append(src.split("/")[-1]) yield src.split("/")[-1]
return filename
def build_install(self): def build_install(self):
"""Build and install packages if not already installed """Build and install packages if not already installed
@ -348,13 +346,14 @@ class SBoInstall:
sbo_link = SBoLink(sbo_url).tar_gz() sbo_link = SBoLink(sbo_url).tar_gz()
script = sbo_link.split("/")[-1] script = sbo_link.split("/")[-1]
if self.meta.sbosrcarch in ["on", "ON"]: if self.meta.sbosrcarch in ["on", "ON"]:
src_link = self.sbosrcarsh(prgnam, sbo_link, src_link) src_link = list(self.sbosrcarsh(prgnam, sbo_link, src_link))
Download(self.build_folder, sbo_link.split(), Download(self.build_folder, sbo_link.split(),
repo="sbo").start() repo="sbo").start()
Download(self._SOURCES, src_link, repo="sbo").start() Download(self._SOURCES, src_link, repo="sbo").start()
if "--download-only" in self.flag: if "--download-only" in self.flag:
continue continue
sources = self.filenames(src_link) sources = list(self.filenames(src_link))
print(sources)
BuildPackage(script, sources, self.build_folder, BuildPackage(script, sources, self.build_folder,
auto=False).build() auto=False).build()
binary = slack_package(prgnam) binary = slack_package(prgnam)
@ -389,10 +388,8 @@ class SBoInstall:
def sbosrcarsh(self, prgnam, sbo_link, src_link): def sbosrcarsh(self, prgnam, sbo_link, src_link):
"""Alternative repository for sbo sources""" """Alternative repository for sbo sources"""
sources = []
name = "-".join(prgnam.split("-")[:-1]) name = "-".join(prgnam.split("-")[:-1])
category = f"{sbo_link.split('/')[-2]}/{name}/" category = f"{sbo_link.split('/')[-2]}/{name}/"
for link in src_link: for link in src_link:
source = link.split("/")[-1] source = link.split("/")[-1]
sources.append(f"{self.meta.sbosrcarch_link}{category}{source}") yield f"{self.meta.sbosrcarch_link}{category}{source}"
return sources