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:
parent
9f756222fe
commit
54aecff8e4
9 changed files with 164 additions and 159 deletions
|
|
@ -18,13 +18,13 @@ class Distro(Base):
|
|||
|
||||
async def apt_get(self, args: list[str], verbose: bool=True, sudo: bool=True):
|
||||
cmd = ['/usr/bin/apt-get']
|
||||
mod_env = None
|
||||
mod_env_cmd = None
|
||||
if not self.interactive:
|
||||
cmd.extend(['--yes', '--quiet'])
|
||||
mod_env = { 'DEBIAN_FRONTEND': 'noninteractive' }
|
||||
mod_env_cmd = { 'DEBIAN_FRONTEND': 'noninteractive' }
|
||||
cmd.extend(args)
|
||||
if sudo:
|
||||
return await self.sudo(cmd, verbose=verbose, mod_env=mod_env)
|
||||
return await self.sudo(cmd, verbose=verbose, mod_env_cmd=mod_env_cmd)
|
||||
return await self.run(cmd, verbose=verbose)
|
||||
|
||||
async def dpkg(self, *args, **kwargs):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue