Fixed cpl update dev deps bug #170

This commit is contained in:
Sven Heidemann 2023-06-12 20:45:22 +02:00
parent 8dee4d8f70
commit 8e12c72b07
2 changed files with 25 additions and 10 deletions

View File

@ -154,6 +154,24 @@ class UpdateService(CommandABC):
Console.write_line(f"\tUpdate with {Pip.get_executable()} -m pip install --upgrade <package>")
Console.set_foreground_color(ForegroundColorEnum.default)
def _save_formatted_package_name_to_deps_collection(self, deps: [str], old_package: str, new_package: str):
if old_package not in deps:
return
initial_package = new_package
if "/" in new_package:
new_package = new_package.split("/")[0]
if "\r" in new_package:
new_package = new_package.replace("\r", "")
if new_package == initial_package:
return
index = self._project_settings.dependencies.index(old_package)
deps[index] = new_package
def _project_json_update_dependency(self, old_package: str, new_package: str):
"""
Writes new package version to project.json
@ -164,15 +182,12 @@ class UpdateService(CommandABC):
if self._is_simulation:
return
if old_package in self._project_settings.dependencies:
index = self._project_settings.dependencies.index(old_package)
if "/" in new_package:
new_package = new_package.split("/")[0]
if "\r" in new_package:
new_package = new_package.replace("\r", "")
self._project_settings.dependencies[index] = new_package
self._save_formatted_package_name_to_deps_collection(
self._project_settings.dependencies, old_package, new_package
)
self._save_formatted_package_name_to_deps_collection(
self._project_settings.dev_dependencies, old_package, new_package
)
config = {
ProjectSettings.__name__: SettingsHelper.get_project_settings_dict(self._project_settings),

View File

@ -4,7 +4,7 @@
"Version": {
"Major": "2023",
"Minor": "4",
"Micro": "0"
"Micro": "0.post1"
},
"Author": "Sven Heidemann",
"AuthorEmail": "sven.heidemann@sh-edraft.de",