From 4e24662d90d84cd1506b7f39add84422dd090352 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 10 Mar 2021 14:16:03 +0100 Subject: [PATCH] Bugfixes --- cpl.json | 4 +++- src/cpl_cli/publish/publisher.py | 18 ++++++++++++++---- .../new/console/src/tests/__init__.py | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/cpl.json b/cpl.json index b6c92248..e0f0670b 100644 --- a/cpl.json +++ b/cpl.json @@ -31,7 +31,9 @@ "Main": "cpl_cli.main", "EntryPoint": "cpl", "IncludePackageData": "False", - "Included": [], + "Included": [ + "*/templates" + ], "Excluded": [ "*/__pycache__", "*/logs", diff --git a/src/cpl_cli/publish/publisher.py b/src/cpl_cli/publish/publisher.py index 58b8b12d..98c14790 100644 --- a/src/cpl_cli/publish/publisher.py +++ b/src/cpl_cli/publish/publisher.py @@ -72,12 +72,22 @@ class Publisher(PublisherABC): Console.error(f'{e}') 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: for excluded in self._build_settings.excluded: if excluded.startswith('*'): 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 False @@ -96,8 +106,8 @@ class Publisher(PublisherABC): elif os.path.isfile(rel_path): self._included_files.append(rel_path) - else: - Console.error(f'Path not found: {rel_path}') + #else: + # Console.error(f'Path not found: {rel_path}') for r, d, f in os.walk(self._build_settings.source_path): for file in f: @@ -304,4 +314,4 @@ class Publisher(PublisherABC): Console.spinner('Generating setup_template.py:', self._create_setup) Console.write_line('Running setup_template.py:\n') self._run_setup() - Console.spinner('Cleaning dist path:', self._clean_dist_files) + # Console.spinner('Cleaning dist path:', self._clean_dist_files) diff --git a/src/cpl_cli/templates/new/console/src/tests/__init__.py b/src/cpl_cli/templates/new/console/src/tests/__init__.py index 20960274..0d1131c8 100644 --- a/src/cpl_cli/templates/new/console/src/tests/__init__.py +++ b/src/cpl_cli/templates/new/console/src/tests/__init__.py @@ -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' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2021 sh-edraft.de'