Created generator allias

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2020-01-29 17:23:21 +01:00
parent 9cb48a3c1e
commit 4bdc3e2505

View file

@ -27,10 +27,9 @@ from slpkg.blacklist import BlackList
from slpkg.splitting import split_package
def find_package(find_pkg, directory):
def searching(find_pkg, directory):
"""Find packages
"""
pkgs = []
if os.path.isdir(directory):
installed = sorted(os.listdir(directory))
blacklist = BlackList().packages(pkgs=installed, repo="local")
@ -38,5 +37,10 @@ def find_package(find_pkg, directory):
for pkg in installed:
if (not pkg.startswith(".") and pkg.startswith(find_pkg) and
split_package(pkg)[0] not in blacklist):
pkgs.append(pkg)
return pkgs
yield pkg
def find_package(pkg, path):
"""Generator allias
"""
return list(searching(pkg, path))