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>
This commit is contained in:
Jan Lindemann 2026-03-25 11:38:29 +01:00
commit 9b6ec109a1
3 changed files with 13 additions and 13 deletions

View file

@ -92,9 +92,9 @@ class CmdBuild(Cmd): # export
patt = self.app.is_excluded_from_build(module) patt = self.app.is_excluded_from_build(module)
if patt is not None: if patt is not None:
print(f',{title} >') log(NOTICE, f',{title} >')
print(f'| Configured to skip build on platform >{patt}<') log(NOTICE, f'| Configured to skip build on platform >{patt}<')
print(f'`{title} <') log(NOTICE, f'`{title} <')
return return
make_cmd = [ "make", target ] make_cmd = [ "make", target ]
@ -137,7 +137,7 @@ class CmdBuild(Cmd): # export
if m in modules: if m in modules:
modules.remove(m) modules.remove(m)
if not len(modules): if not len(modules):
print("all modules cleaned") log(NOTICE, "All modules cleaned")
return return
else: else:
for m in order: for m in order:
@ -154,7 +154,7 @@ class CmdBuild(Cmd): # export
env_exclude = os.getenv('BUILD_EXCLUDE', '') env_exclude = os.getenv('BUILD_EXCLUDE', '')
if len(env_exclude): if len(env_exclude):
print("exluding modules from environment: " + env_exclude) log(NOTICE, "Exluding modules from environment: " + env_exclude)
exclude += " " + env_exclude exclude += " " + env_exclude
# -- build # -- build
@ -165,8 +165,8 @@ class CmdBuild(Cmd): # export
glob_prereq_types = [ "build", "run", "release", "devel" ] glob_prereq_types = [ "build", "run", "release", "devel" ]
if target != 'order' and not args.build_order: if target != 'order' and not args.build_order:
print("using prerequisite types " + ' '.join(glob_prereq_types)) log(NOTICE, "Using prerequisite types " + ' '.join(glob_prereq_types))
print("calculating order for modules ... ") log(NOTICE, "Calculating order for modules ... ")
calculate_order(order, modules, glob_prereq_types) calculate_order(order, modules, glob_prereq_types)
if args.ignore_deps: if args.ignore_deps:
@ -177,17 +177,17 @@ class CmdBuild(Cmd): # export
exit(0) exit(0)
cur_project = 0 cur_project = 0
print("Building target %s in %d projects:" % (target, len(order))) log(NOTICE, "Building target %s in %d projects:" % (target, len(order)))
for m in order: for m in order:
cur_project += 1 cur_project += 1
print(" %3d %s" % (cur_project, m)) log(NOTICE, " %3d %s" % (cur_project, m))
if args.dry_run: if args.dry_run:
exit(0) exit(0)
await run_make_on_modules(modules, order, target) await run_make_on_modules(modules, order, target)
print(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")) log(NOTICE, 'Build done at {}' % (datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")))
dep_cache: dict[dict[str, str]] = {} dep_cache: dict[dict[str, str]] = {}

View file

@ -19,6 +19,6 @@ class CmdCheck(Cmd): # export
async def _run(self, args: Namespace) -> None: async def _run(self, args: Namespace) -> None:
path = self.app.find_circular_deps(args.module, args.flavour) path = self.app.find_circular_deps(args.module, args.flavour)
if path: if path:
print(f'Found circular dependency in flavour {args.flavour}:', ' -> '.join(path)) log(NOTICE, f'Found circular dependency in flavour {args.flavour}:', ' -> '.join(path))
exit(1) exit(1)
print(f'No circular dependency found for flavour {args.flavour} in modules:', ' '.join(args.module)) log(NOTICE, f'No circular dependency found for flavour {args.flavour} in modules:', ' '.join(args.module))

View file

@ -57,7 +57,7 @@ async def run_curl(args: list[str], parse_json: bool=True, wd=None, throw=None,
size = len(ret) size = len(ret)
except: except:
pass pass
print(f'Failed to parse {size} bytes output of command ' log(ERR, f'Failed to parse {size} bytes output of command '
+ f'>{pretty_cmd(cmd, wd)}< ({str(e)}): "{ret}"', file=sys.stderr) + f'>{pretty_cmd(cmd, wd)}< ({str(e)}): "{ret}"', file=sys.stderr)
raise raise
return ret, stderr, status return ret, stderr, status