Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mama/papa_deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _append_includes(target:BuildTarget, package_full_path, detail_echo, descr,
config = target.config
includes_root = package_full_path + '/include'
# TODO: should we include .cpp files for easier debugging?
includes_filter = ['.h','.hpp','.hxx','.hh','.c','.cpp','.cxx']
includes_filter = ['.h','.hpp','.hxx','.hh','.c','.cpp','.cxx', '']

# set the default include
descr.append(f'I include')
Expand Down Expand Up @@ -108,7 +108,7 @@ def append(relpath):


def papa_deploy_to(target:BuildTarget, package_full_path:str,
r_includes:bool, r_dylibs:bool,
r_includes:bool, r_dylibs:bool,
r_syslibs:bool, r_assets:bool):
config = target.config
detail_echo = config.print and target.is_current_target() and (not config.test)
Expand Down
17 changes: 8 additions & 9 deletions mama/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,15 +393,14 @@ def _should_copy(src: str, dst: str):
return False


def _passes_filter(src_file: str, filter: list) -> bool:
if not filter:
def _passes_extension_filter(src_file: str, extensions: list) -> bool:
if not extensions:
return True
if isinstance(filter, str):
return src_file.endswith(filter)
for f in filter:
if src_file.endswith(f):
return True
return False
_, ext = os.path.splitext(src_file)
if ext:
return ext in extensions
else:
return '' in extensions


def copy_file(src: str, dst: str, filter: list = None) -> bool:
Expand All @@ -410,7 +409,7 @@ def copy_file(src: str, dst: str, filter: list = None) -> bool:
if it has changed, returns TRUE if copied.
The filter can be a string suffix or a list of string suffixes.
"""
if _passes_filter(src, filter):
if _passes_extension_filter(src, filter):
if os.path.isdir(dst):
dst = os.path.join(dst, os.path.basename(src))
if _should_copy(src, dst):
Expand Down