From 5669807628e1755c22785c81f49795ff64f75889 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 17 Mar 2021 07:59:12 +0100 Subject: [PATCH] Bugfixes in install command --- src/cpl/configuration/configuration.py | 2 +- src/cpl_cli/command/install_service.py | 28 +++++++++++++------------- src/cpl_cli/startup.py | 3 +-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/cpl/configuration/configuration.py b/src/cpl/configuration/configuration.py index e8ce538d..d10f4056 100644 --- a/src/cpl/configuration/configuration.py +++ b/src/cpl/configuration/configuration.py @@ -194,7 +194,7 @@ class Configuration(ConfigurationABC): if alias in argument: found = True - if argument_type.name not in argument_name and not found: + if argument_type.name not in argument and not found: return False if (next_arguments is None or len(next_arguments) == 0) and \ diff --git a/src/cpl_cli/command/install_service.py b/src/cpl_cli/command/install_service.py index 7fdd94a1..baf33b89 100644 --- a/src/cpl_cli/command/install_service.py +++ b/src/cpl_cli/command/install_service.py @@ -126,28 +126,28 @@ class InstallService(CommandABC): return if not is_already_in_project: - new_package = Pip.get_package(package) - if new_package is not None: - if '==' in package: - new_package = package - else: - new_package = name + new_name = package + if '==' in new_package: + new_name = new_package + elif '==' in name: + new_name = name - if '/' in new_package: - new_package = new_package.split('/')[0] + if '/' in new_name: + new_name = new_name.split('/')[0] - if '\r' in new_package: - new_package = new_package.replace('\r', '') + if '\r' in new_name: + new_name = new_name.replace('\r', '') - self._project_settings.dependencies.append(new_package) + self._project_settings.dependencies.append(new_name) config = { ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(self._project_settings), BuildSettings.__name__: SettingsHelper.get_build_settings_dict(self._build_settings) } - with open(os.path.join(self._runtime.working_directory, 'cpl.json'), 'w') as project_file: - project_file.write(json.dumps(config, indent=2)) - project_file.close() + + #with open(os.path.join(self._runtime.working_directory, 'cpl.json'), 'w') as project_file: + # project_file.write(json.dumps(config, indent=2)) + # project_file.close() Pip.reset_executable() diff --git a/src/cpl_cli/startup.py b/src/cpl_cli/startup.py index 0cfdd4a9..627b24b3 100644 --- a/src/cpl_cli/startup.py +++ b/src/cpl_cli/startup.py @@ -66,8 +66,7 @@ class Startup(StartupABC): ])) self._configuration.add_console_argument(ConsoleArgument('', 'publish', ['p', 'P'], '')) self._configuration.add_console_argument(ConsoleArgument('', 'start', ['s', 'S'], '')) - self._configuration.add_console_argument( - ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' ', is_value_token_optional=True)) + self._configuration.add_console_argument(ConsoleArgument('', 'uninstall', ['ui', 'UI'], ' ')) self._configuration.add_console_argument(ConsoleArgument('', 'update', ['u', 'U'], '')) self._configuration.add_console_argument(ConsoleArgument('', 'version', ['v', 'V'], '')) self._configuration.add_console_arguments(error=False)