jw.pkg.cmds.distro.backend.Backend: Add property util

Add a property .util to the Backend class, instanciated on demand
from to the respective distribution directory's Util class.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2026-02-17 11:52:05 +01:00
commit 82e92ac068

View file

@ -1,7 +1,12 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from __future__ import annotations
from typing import TYPE_CHECKING
from ....lib.util import run_cmd, run_sudo from ....lib.util import run_cmd, run_sudo
from ..Cmd import Cmd
if TYPE_CHECKING:
from ..Cmd import Cmd
class Backend: class Backend:
@ -11,6 +16,10 @@ class Backend:
async def _sudo(self, cmd: list[str], mod_env: dict[str, str] = {}, opts: list[str]=[]): async def _sudo(self, cmd: list[str], mod_env: dict[str, str] = {}, opts: list[str]=[]):
return await run_sudo(cmd, mod_env=mod_env, opts=opts, interactive=self.interactive) return await run_sudo(cmd, mod_env=mod_env, opts=opts, interactive=self.interactive)
@property
def util(self):
return self.__parent.util
@property @property
def parent(self): def parent(self):
return self.__parent return self.__parent