jw-pkg/src/python/jw/pkg/cmds/projects/CmdCheck.py
Jan Lindemann 9b6ec109a1 cmds and lib: Don't print() log messages

print() should be used to output information requested by a certain command, but not for logging the process to achieve it. log() should be used for the latter. The current code has the distinction not down clearly, fix that.

Signed-off-by: Jan Lindemann <jan@janware.com>
2026-03-27 09:16:14 +01:00

24 lines
963 B
Python

# -*- coding: utf-8 -*-
from argparse import Namespace, ArgumentParser
from ...lib.log import *
from ..Cmd import Cmd
from ..CmdProjects import CmdProjects
class CmdCheck(Cmd): # export
def __init__(self, parent: CmdProjects) -> None:
super().__init__(parent, 'check', help='Check for circular dependencies between given modules')
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')
async def _run(self, args: Namespace) -> None:
path = self.app.find_circular_deps(args.module, args.flavour)
if path:
log(NOTICE, f'Found circular dependency in flavour {args.flavour}:', ' -> '.join(path))
exit(1)
log(NOTICE, f'No circular dependency found for flavour {args.flavour} in modules:', ' '.join(args.module))