Skip to content

Commit

Permalink
Merge default exclude with package exclude
Browse files Browse the repository at this point in the history
  • Loading branch information
martinRenou committed Jun 6, 2024
1 parent 4e2591d commit f931c9f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 7 deletions.
17 changes: 11 additions & 6 deletions config/empack_config.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
packages:
widgetsnbextension:
exclude_patterns:
- pattern: '**'
zlib:
exclude_patterns:
- pattern: '**/so'
pip:
exclude_patterns:
- pattern: '**/_vendor/**'
Expand All @@ -14,6 +8,12 @@ packages:
- pattern: '**/distutils-precedence.pth'
- pattern: '**/setuptools/**'
- pattern: '**/pkg_resources/_vendor/**'
zlib:
exclude_patterns:
- pattern: '**/so'
widgetsnbextension:
exclude_patterns:
- pattern: '**'
default:
exclude_patterns:
- pattern: 'include/**'
Expand All @@ -22,8 +22,13 @@ default:
- pattern: '**/bin/**'
- pattern: 'tests/**'
- pattern: '**/tests/**'
- pattern: '**/*.ini'
- pattern: '**/*.exe'
- pattern: '**/*.a'
- pattern: '**/*.c'
- pattern: '**/*.pxd'
- pattern: '**/*.pyi'
- pattern: '**/*.pyx'
- pattern: '**/*.pyc'
- pattern: '**/*.typed'
- pattern: '**/*.egg-info'
Expand Down
9 changes: 8 additions & 1 deletion empack/file_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,16 @@ def __init__(self, packages=None, default=None):
if packages is None:
packages = {}

default_exclude_patterns = []
if default is not None and 'exclude_patterns' in default:
default_exclude_patterns = default['exclude_patterns']

for k, v in packages.items():
if isinstance(v, dict):
self.packages[k] = FileFilter(**v)
exclude_patterns = default_exclude_patterns
if 'exclude_patterns' in v:
exclude_patterns = exclude_patterns + default_exclude_patterns
self.packages[k] = FileFilter(exclude_patterns=exclude_patterns)
elif isinstance(v, list):
self.packages[k] = [FileFilter(**x) for x in v]
else:
Expand Down

0 comments on commit f931c9f

Please sign in to comment.