From c52bf961e1da7c485f6d63e6ad42b1ea58a292df Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Mon, 19 Sep 2022 22:59:21 +0200 Subject: [PATCH] Added migrations to update command #114 --- src/cpl_cli/__init__.py | 4 +-- src/cpl_cli/_templates/__init__.py | 4 +-- src/cpl_cli/_templates/build/__init__.py | 4 +-- src/cpl_cli/_templates/generate/__init__.py | 4 +-- src/cpl_cli/_templates/new/__init__.py | 4 +-- .../_templates/new/console/__init__.py | 4 +-- .../_templates/new/console/source/__init__.py | 4 +-- .../new/console/source/name/__init__.py | 4 +-- .../new/console/source/tests/__init__.py | 4 +-- .../_templates/new/library/__init__.py | 4 +-- .../_templates/new/library/source/__init__.py | 4 +-- .../new/library/source/name/__init__.py | 4 +-- .../new/library/source/tests/__init__.py | 4 +-- .../_templates/new/unittest/__init__.py | 4 +-- .../new/unittest/source/__init__.py | 4 +-- .../new/unittest/source/name/__init__.py | 4 +-- src/cpl_cli/_templates/publish/__init__.py | 4 +-- src/cpl_cli/appsettings.json | 2 +- src/cpl_cli/command/__init__.py | 4 +-- src/cpl_cli/command/update_service.py | 16 +++++++++-- src/cpl_cli/configuration/__init__.py | 4 +-- src/cpl_cli/cpl-cli.json | 4 +-- src/cpl_cli/live_server/__init__.py | 4 +-- src/cpl_cli/main.py | 2 ++ src/cpl_cli/migrations/__init__.py | 26 +++++++++++++++++ src/cpl_cli/migrations/base/__init__.py | 26 +++++++++++++++++ src/cpl_cli/migrations/base/migration_abc.py | 15 ++++++++++ .../migrations/base/migration_service_abc.py | 10 +++++++ src/cpl_cli/migrations/migration_2022_10.py | 11 ++++++++ src/cpl_cli/migrations/service/__init__.py | 26 +++++++++++++++++ .../migrations/service/migration_service.py | 21 ++++++++++++++ src/cpl_cli/publish/__init__.py | 4 +-- src/cpl_cli/source_creator/__init__.py | 4 +-- src/cpl_cli/startup_migration_extension.py | 28 +++++++++++++++++++ src/cpl_cli/validators/__init__.py | 4 +-- src/cpl_core/__init__.py | 4 +-- src/cpl_core/application/__init__.py | 4 +-- src/cpl_core/configuration/__init__.py | 4 +-- src/cpl_core/console/__init__.py | 4 +-- src/cpl_core/cpl-core.json | 2 +- src/cpl_core/database/__init__.py | 4 +-- src/cpl_core/database/connection/__init__.py | 4 +-- src/cpl_core/database/context/__init__.py | 4 +-- src/cpl_core/dependency_injection/__init__.py | 4 +-- src/cpl_core/environment/__init__.py | 4 +-- src/cpl_core/logging/__init__.py | 4 +-- src/cpl_core/mailing/__init__.py | 4 +-- src/cpl_core/pipes/__init__.py | 4 +-- src/cpl_core/time/__init__.py | 4 +-- src/cpl_core/utils/__init__.py | 4 +-- src/cpl_core/utils/pip.py | 3 +- tests/custom/general/src/general/general.json | 4 +-- tools/set_version/application.py | 5 +++- tools/set_version/set-version.json | 2 +- tools/set_version/version_setter_service.py | 5 +--- 55 files changed, 266 insertions(+), 90 deletions(-) create mode 100644 src/cpl_cli/migrations/__init__.py create mode 100644 src/cpl_cli/migrations/base/__init__.py create mode 100644 src/cpl_cli/migrations/base/migration_abc.py create mode 100644 src/cpl_cli/migrations/base/migration_service_abc.py create mode 100644 src/cpl_cli/migrations/migration_2022_10.py create mode 100644 src/cpl_cli/migrations/service/__init__.py create mode 100644 src/cpl_cli/migrations/service/migration_service.py create mode 100644 src/cpl_cli/startup_migration_extension.py diff --git a/src/cpl_cli/__init__.py b/src/cpl_cli/__init__.py index 5fff379d..4bbae37d 100644 --- a/src/cpl_cli/__init__.py +++ b/src/cpl_cli/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -28,4 +28,4 @@ from .main import main from .startup import Startup VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/__init__.py b/src/cpl_cli/_templates/__init__.py index f2259902..6dd0b3da 100644 --- a/src/cpl_cli/_templates/__init__.py +++ b/src/cpl_cli/_templates/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/build/__init__.py b/src/cpl_cli/_templates/build/__init__.py index 8c366180..25c36ce1 100644 --- a/src/cpl_cli/_templates/build/__init__.py +++ b/src/cpl_cli/_templates/build/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.build' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/generate/__init__.py b/src/cpl_cli/_templates/generate/__init__.py index bc5465bd..9e9ce209 100644 --- a/src/cpl_cli/_templates/generate/__init__.py +++ b/src/cpl_cli/_templates/generate/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.generate' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/__init__.py b/src/cpl_cli/_templates/new/__init__.py index 70c30930..b8f5f011 100644 --- a/src/cpl_cli/_templates/new/__init__.py +++ b/src/cpl_cli/_templates/new/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/console/__init__.py b/src/cpl_cli/_templates/new/console/__init__.py index ecc6cf40..588cf803 100644 --- a/src/cpl_cli/_templates/new/console/__init__.py +++ b/src/cpl_cli/_templates/new/console/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/console/source/__init__.py b/src/cpl_cli/_templates/new/console/source/__init__.py index 7cbd2d69..71bda5ce 100644 --- a/src/cpl_cli/_templates/new/console/source/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/console/source/name/__init__.py b/src/cpl_cli/_templates/new/console/source/name/__init__.py index 7c7fb4d5..ecabdad5 100644 --- a/src/cpl_cli/_templates/new/console/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/name/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/console/source/tests/__init__.py b/src/cpl_cli/_templates/new/console/source/tests/__init__.py index 48183052..35990d71 100644 --- a/src/cpl_cli/_templates/new/console/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/console/source/tests/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.console.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/library/__init__.py b/src/cpl_cli/_templates/new/library/__init__.py index 079e8d06..039e8ad3 100644 --- a/src/cpl_cli/_templates/new/library/__init__.py +++ b/src/cpl_cli/_templates/new/library/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/library/source/__init__.py b/src/cpl_cli/_templates/new/library/source/__init__.py index bb0f7c2c..bdd7267d 100644 --- a/src/cpl_cli/_templates/new/library/source/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/library/source/name/__init__.py b/src/cpl_cli/_templates/new/library/source/name/__init__.py index fae94fcd..2a7012b8 100644 --- a/src/cpl_cli/_templates/new/library/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/name/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/library/source/tests/__init__.py b/src/cpl_cli/_templates/new/library/source/tests/__init__.py index 696f1ab7..2d2ca653 100644 --- a/src/cpl_cli/_templates/new/library/source/tests/__init__.py +++ b/src/cpl_cli/_templates/new/library/source/tests/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.library.source.tests' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/unittest/__init__.py b/src/cpl_cli/_templates/new/unittest/__init__.py index aad9cef8..bafaba36 100644 --- a/src/cpl_cli/_templates/new/unittest/__init__.py +++ b/src/cpl_cli/_templates/new/unittest/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.unittest' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/unittest/source/__init__.py b/src/cpl_cli/_templates/new/unittest/source/__init__.py index b93ee975..93bb9289 100644 --- a/src/cpl_cli/_templates/new/unittest/source/__init__.py +++ b/src/cpl_cli/_templates/new/unittest/source/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.unittest.source' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/new/unittest/source/name/__init__.py b/src/cpl_cli/_templates/new/unittest/source/name/__init__.py index e880d1f9..970e34f1 100644 --- a/src/cpl_cli/_templates/new/unittest/source/name/__init__.py +++ b/src/cpl_cli/_templates/new/unittest/source/name/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.new.unittest.source.name' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/_templates/publish/__init__.py b/src/cpl_cli/_templates/publish/__init__.py index f12b3100..906e824e 100644 --- a/src/cpl_cli/_templates/publish/__init__.py +++ b/src/cpl_cli/_templates/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli._templates.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/appsettings.json b/src/cpl_cli/appsettings.json index 18012c59..f4dbfbf1 100644 --- a/src/cpl_cli/appsettings.json +++ b/src/cpl_cli/appsettings.json @@ -1,5 +1,5 @@ { "CLI": { - "PipPath": "https://pip-exp.sh-edraft.de" + "PipPath": "https://pip.sh-edraft.de" } } \ No newline at end of file diff --git a/src/cpl_cli/command/__init__.py b/src/cpl_cli/command/__init__.py index 2b3819b7..5f6aa054 100644 --- a/src/cpl_cli/command/__init__.py +++ b/src/cpl_cli/command/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.command' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -29,4 +29,4 @@ from .publish_service import PublishService from .version_service import VersionService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/command/update_service.py b/src/cpl_cli/command/update_service.py index b614e7d5..6a2c8712 100644 --- a/src/cpl_cli/command/update_service.py +++ b/src/cpl_cli/command/update_service.py @@ -4,6 +4,7 @@ import subprocess import textwrap from cpl_cli.configuration.venv_helper_service import VenvHelper +from cpl_cli.migrations.base.migration_service_abc import MigrationServiceABC from cpl_core.configuration.configuration_abc import ConfigurationABC from cpl_core.console.console import Console from cpl_core.console.foreground_color_enum import ForegroundColorEnum @@ -23,7 +24,8 @@ class UpdateService(CommandABC): env: ApplicationEnvironmentABC, build_settings: BuildSettings, project_settings: ProjectSettings, - cli_settings: CLISettings): + cli_settings: CLISettings, + migrations: MigrationServiceABC): """ Service for the CLI command update :param config: @@ -39,6 +41,7 @@ class UpdateService(CommandABC): self._build_settings = build_settings self._project_settings = project_settings self._cli_settings = cli_settings + self._migrations = migrations self._is_simulation = False self._project_file = f'{self._project_settings.name}.json' @@ -56,7 +59,7 @@ class UpdateService(CommandABC): :return: """ dependencies = [] - for package in self._project_settings.dependencies: + for package in [*self._project_settings.dependencies, *self._project_settings.dev_dependencies]: name = package if '==' in package: name = package.split('==')[0] @@ -105,6 +108,15 @@ class UpdateService(CommandABC): spinner_foreground_color=ForegroundColorEnum.cyan ) + if 'cpl-cli' in [y for x, y in dependencies]: + import cpl_cli + + Console.spinner( + 'Running migrations', self._migrations.migrate_from, cpl_cli.__version__, + text_foreground_color=ForegroundColorEnum.green, + spinner_foreground_color=ForegroundColorEnum.cyan + ) + Console.write_line(f'Found {len(self._project_settings.dependencies)} dependencies.') @staticmethod diff --git a/src/cpl_cli/configuration/__init__.py b/src/cpl_cli/configuration/__init__.py index 0c630aae..6be788cd 100644 --- a/src/cpl_cli/configuration/__init__.py +++ b/src/cpl_cli/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -31,4 +31,4 @@ from .workspace_settings import WorkspaceSettings from .workspace_settings_name_enum import WorkspaceSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/cpl-cli.json b/src/cpl_cli/cpl-cli.json index 8894bf82..c29fc4a6 100644 --- a/src/cpl_cli/cpl-cli.json +++ b/src/cpl_cli/cpl-cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "10", - "Micro": "rc2" + "Micro": "11" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "cpl-core>=2022.10.rc2" + "cpl-core>=2022.10.11" ], "DevDependencies": [], "PythonVersion": ">=3.10", diff --git a/src/cpl_cli/live_server/__init__.py b/src/cpl_cli/live_server/__init__.py index 29528999..4a9ad1df 100644 --- a/src/cpl_cli/live_server/__init__.py +++ b/src/cpl_cli/live_server/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.live_server' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/main.py b/src/cpl_cli/main.py index 4ee21688..df1c6a9a 100644 --- a/src/cpl_cli/main.py +++ b/src/cpl_cli/main.py @@ -5,6 +5,7 @@ import pkg_resources from cpl_cli.cli import CLI from cpl_cli.startup import Startup from cpl_cli.startup_argument_extension import StartupArgumentExtension +from cpl_cli.startup_migration_extension import StartupMigrationExtension from cpl_cli.startup_workspace_extension import StartupWorkspaceExtension from cpl_core.application.application_builder import ApplicationBuilder from cpl_core.application.startup_extension_abc import StartupExtensionABC @@ -34,6 +35,7 @@ def main(): app_builder.use_startup(Startup) app_builder.use_extension(StartupWorkspaceExtension) app_builder.use_extension(StartupArgumentExtension) + app_builder.use_extension(StartupMigrationExtension) for extension in get_startup_extensions(): app_builder.use_extension(extension) diff --git a/src/cpl_cli/migrations/__init__.py b/src/cpl_cli/migrations/__init__.py new file mode 100644 index 00000000..7a275c97 --- /dev/null +++ b/src/cpl_cli/migrations/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +""" +cpl-cli sh-edraft Common Python library CLI +~~~~~~~~~~~~~~~~~~~ + +sh-edraft Common Python library Command Line Interface + +:copyright: (c) 2020 - 2022 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = 'cpl_cli.migrations' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' +__version__ = '2022.10.11' + +from collections import namedtuple + + +# imports + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/migrations/base/__init__.py b/src/cpl_cli/migrations/base/__init__.py new file mode 100644 index 00000000..970b6cdf --- /dev/null +++ b/src/cpl_cli/migrations/base/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +""" +cpl-cli sh-edraft Common Python library CLI +~~~~~~~~~~~~~~~~~~~ + +sh-edraft Common Python library Command Line Interface + +:copyright: (c) 2020 - 2022 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = 'cpl_cli.migrations.base' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' +__version__ = '2022.10.11' + +from collections import namedtuple + + +# imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/migrations/base/migration_abc.py b/src/cpl_cli/migrations/base/migration_abc.py new file mode 100644 index 00000000..47fc71f7 --- /dev/null +++ b/src/cpl_cli/migrations/base/migration_abc.py @@ -0,0 +1,15 @@ +from abc import ABC, abstractmethod + + +class MigrationABC(ABC): + + @abstractmethod + def __init__(self, version: str): + self._version = version + + @property + def version(self) -> str: + return self._version + + @abstractmethod + def migrate(self): pass diff --git a/src/cpl_cli/migrations/base/migration_service_abc.py b/src/cpl_cli/migrations/base/migration_service_abc.py new file mode 100644 index 00000000..37ec0e3f --- /dev/null +++ b/src/cpl_cli/migrations/base/migration_service_abc.py @@ -0,0 +1,10 @@ +from abc import ABC, abstractmethod + + +class MigrationServiceABC(ABC): + + @abstractmethod + def __init__(self): pass + + @abstractmethod + def migrate_from(self, version: str): pass diff --git a/src/cpl_cli/migrations/migration_2022_10.py b/src/cpl_cli/migrations/migration_2022_10.py new file mode 100644 index 00000000..6c5bc2f3 --- /dev/null +++ b/src/cpl_cli/migrations/migration_2022_10.py @@ -0,0 +1,11 @@ +from cpl_cli.migrations.base.migration_abc import MigrationABC + + +class Migration202210(MigrationABC): + + def __init__(self): + MigrationABC.__init__(self, '2022.10') + + def migrate(self): + # This migration could be deleted, but stays as an example. + pass diff --git a/src/cpl_cli/migrations/service/__init__.py b/src/cpl_cli/migrations/service/__init__.py new file mode 100644 index 00000000..61867982 --- /dev/null +++ b/src/cpl_cli/migrations/service/__init__.py @@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- + +""" +cpl-cli sh-edraft Common Python library CLI +~~~~~~~~~~~~~~~~~~~ + +sh-edraft Common Python library Command Line Interface + +:copyright: (c) 2020 - 2022 sh-edraft.de +:license: MIT, see LICENSE for more details. + +""" + +__title__ = 'cpl_cli.migrations.service' +__author__ = 'Sven Heidemann' +__license__ = 'MIT' +__copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' +__version__ = '2022.10.11' + +from collections import namedtuple + + +# imports: + +VersionInfo = namedtuple('VersionInfo', 'major minor micro') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/migrations/service/migration_service.py b/src/cpl_cli/migrations/service/migration_service.py new file mode 100644 index 00000000..403e57a1 --- /dev/null +++ b/src/cpl_cli/migrations/service/migration_service.py @@ -0,0 +1,21 @@ +from packaging import version + +from cpl_cli.migrations.base.migration_abc import MigrationABC +from cpl_cli.migrations.base.migration_service_abc import MigrationServiceABC +from cpl_core.dependency_injection import ServiceProviderABC + + +class MigrationService(MigrationServiceABC): + + def __init__(self, services: ServiceProviderABC): + MigrationServiceABC.__init__(self) + + self._services = services + + def migrate_from(self, _v: str): + for migration_type in MigrationABC.__subclasses__(): + migration: MigrationABC = self._services.get_service(migration_type) + if version.parse(migration.version) <= version.parse(_v): + continue + + migration.migrate() diff --git a/src/cpl_cli/publish/__init__.py b/src/cpl_cli/publish/__init__.py index f8a6397e..a01cb3d9 100644 --- a/src/cpl_cli/publish/__init__.py +++ b/src/cpl_cli/publish/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.publish' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -25,4 +25,4 @@ from .publisher_abc import PublisherABC from .publisher_service import PublisherService VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/source_creator/__init__.py b/src/cpl_cli/source_creator/__init__.py index 9db1b689..175d9732 100644 --- a/src/cpl_cli/source_creator/__init__.py +++ b/src/cpl_cli/source_creator/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.source_creator' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_cli/startup_migration_extension.py b/src/cpl_cli/startup_migration_extension.py new file mode 100644 index 00000000..a7a6f5d1 --- /dev/null +++ b/src/cpl_cli/startup_migration_extension.py @@ -0,0 +1,28 @@ +import os +from typing import Optional + +from cpl_cli.command.custom_script_service import CustomScriptService +from cpl_cli.configuration.workspace_settings import WorkspaceSettings +from cpl_cli.migrations.base.migration_abc import MigrationABC +from cpl_cli.migrations.base.migration_service_abc import MigrationServiceABC +from cpl_cli.migrations.migration_2022_10 import Migration202210 +from cpl_cli.migrations.service.migration_service import MigrationService +from cpl_core.application.startup_extension_abc import StartupExtensionABC +from cpl_core.configuration.argument_type_enum import ArgumentTypeEnum +from cpl_core.configuration.configuration_abc import ConfigurationABC +from cpl_core.dependency_injection.service_collection_abc import ServiceCollectionABC +from cpl_core.environment.application_environment_abc import ApplicationEnvironmentABC +from cpl_core.utils.string import String + + +class StartupMigrationExtension(StartupExtensionABC): + + def __init__(self): + pass + + def configure_configuration(self, config: ConfigurationABC, env: ApplicationEnvironmentABC): + pass + + def configure_services(self, services: ServiceCollectionABC, env: ApplicationEnvironmentABC): + services.add_singleton(MigrationServiceABC, MigrationService) + services.add_singleton(MigrationABC, Migration202210) diff --git a/src/cpl_cli/validators/__init__.py b/src/cpl_cli/validators/__init__.py index 26e7a49d..c13c3e31 100644 --- a/src/cpl_cli/validators/__init__.py +++ b/src/cpl_cli/validators/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_cli.validators' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/__init__.py b/src/cpl_core/__init__.py index 4da375b9..58dc1553 100644 --- a/src/cpl_core/__init__.py +++ b/src/cpl_core/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -23,4 +23,4 @@ from collections import namedtuple # imports: VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/application/__init__.py b/src/cpl_core/application/__init__.py index c9030d17..1b69e9be 100644 --- a/src/cpl_core/application/__init__.py +++ b/src/cpl_core/application/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.application' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -29,4 +29,4 @@ from .startup_abc import StartupABC from .startup_extension_abc import StartupExtensionABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/configuration/__init__.py b/src/cpl_core/configuration/__init__.py index f796189e..0410250a 100644 --- a/src/cpl_core/configuration/__init__.py +++ b/src/cpl_core/configuration/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.configuration' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -35,4 +35,4 @@ from .validator_abc import ValidatorABC from .variable_argument import VariableArgument VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/console/__init__.py b/src/cpl_core/console/__init__.py index e7dc9875..7f6acf03 100644 --- a/src/cpl_core/console/__init__.py +++ b/src/cpl_core/console/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.console' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -28,4 +28,4 @@ from .foreground_color_enum import ForegroundColorEnum from .spinner_thread import SpinnerThread VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/cpl-core.json b/src/cpl_core/cpl-core.json index 3f973dde..1f9203dd 100644 --- a/src/cpl_core/cpl-core.json +++ b/src/cpl_core/cpl-core.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "10", - "Micro": "rc2" + "Micro": "11" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_core/database/__init__.py b/src/cpl_core/database/__init__.py index d3505874..ff8c7ef7 100644 --- a/src/cpl_core/database/__init__.py +++ b/src/cpl_core/database/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -26,4 +26,4 @@ from .database_settings import DatabaseSettings from .table_abc import TableABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/database/connection/__init__.py b/src/cpl_core/database/connection/__init__.py index d242dbee..c5acb3fa 100644 --- a/src/cpl_core/database/connection/__init__.py +++ b/src/cpl_core/database/connection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.connection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -25,4 +25,4 @@ from .database_connection import DatabaseConnection from .database_connection_abc import DatabaseConnectionABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/database/context/__init__.py b/src/cpl_core/database/context/__init__.py index 7342347f..522a1f56 100644 --- a/src/cpl_core/database/context/__init__.py +++ b/src/cpl_core/database/context/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.database.context' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -25,4 +25,4 @@ from .database_context import DatabaseContext from .database_context_abc import DatabaseContextABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/dependency_injection/__init__.py b/src/cpl_core/dependency_injection/__init__.py index e326f817..a21f15d2 100644 --- a/src/cpl_core/dependency_injection/__init__.py +++ b/src/cpl_core/dependency_injection/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.dependency_injection' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -31,4 +31,4 @@ from .service_provider import ServiceProvider from .service_provider_abc import ServiceProviderABC VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/environment/__init__.py b/src/cpl_core/environment/__init__.py index b93fe1eb..9e33c3e7 100644 --- a/src/cpl_core/environment/__init__.py +++ b/src/cpl_core/environment/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.environment' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -26,4 +26,4 @@ from .environment_name_enum import EnvironmentNameEnum from .application_environment import ApplicationEnvironment VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/logging/__init__.py b/src/cpl_core/logging/__init__.py index 37ba6650..9356a6cb 100644 --- a/src/cpl_core/logging/__init__.py +++ b/src/cpl_core/logging/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.logging' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -28,4 +28,4 @@ from .logging_settings import LoggingSettings from .logging_settings_name_enum import LoggingSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/mailing/__init__.py b/src/cpl_core/mailing/__init__.py index 1a075c26..a770c7d5 100644 --- a/src/cpl_core/mailing/__init__.py +++ b/src/cpl_core/mailing/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.mailing' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -28,4 +28,4 @@ from .email_client_settings import EMailClientSettings from .email_client_settings_name_enum import EMailClientSettingsNameEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/pipes/__init__.py b/src/cpl_core/pipes/__init__.py index cb969acf..5bdb908b 100644 --- a/src/cpl_core/pipes/__init__.py +++ b/src/cpl_core/pipes/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.pipes' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -30,4 +30,4 @@ from .to_camel_case_pipe import ToCamelCasePipe from .to_snake_case_pipe import ToSnakeCasePipe VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/time/__init__.py b/src/cpl_core/time/__init__.py index 68baeeee..14591bb7 100644 --- a/src/cpl_core/time/__init__.py +++ b/src/cpl_core/time/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.time' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -25,4 +25,4 @@ from .time_format_settings import TimeFormatSettings from .time_format_settings_names_enum import TimeFormatSettingsNamesEnum VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/utils/__init__.py b/src/cpl_core/utils/__init__.py index cfc19330..416e1b9c 100644 --- a/src/cpl_core/utils/__init__.py +++ b/src/cpl_core/utils/__init__.py @@ -15,7 +15,7 @@ __title__ = 'cpl_core.utils' __author__ = 'Sven Heidemann' __license__ = 'MIT' __copyright__ = 'Copyright (c) 2020 - 2022 sh-edraft.de' -__version__ = '2022.10rc2' +__version__ = '2022.10.11' from collections import namedtuple @@ -26,4 +26,4 @@ from .string import String from .pip import Pip VersionInfo = namedtuple('VersionInfo', 'major minor micro') -version_info = VersionInfo(major='2022', minor='10', micro='rc2') +version_info = VersionInfo(major='2022', minor='10', micro='11') diff --git a/src/cpl_core/utils/pip.py b/src/cpl_core/utils/pip.py index b2302780..f98a5884 100644 --- a/src/cpl_core/utils/pip.py +++ b/src/cpl_core/utils/pip.py @@ -74,9 +74,8 @@ class Pip: if result is None: return None - for p in str(result.decode()).split('\n'): - if p == package: + if p.startswith(package): return p return None diff --git a/tests/custom/general/src/general/general.json b/tests/custom/general/src/general/general.json index 90a2fd38..0bf4dded 100644 --- a/tests/custom/general/src/general/general.json +++ b/tests/custom/general/src/general/general.json @@ -17,8 +17,8 @@ "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ "cpl-core==2022.10rc2", - "cpl-translation==2022.7.0.post2", - "cpl-query==2022.7.0" + "cpl-translation==2022.10rc2", + "cpl-query==2022.10rc2" ], "DevDependencies": [ "cpl-cli==2022.10.rc2" diff --git a/tools/set_version/application.py b/tools/set_version/application.py index 3c52a69c..2a22e73b 100644 --- a/tools/set_version/application.py +++ b/tools/set_version/application.py @@ -61,7 +61,10 @@ class Application(ApplicationABC): if len(branch.split('.')) == 2: version[VersionSettingsNameEnum.micro.value] = f'0{suffix}' else: - version[VersionSettingsNameEnum.micro.value] = f'{branch.split(".")[2]}{suffix}' + branch_version = branch.split(".")[2] + if '-#' in branch_version: + branch_version = branch_version.split('-#')[0] + version[VersionSettingsNameEnum.micro.value] = f'{branch_version}{suffix}' except Exception as e: Console.error(f'Branch {branch} does not contain valid version') return diff --git a/tools/set_version/set-version.json b/tools/set_version/set-version.json index 5dc5525c..9e35a425 100644 --- a/tools/set_version/set-version.json +++ b/tools/set_version/set-version.json @@ -16,7 +16,7 @@ "LicenseName": "MIT", "LicenseDescription": "MIT, see LICENSE for more details.", "Dependencies": [ - "cpl-core>=2022.10.rc2", + "cpl-core>=2022.10.11", "gitpython==3.1.27" ], "PythonVersion": ">=3.10.4", diff --git a/tools/set_version/version_setter_service.py b/tools/set_version/version_setter_service.py index f9abfdae..d00a0c08 100644 --- a/tools/set_version/version_setter_service.py +++ b/tools/set_version/version_setter_service.py @@ -2,11 +2,8 @@ import json import os from string import ascii_letters -from cpl_core.utils import String - -from cpl_core.console import Console - from cpl_core.environment import ApplicationEnvironmentABC +from cpl_core.utils import String class VersionSetterService: