diff --git a/app/logic/game_support.py b/app/logic/game_support.py index af12799a..c390eab2 100644 --- a/app/logic/game_support.py +++ b/app/logic/game_support.py @@ -93,12 +93,10 @@ class GSPackage: class GameSupport: packages: Dict[str, GSPackage] modified_packages: set[GSPackage] - dependency_cache: Dict[str, Tuple[Optional[bool], Optional[set[str]]]] def __init__(self): self.packages = {} self.modified_packages = set() - self.dependency_cache = {} @property def all_confirmed(self): @@ -136,11 +134,6 @@ class GameSupport: def _get_supported_games_for_modname(self, depend: str, visited: list[str]): dep_supports_all = False for_dep = set() - - if depend in self.dependency_cache: - dep_supports_all, for_dep = self.dependency_cache[depend] - return dep_supports_all, for_dep - for provider in self.get_all_that_provide(depend): found_in = self._get_supported_games(provider, visited) if found_in is None: @@ -152,7 +145,6 @@ class GameSupport: else: for_dep.update(found_in) - self.dependency_cache[depend] = (dep_supports_all, for_dep) return dep_supports_all, for_dep def _get_supported_games_for_deps(self, package: GSPackage, visited: list[str]) -> Optional[set[str]]: @@ -221,7 +213,6 @@ class GameSupport: return package.supported_games def on_update(self, package: GSPackage, old_provides: Optional[set[str]] = None): - self.dependency_cache = {} to_update = {package} checked = set() @@ -245,12 +236,10 @@ class GameSupport: checked.add(depending_package) def on_remove(self, package: GSPackage): - self.dependency_cache = {} del self.packages[package.id_] self.on_update(package) def on_first_run(self): - self.dependency_cache = {} for package in self.packages.values(): if not package.is_confirmed: self.on_update(package) diff --git a/app/tests/unit/logic/test_game_support.py b/app/tests/unit/logic/test_game_support.py index 5c2416d1..c14f81e6 100644 --- a/app/tests/unit/logic/test_game_support.py +++ b/app/tests/unit/logic/test_game_support.py @@ -206,6 +206,8 @@ def test_cycle(): assert support.all_errors == { "author/mod_b: Dependency cycle detected: author/mod_a -> author/mod_b -> author/mod_a", "author/mod_a: Dependency cycle detected: author/mod_a -> author/mod_b -> author/mod_a", + "author/mod_b: Dependency cycle detected: author/mod_b -> author/mod_a -> author/mod_b", + "author/mod_a: Dependency cycle detected: author/mod_b -> author/mod_a -> author/mod_b", "author/mod_b: Unable to fulfill dependency mod_a", "author/mod_a: Unable to fulfill dependency mod_b" } @@ -382,6 +384,8 @@ def test_update_cycle(): assert support.all_errors == { "author/mod_c: Dependency cycle detected: author/mod_a -> author/mod_c -> author/mod_a", "author/mod_a: Dependency cycle detected: author/mod_a -> author/mod_c -> author/mod_a", + "author/mod_c: Dependency cycle detected: author/mod_c -> author/mod_a -> author/mod_c", + "author/mod_a: Dependency cycle detected: author/mod_c -> author/mod_a -> author/mod_c", "author/mod_a: Unable to fulfill dependency mod_c", "author/mod_c: Unable to fulfill dependency mod_a" }