From 4181d339dfdaab5ef3140793b9ed5877033d60b2 Mon Sep 17 00:00:00 2001 From: Eric Torres Date: Mon, 28 Jan 2019 10:53:56 -0800 Subject: [PATCH] Add query parameter to get_pkgfiles --- packaging_scripts/pkgfiles.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packaging_scripts/pkgfiles.py b/packaging_scripts/pkgfiles.py index 25a14eb..6a31104 100644 --- a/packaging_scripts/pkgfiles.py +++ b/packaging_scripts/pkgfiles.py @@ -2,10 +2,12 @@ import pathlib +# ========== Constants ========== PKGEXT = 'pkg.tar.xz' 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. :param directory: a directory to search in @@ -21,6 +23,6 @@ def get_pkgfiles(directory=None, signatures=False): path = pathlib.Path.cwd() 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}"))