From 9f4077a0732ad540d100a92096e1aace16629d87 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 25 May 2022 13:11:41 +0200 Subject: [PATCH] Improved configuration --- src/cpl_core/configuration/configuration.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/cpl_core/configuration/configuration.py b/src/cpl_core/configuration/configuration.py index a0d1c6c1..d4a83eb9 100644 --- a/src/cpl_core/configuration/configuration.py +++ b/src/cpl_core/configuration/configuration.py @@ -5,8 +5,6 @@ import traceback from collections.abc import Callable from typing import Union, Type, Optional -from cpl_cli.command.custom_script_service import CustomScriptService -from cpl_cli.configuration import WorkspaceSettings from cpl_core.configuration.argument_abc import ArgumentABC from cpl_core.configuration.argument_builder import ArgumentBuilder from cpl_core.configuration.argument_executable_abc import ArgumentExecutableABC @@ -158,6 +156,8 @@ class Configuration(ConfigurationABC): def _handle_pre_or_post_executables(self, pre: bool, argument: ExecutableArgument, services: ServiceProviderABC): script_type = 'pre-' if pre else 'post-' + + from cpl_cli.configuration.workspace_settings import WorkspaceSettings workspace: Optional[WorkspaceSettings] = self.get_configuration(WorkspaceSettings) if workspace is None or len(workspace.scripts) == 0: return @@ -170,12 +170,13 @@ class Configuration(ConfigurationABC): if script.split(script_type)[1] != argument.name: continue + from cpl_cli.command.custom_script_service import CustomScriptService css: CustomScriptService = services.get_service(CustomScriptService) if css is None: continue Console.write_line() - self.add_configuration('ACTIVE_EXECUTABLE', script) + self._set_variable('ACTIVE_EXECUTABLE', script) css.run([]) def _parse_arguments(self, executables: list[ArgumentABC], arg_list: list[str], args_types: list[ArgumentABC]): @@ -333,7 +334,7 @@ class Configuration(ConfigurationABC): cmd: ArgumentExecutableABC = services.get_service(exe.executable_type) self._handle_pre_or_post_executables(True, exe, services) - self.add_configuration('ACTIVE_EXECUTABLE', exe.name) + self._set_variable('ACTIVE_EXECUTABLE', exe.name) cmd.execute(self._additional_arguments) self._handle_pre_or_post_executables(False, exe, services) prevent = exe.prevent_next_executable