From ac83555b247deffded236cb31e88acfb6f2d69c0 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 25 May 2022 17:04:18 +0200 Subject: [PATCH] Added logic to handle cpl deps --- src/cpl_cli/cpl_cli.json | 4 ++-- src/cpl_core/cpl_core.json | 2 +- src/cpl_query/cpl_query.json | 4 ++-- tools/set_version/version_setter_service.py | 14 ++++++++++++++ 4 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/cpl_cli/cpl_cli.json b/src/cpl_cli/cpl_cli.json index 78d9f95d..76cc17ca 100644 --- a/src/cpl_cli/cpl_cli.json +++ b/src/cpl_cli/cpl_cli.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "15.dev2" + "Micro": "15.dev3" }, "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.6.15.dev2" + "cpl-core>=2022.6.15.dev3" ], "PythonVersion": ">=3.10", "PythonPath": {}, diff --git a/src/cpl_core/cpl_core.json b/src/cpl_core/cpl_core.json index 9617a5e3..db51db87 100644 --- a/src/cpl_core/cpl_core.json +++ b/src/cpl_core/cpl_core.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "15.dev2" + "Micro": "15.dev3" }, "Author": "Sven Heidemann", "AuthorEmail": "sven.heidemann@sh-edraft.de", diff --git a/src/cpl_query/cpl_query.json b/src/cpl_query/cpl_query.json index 420e88e6..d55fe4f5 100644 --- a/src/cpl_query/cpl_query.json +++ b/src/cpl_query/cpl_query.json @@ -4,7 +4,7 @@ "Version": { "Major": "2022", "Minor": "6", - "Micro": "15.dev2" + "Micro": "15.dev3" }, "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.6.15.dev2" + "cpl-core>=2022.6.15.dev3" ], "PythonVersion": ">=3.10", "PythonPath": {}, diff --git a/tools/set_version/version_setter_service.py b/tools/set_version/version_setter_service.py index 8d7c17d2..e56ab20b 100644 --- a/tools/set_version/version_setter_service.py +++ b/tools/set_version/version_setter_service.py @@ -1,6 +1,8 @@ import json import os +from cpl_core.console import Console + from cpl_core.environment import ApplicationEnvironmentABC @@ -17,6 +19,18 @@ class VersionSetterService: f.close() project_json['ProjectSettings']['Version'] = version + dependencies = project_json['ProjectSettings']['Dependencies'] + new_deps = [] + for dependency in dependencies: + if not dependency.startswith('cpl-'): + new_deps.append(dependency) + continue + + dep_version = dependency.split('=')[1] + new_deps.append(dependency.replace(dep_version, f'{version["Major"]}.{version["Minor"]}.{version["Micro"]}')) + + project_json['ProjectSettings']['Dependencies'] = new_deps + with open(os.path.join(self._env.working_directory, file), 'w', encoding='utf-8') as f: f.write(json.dumps(project_json, indent=2)) f.close()