This commit is contained in:
Sven Heidemann 2021-03-10 14:16:03 +01:00
parent 1bff2ea168
commit 4e24662d90
3 changed files with 18 additions and 6 deletions

View File

@ -31,7 +31,9 @@
"Main": "cpl_cli.main", "Main": "cpl_cli.main",
"EntryPoint": "cpl", "EntryPoint": "cpl",
"IncludePackageData": "False", "IncludePackageData": "False",
"Included": [], "Included": [
"*/templates"
],
"Excluded": [ "Excluded": [
"*/__pycache__", "*/__pycache__",
"*/logs", "*/logs",

View File

@ -72,12 +72,22 @@ class Publisher(PublisherABC):
Console.error(f'{e}') Console.error(f'{e}')
exit() exit()
def _is_path_included(self, path: str) -> bool:
for included in self._build_settings.included:
if included.startswith('*'):
included = included.replace('*', '')
if included in path and path not in self._build_settings.excluded:
return True
return False
def _is_path_excluded(self, path: str) -> bool: def _is_path_excluded(self, path: str) -> bool:
for excluded in self._build_settings.excluded: for excluded in self._build_settings.excluded:
if excluded.startswith('*'): if excluded.startswith('*'):
excluded = excluded.replace('*', '') excluded = excluded.replace('*', '')
if excluded in path and path not in self._build_settings.included: if excluded in path and not self._is_path_included(path):
return True return True
return False return False
@ -96,8 +106,8 @@ class Publisher(PublisherABC):
elif os.path.isfile(rel_path): elif os.path.isfile(rel_path):
self._included_files.append(rel_path) self._included_files.append(rel_path)
else: #else:
Console.error(f'Path not found: {rel_path}') # Console.error(f'Path not found: {rel_path}')
for r, d, f in os.walk(self._build_settings.source_path): for r, d, f in os.walk(self._build_settings.source_path):
for file in f: for file in f:
@ -304,4 +314,4 @@ class Publisher(PublisherABC):
Console.spinner('Generating setup_template.py:', self._create_setup) Console.spinner('Generating setup_template.py:', self._create_setup)
Console.write_line('Running setup_template.py:\n') Console.write_line('Running setup_template.py:\n')
self._run_setup() self._run_setup()
Console.spinner('Cleaning dist path:', self._clean_dist_files) # Console.spinner('Cleaning dist path:', self._clean_dist_files)

View File

@ -11,7 +11,7 @@ sh-edraft Common Python library
""" """
__title__ = 'cpl_cli.templates.new.console_old.src.tests' __title__ = 'cpl_cli.templates.new.console.src.tests'
__author__ = 'Sven Heidemann' __author__ = 'Sven Heidemann'
__license__ = 'MIT' __license__ = 'MIT'
__copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'