Added logic to handle cpl deps

This commit is contained in:
Sven Heidemann 2022-05-25 17:04:18 +02:00
parent 1ab358059c
commit ac83555b24
4 changed files with 19 additions and 5 deletions

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "15.dev2" "Micro": "15.dev3"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de", "AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,7 +16,7 @@
"LicenseName": "MIT", "LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.", "LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.15.dev2" "cpl-core>=2022.6.15.dev3"
], ],
"PythonVersion": ">=3.10", "PythonVersion": ">=3.10",
"PythonPath": {}, "PythonPath": {},

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "15.dev2" "Micro": "15.dev3"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de", "AuthorEmail": "sven.heidemann@sh-edraft.de",

View File

@ -4,7 +4,7 @@
"Version": { "Version": {
"Major": "2022", "Major": "2022",
"Minor": "6", "Minor": "6",
"Micro": "15.dev2" "Micro": "15.dev3"
}, },
"Author": "Sven Heidemann", "Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de", "AuthorEmail": "sven.heidemann@sh-edraft.de",
@ -16,7 +16,7 @@
"LicenseName": "MIT", "LicenseName": "MIT",
"LicenseDescription": "MIT, see LICENSE for more details.", "LicenseDescription": "MIT, see LICENSE for more details.",
"Dependencies": [ "Dependencies": [
"cpl-core>=2022.6.15.dev2" "cpl-core>=2022.6.15.dev3"
], ],
"PythonVersion": ">=3.10", "PythonVersion": ">=3.10",
"PythonPath": {}, "PythonPath": {},

View File

@ -1,6 +1,8 @@
import json import json
import os import os
from cpl_core.console import Console
from cpl_core.environment import ApplicationEnvironmentABC from cpl_core.environment import ApplicationEnvironmentABC
@ -17,6 +19,18 @@ class VersionSetterService:
f.close() f.close()
project_json['ProjectSettings']['Version'] = version 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: 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.write(json.dumps(project_json, indent=2))
f.close() f.close()