2025-11-16 11:39:27 +01:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
|
|
from argparse import Namespace, ArgumentParser
|
|
|
|
|
|
2026-01-25 15:18:27 +01:00
|
|
|
from ...lib.log import *
|
2025-11-16 11:39:27 +01:00
|
|
|
from ..Cmd import Cmd
|
2026-01-27 10:22:16 +01:00
|
|
|
from ..CmdProjects import CmdProjects
|
2025-11-16 11:39:27 +01:00
|
|
|
|
|
|
|
|
class CmdCheck(Cmd): # export
|
|
|
|
|
|
2026-01-27 10:22:16 +01:00
|
|
|
def __init__(self, parent: CmdProjects) -> None:
|
|
|
|
|
super().__init__(parent, 'check', help='Check for circular dependencies between given modules')
|
2025-11-16 11:39:27 +01:00
|
|
|
|
|
|
|
|
def add_arguments(self, parser: ArgumentParser) -> None:
|
|
|
|
|
super().add_arguments(parser)
|
|
|
|
|
parser.add_argument('module', nargs='*', help='Modules')
|
|
|
|
|
parser.add_argument('-f', '--flavour', nargs='?', default = 'build')
|
|
|
|
|
|
2026-01-27 14:31:25 +01:00
|
|
|
async def _run(self, args: Namespace) -> None:
|
2026-01-29 10:58:51 +01:00
|
|
|
path = self.app.find_circular_deps(args.module, args.flavour)
|
|
|
|
|
if path:
|
|
|
|
|
print(f'Found circular dependency in flavour {args.flavour}:', ' -> '.join(path))
|
|
|
|
|
exit(1)
|
|
|
|
|
print(f'No circular dependency found for flavour {args.flavour} in modules:', ' '.join(args.module))
|