mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 09:13:37 +02:00
lib.Distro.default_pkg_filter: Add property
Add a default_pkg_filter parameter to Distro's constructor defaulting to None, and expose it via the .default_pkg_filter property. As of this commit, no code in jw-pkg does anything meaningful with it. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
33ff46e7b3
commit
dcdf69890c
1 changed files with 14 additions and 2 deletions
|
|
@ -7,6 +7,7 @@ from functools import cached_property
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
import Iterable
|
import Iterable
|
||||||
|
from .PackageFilter import PackageFilter
|
||||||
|
|
||||||
import abc, importlib, re
|
import abc, importlib, re
|
||||||
|
|
||||||
|
|
@ -17,12 +18,19 @@ from .log import *
|
||||||
|
|
||||||
class Distro(abc.ABC):
|
class Distro(abc.ABC):
|
||||||
|
|
||||||
def __init__(self, ec: ExecContext, id: str|None=None, os_release_str: str|None=None):
|
def __init__(
|
||||||
|
self,
|
||||||
|
ec: ExecContext,
|
||||||
|
id: str|None=None,
|
||||||
|
os_release_str: str|None=None,
|
||||||
|
default_pkg_filter: PackageFilter|None=None,
|
||||||
|
) -> None:
|
||||||
assert ec is not None
|
assert ec is not None
|
||||||
assert id is not None
|
assert id is not None
|
||||||
self.__exec_context = ec
|
self.__exec_context = ec
|
||||||
self.__os_release_str: str|None = os_release_str
|
|
||||||
self.__id: str|None = None
|
self.__id: str|None = None
|
||||||
|
self.__os_release_str: str|None = os_release_str
|
||||||
|
self.__default_pkg_filter = default_pkg_filter
|
||||||
|
|
||||||
# Names that can be used by code outside this class to retrieve
|
# Names that can be used by code outside this class to retrieve
|
||||||
# distribution properties by
|
# distribution properties by
|
||||||
|
|
@ -267,6 +275,10 @@ class Distro(abc.ABC):
|
||||||
def ctx(self) -> ExecContext:
|
def ctx(self) -> ExecContext:
|
||||||
return self.__exec_context
|
return self.__exec_context
|
||||||
|
|
||||||
|
@property
|
||||||
|
def default_pkg_filter(self) -> str:
|
||||||
|
return self.__default_pkg_filter
|
||||||
|
|
||||||
async def run(self, *args, **kwargs) -> Result:
|
async def run(self, *args, **kwargs) -> Result:
|
||||||
return await self.__exec_context.run(*args, **kwargs)
|
return await self.__exec_context.run(*args, **kwargs)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue