From aecde93310b307b9bea574ca00c59d6bcc50d40a Mon Sep 17 00:00:00 2001 From: rubenwardy Date: Sun, 23 Jun 2024 11:12:49 +0100 Subject: [PATCH] Fix issue when updating game support on multiple dependers --- app/logic/game_support.py | 6 ++++-- app/tests/unit/logic/test_game_support.py | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/logic/game_support.py b/app/logic/game_support.py index 1fec9e34..af12799a 100644 --- a/app/logic/game_support.py +++ b/app/logic/game_support.py @@ -228,8 +228,6 @@ def on_update(self, package: GSPackage, old_provides: Optional[set[str]] = None) while len(to_update) > 0: current_package = to_update.pop() if current_package.id_ in self.packages and current_package.type != PackageType.GAME: - current_package.is_confirmed = False - current_package.detected_supported_games = [] self._get_supported_games(current_package, []) provides = current_package.provides @@ -239,6 +237,10 @@ def on_update(self, package: GSPackage, old_provides: Optional[set[str]] = None) for modname in provides: for depending_package in self.get_all_that_depend_on(modname): if depending_package not in checked: + if depending_package.id_ in self.packages and depending_package.type != PackageType.GAME: + depending_package.is_confirmed = False + depending_package.detected_supported_games = [] + to_update.add(depending_package) checked.add(depending_package) diff --git a/app/tests/unit/logic/test_game_support.py b/app/tests/unit/logic/test_game_support.py index 70d02dad..5c2416d1 100644 --- a/app/tests/unit/logic/test_game_support.py +++ b/app/tests/unit/logic/test_game_support.py @@ -285,7 +285,8 @@ def test_update_new_mod(): support.add(make_game("game1", ["default"])) support.add(make_game("game2", ["core", "mod_b"])) lib = support.add(make_mod("lib", ["lib"], [])) - modA = support.add(make_mod("mod_a", ["mod_a"], ["mod_b", "lib"])) + modC = support.add(make_mod("mod_c", ["mod_c"], ["mod_b"])) + modA = support.add(make_mod("mod_a", ["mod_a"], ["mod_b", "mod_c", "lib"])) support.on_update(modA) assert not support.has_errors @@ -293,6 +294,9 @@ def test_update_new_mod(): assert modA.is_confirmed assert modA.detected_supported_games == {"game2"} + assert modC.is_confirmed + assert modC.detected_supported_games == {"game2"} + assert lib.is_confirmed assert len(lib.detected_supported_games) == 0 @@ -307,6 +311,9 @@ def test_update_new_mod(): assert modB.is_confirmed assert modB.detected_supported_games == {"game1"} + assert modC.is_confirmed + assert modC.detected_supported_games == {"game1", "game2"} + assert lib.is_confirmed assert len(lib.detected_supported_games) == 0