diff --git a/empack/file_patterns.py b/empack/file_patterns.py index 53b0ea9..744eac0 100644 --- a/empack/file_patterns.py +++ b/empack/file_patterns.py @@ -21,7 +21,7 @@ def match(self, path): class FileFilter: - def __init__(self, include_patterns=None, exclude_patterns=None): + def __init__(self, exclude_patterns=None): def patter_from_dict(**d): if "pattern" in d: return UnixPattern(**d) @@ -35,11 +35,10 @@ def patter_from_dict(**d): self.exclude_patterns = [patter_from_dict(**p) for p in exclude_patterns] def match(self, path): - include = True for ep in self.exclude_patterns: if ep.match(path): return False - return include + return True class PkgFileFilter: @@ -57,10 +56,8 @@ def __init__(self, packages=None, default=None): if isinstance(v, dict): exclude_patterns = default_exclude_patterns if "exclude_patterns" in v: - exclude_patterns = exclude_patterns + default_exclude_patterns + exclude_patterns = exclude_patterns + v["exclude_patterns"] self.packages[k] = FileFilter(exclude_patterns=exclude_patterns) - elif isinstance(v, list): - self.packages[k] = [FileFilter(**x) for x in v] else: err = f"invalid value for package {k}: {v}" raise ValueError(err)