changeset 304:dc1f08937621

FIX: fnmatch: handle None fnmatch filter definitions
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 05 Mar 2025 10:24:51 +0100
parents 73d13be531b5
children 6c212e407524
files cutils/util/fnmatch.py
diffstat 1 files changed, 11 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/cutils/util/fnmatch.py	Wed Mar 05 10:22:29 2025 +0100
+++ b/cutils/util/fnmatch.py	Wed Mar 05 10:24:51 2025 +0100
@@ -104,17 +104,17 @@
     @classmethod
     def build_from_commandline_patterns(klass, filter_definitions):
         matchers = []
-        for action, kpattern in filter_definitions:
-            kind, sep, pattern = kpattern.partition(':')
-            if not sep:
-                # use the default
-                kind = "glob"
-                pattern = kpattern
-            factory = klass._registry.get(kind, None)
-            if not factory:
-                raise RuntimeError("unknown pattern kind: {}".format(kind))
-            matchers.append((action, kind, factory(pattern), pattern))
-
+        if filter_definitions:
+            for action, kpattern in filter_definitions:
+                kind, sep, pattern = kpattern.partition(':')
+                if not sep:
+                    # use the default
+                    kind = "glob"
+                    pattern = kpattern
+                factory = klass._registry.get(kind, None)
+                if not factory:
+                    raise RuntimeError("unknown pattern kind: {}".format(kind))
+                matchers.append((action, kind, factory(pattern), pattern))
         return klass(matchers)
 
     def shall_visit(self, fn):