summaryrefslogtreecommitdiff
path: root/tools/patman/tools.py
diff options
context:
space:
mode:
Diffstat (limited to 'tools/patman/tools.py')
-rw-r--r--tools/patman/tools.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/patman/tools.py b/tools/patman/tools.py
index 0870bccca0..1c9bf4e810 100644
--- a/tools/patman/tools.py
+++ b/tools/patman/tools.py
@@ -4,6 +4,7 @@
#
import command
+import glob
import os
import shutil
import tempfile
@@ -123,6 +124,23 @@ def GetInputFilename(fname):
raise ValueError("Filename '%s' not found in input path (%s) (cwd='%s')" %
(fname, ','.join(indir), os.getcwd()))
+def GetInputFilenameGlob(pattern):
+ """Return a list of filenames for use as input.
+
+ Args:
+ pattern: Filename pattern to search for
+
+ Returns:
+ A list of matching files in all input directories
+ """
+ if not indir:
+ return glob.glob(fname)
+ files = []
+ for dirname in indir:
+ pathname = os.path.join(dirname, pattern)
+ files += glob.glob(pathname)
+ return sorted(files)
+
def Align(pos, align):
if align:
mask = align - 1