jw.pkg.cmds.projects.CmdBuild: Make run_make() async

Make the call chain to Popen(make ...) async, in preparation for the
next commit.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-18 10:24:45 +01:00
commit 0cb6a7972c

View file

@ -83,7 +83,7 @@ class CmdBuild(Cmd): # export
dep_tree[k].remove(d)
return 1
def run_make(module, target, cur_project, num_projects):
async def run_make(module, target, cur_project, num_projects):
#make_cmd = "make " + target + " 2>&1"
make_cmd = [ "make", target ]
path = self.app.find_dir(module, pretty=False)
@ -111,13 +111,13 @@ class CmdBuild(Cmd): # export
print(' '.join(make_cmd) + ' failed')
raise Exception(time.strftime("%Y-%m-%d %H:%M") + ": failed to make target " + target + " in module " + module + " below base " + self.app.projs_root)
def run_make_on_modules(modules, order, target):
async def run_make_on_modules(modules, order, target):
cur_project = 0
num_projects = len(order)
if target in ["clean", "distclean"]:
for m in reversed(order):
cur_project += 1
run_make(m, target, cur_project, num_projects)
await run_make(m, target, cur_project, num_projects)
if m in modules:
modules.remove(m)
if not len(modules):
@ -126,9 +126,9 @@ class CmdBuild(Cmd): # export
else:
for m in order:
cur_project += 1
run_make(m, target, cur_project, num_projects)
await run_make(m, target, cur_project, num_projects)
def run(args):
async def run(args):
log(DEBUG, "----------------------------------------- running ", ' '.join(sys.argv))
@ -169,10 +169,10 @@ class CmdBuild(Cmd): # export
if args.dry_run:
exit(0)
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"))
dep_cache: dict[dict[str, str]] = {}
run(args)
await run(args)