From 655b17bfeca66dda82d5c86677f189cecd81492c Mon Sep 17 00:00:00 2001 From: Jan Lindemann Date: Tue, 21 Apr 2026 11:22:51 +0200 Subject: [PATCH] cmds.secrets.lib.DistroContext: packages -> pkg_names Cosmetics: The "packages" parameter to some DistroContext's methods has a confusing name in same contexts, notably when mixed with a list of Package instances, so rename it to "pkg_names". Signed-off-by: Jan Lindemann --- .../jw/pkg/cmds/secrets/lib/DistroContext.py | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py b/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py index 1e6ede82..7001170d 100644 --- a/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py +++ b/src/python/jw/pkg/cmds/secrets/lib/DistroContext.py @@ -25,37 +25,37 @@ class DistroContext(FilesContext): super().__init__(distro.ctx) self.__distro = distro - async def match_files(self, packages: Iterable[str], pattern: str) -> list[str]: + async def match_files(self, pkg_names: Iterable[str], pattern: str) -> list[str]: ret: list[str] = [] - for package_name in packages: - for path in await self.__distro.pkg_files(package_name): + for pkg_name in pkg_names: + for path in await self.__distro.pkg_files(pkg_name): if re.match(pattern, path): ret.append(path) return ret - async def list_template_files(self, packages: Iterable[str]) -> list[str]: - return await self.match_files(packages, pattern=r'.*\.jw-tmpl$') + async def list_template_files(self, pkg_names: Iterable[str]) -> list[str]: + return await self.match_files(pkg_names, pattern=r'.*\.jw-tmpl$') - async def list_secret_paths(self, packages: Iterable[str], ignore_missing: bool=False) -> list[str]: + async def list_secret_paths(self, pkg_names: Iterable[str], ignore_missing: bool=False) -> list[str]: ret = [] - for tmpl in await self.list_template_files(packages): + for tmpl in await self.list_template_files(pkg_names): path = str(Path(tmpl).with_suffix(".jw-secret")) if ignore_missing and not await self.ctx.file_exists(path): continue ret.append(path) return ret - async def list_compilation_targets(self, packages: Iterable[str], ignore_missing: bool=False) -> list[str]: + async def list_compilation_targets(self, pkg_names: Iterable[str], ignore_missing: bool=False) -> list[str]: ret = [] - for tmpl in await self.list_template_files(packages): + for tmpl in await self.list_template_files(pkg_names): path = tmpl.removesuffix('.jw-tmpl') if ignore_missing and not await self.ctx.file_exists(path): continue ret.append(path) return ret - async def remove_compilation_targets(self, packages: Iterable[str]) -> list[str]: - for path in await self.list_compilation_targets(packages): + async def remove_compilation_targets(self, pkg_names: Iterable[str]) -> list[str]: + for path in await self.list_compilation_targets(pkg_names): try: self.ctx.stat(path) log(NOTICE, f'Removing {path}') @@ -64,9 +64,9 @@ class DistroContext(FilesContext): log(DEBUG, f'Compilation target {path} doesn\'t exist (ignored)') continue - async def compile_template_files(self, packages: Iterable[str], default_attrs: Attrs) -> list[str]: + async def compile_template_files(self, pkg_names: Iterable[str], default_attrs: Attrs) -> list[str]: missing = 0 - for target in await self.list_compilation_targets(packages): + for target in await self.list_compilation_targets(pkg_names): if not await self.compile_template_file(target, default_attrs): missing += 1 if missing > 0: