Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/aedifix/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ def gen_summary() -> Iterator[str]:
"$ make",
]

from .packages.python import Python
from .packages import Python

if self._get_package(Python).state.enabled():
install_mess.extend(
Expand All @@ -507,8 +507,12 @@ def _collect_deps(self) -> set[type[Package]]:
# that are reachable starting from the main package dependencies.
# ref: https://en.wikipedia.org/wiki/Depth-first_search#Pseudocode

from .packages import _all_default_packages

seen: set[type[Package]] = set()
stack: list[type[Package]] = list(self._main_package.dependencies)
stack: list[type[Package]] = (
list(self._main_package.dependencies) + _all_default_packages()
)

while stack:
if (dep := stack.pop()) not in seen:
Expand Down
17 changes: 17 additions & 0 deletions src/aedifix/packages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,20 @@
# All rights reserved.
# SPDX-License-Identifier: Apache-2.0
from __future__ import annotations

from typing import TYPE_CHECKING

if TYPE_CHECKING:
from ..package.package import Package


from .cmake import CMake
from .cuda import CUDA
from .python import Python


def _all_default_packages() -> list[type[Package]]:
return [CMake, CUDA, Python]


__all__ = ("CUDA", "CMake", "Python")
5 changes: 4 additions & 1 deletion tests/test_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,12 @@ def test_create(
def test_setup(self, AEDIFIX_PYTEST_ARCH: str) -> None:
manager = ConfigurationManager((), DummyMainModule)
orig_argv = deepcopy(manager.argv)
# Only the main module
assert len(manager._modules) == 1
manager.setup()
assert len(manager._modules) == 1
# 4 modules: The main module, and the default modules (currently only
# 3, CMake, CUDA, and Python).
assert len(manager._modules) == 4
assert manager.argv == orig_argv
assert (
CLArg(
Expand Down
Loading