diff --git a/packaging_scripts/pkgfiles.py b/packaging_scripts/pkgfiles.py index d767ea0..56e0935 100644 --- a/packaging_scripts/pkgfiles.py +++ b/packaging_scripts/pkgfiles.py @@ -16,7 +16,7 @@ def get_pkgfiles(query=None, directory=None, signatures_only=False): :param query: names of package files to search for :type query: str :param directory: a directory to search in - :type directory: str, bytes, or path-like object + :type directory: str :param signatures_only: include only signature files :type signatures_only: bool :returns: paths of package files @@ -27,13 +27,11 @@ def get_pkgfiles(query=None, directory=None, signatures_only=False): else: path = os.getcwd() - if signatures_only: - if query is not None: - return glob.glob(f"{path}/{query}*.{SIGEXT}") - else: - return glob.glob(f"{path}/*.{SIGEXT}") - else: - if query is not None: - return glob.glob(f"{path}/{query}*.{PKGEXT}") - else: - return glob.glob(f"{path}/*.{PKGEXT}") + if signatures_only and query is not None: + return glob.glob(f"{path}/*{query}*.{SIGEXT}") + elif signatures_only and query is None: + return glob.glob(f"{path}/*.{SIGEXT}") + elif not signatures_only and query is not None: + return glob.glob(f"{path}/*{query}*.{PKGEXT}") + elif not signatures_only and query is None: + return glob.glob(f"{path}/*.{PKGEXT}")