lib.ExecContext.run(), .sudo(): Rename env

The name of the env parameter to ExecContext.run() and .sudo() is not descriptive enough for which environment is supposed to be modified and how, so rename and split it up as follows:

- .run(): env -> mod_env

- .sudo(): env -> mod_env_sudo and mod_env_cmd

The parameters have the following meaning:

- "mod_env*" means that the environment is modified, not replaced

- "mod_env" and "mod_env_cmd" modify the environment "cmd" runs in

- "mod_env_sudo" modifies the environment sudo runs in

Fix the fallout of the API change all over jw-pkg.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-04-19 14:04:35 +02:00
commit 54aecff8e4
9 changed files with 164 additions and 159 deletions

View file

@ -101,7 +101,7 @@ class CmdBuild(Cmd): # export
wd = self.app.find_dir(module, pretty=False)
title = '---- [%d/%d]: Running "%s" in %s -' % (cur_project, num_projects, ' '.join(make_cmd), wd)
env = None
mod_env = None
if args.env_reinit:
keep: bool|list[str] = False
if args.env_keep is not None:
@ -112,7 +112,7 @@ class CmdBuild(Cmd): # export
keep=False
case _:
keep = args.env_keep.split(',')
env = await get_profile_env(keep=keep)
mod_env = await get_profile_env(keep=keep)
try:
await self.app.exec_context.run(
@ -120,7 +120,7 @@ class CmdBuild(Cmd): # export
wd=wd,
throw=True,
verbose=True,
env=env,
mod_env=mod_env,
title=title
)
except Exception as e: