Add query parameter to get_pkgfiles

This commit is contained in:
Eric Torres 2019-01-28 10:53:56 -08:00
parent 90026d6aa7
commit 4181d339df

View File

@ -2,10 +2,12 @@
import pathlib import pathlib
# ========== Constants ==========
PKGEXT = 'pkg.tar.xz' PKGEXT = 'pkg.tar.xz'
SIGEXT = f"{PKGEXT}.sig" SIGEXT = f"{PKGEXT}.sig"
def get_pkgfiles(directory=None, signatures=False): # ========== Functions ==========
def get_pkgfiles(query, directory=None, signatures=False):
"""Return a list of package files in the current working directory. """Return a list of package files in the current working directory.
:param directory: a directory to search in :param directory: a directory to search in
@ -21,6 +23,6 @@ def get_pkgfiles(directory=None, signatures=False):
path = pathlib.Path.cwd() path = pathlib.Path.cwd()
if signatures: if signatures:
return list(path.glob(f"*.{SIGEXT}")) return list(path.glob(f"{query}*.{SIGEXT}"))
return list(path.glob(f"*.{PKGEXT}")) return list(path.glob(f"{query}*.{PKGEXT}"))