Skip to content

Commit 6b0a7c5

Browse files
authored
Merge pull request #329 from desultory/dev
fix broken mask lookup, improve formatting
2 parents 18cdd43 + 0f544e1 commit 6b0a7c5

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/ugrd/initramfs_dict.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
__author__ = "desultory"
2-
__version__ = "2.4.0"
2+
__version__ = "2.4.1"
33

44
from collections import UserDict
55
from importlib import import_module
@@ -271,11 +271,11 @@ def _process_imports(self, import_type: str, import_value: dict) -> None:
271271
self.logger.log(5, "Creating import type: %s" % import_type)
272272
self["imports"][import_type] = NoDupFlatList(_log_bump=10, logger=self.logger)
273273

274-
if import_masks := self.get("masks", {}).get(import_type, {}).get(module_name):
274+
if import_masks := self.get("masks", {}).get(import_type, []):
275275
import_masks = [import_masks] if isinstance(import_masks, str) else import_masks
276276
for mask in import_masks:
277277
if mask in function_names:
278-
self.logger.warning("[%s] Skipping import of masked function: %s" % (module_name, mask))
278+
self.logger.warning(f"[{c_(module_name, bright=True)}] Skipping import of masked function: {c_(mask, 'yellow')}")
279279
function_names.remove(mask)
280280
if import_type == "custom_init":
281281
self.logger.warning("Skipping custom init function: %s" % mask)

src/ugrd/initramfs_generator.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,9 @@ def build(self) -> None:
9090
self.config_dict.validate() # Validate the config after the build tasks have been run
9191

9292
if self.validate and not self.validated:
93-
raise ValidationError(f"Failed to validate config. Unprocessed values: {', '.join(list(self['_processing'].keys()))}")
93+
raise ValidationError(
94+
f"Failed to validate config. Unprocessed values: {', '.join(list(self['_processing'].keys()))}"
95+
)
9496

9597
self.generate_init()
9698
self.pack_build()
@@ -153,7 +155,7 @@ def run_hook(self, hook: str, *args, **kwargs) -> list[str]:
153155
for function in self["imports"].get(hook, []):
154156
if function.__name__ in self["masks"].get(hook, []):
155157
self.logger.warning(
156-
"[%s] Skipping masked function: %s" % (hook, c_(function.__name__, "yellow", bold=True))
158+
f"[{c_(hook, bright=True)}] Skipping masked function: {c_(function.__name__, 'yellow', bold=True)}"
157159
)
158160
continue
159161

0 commit comments

Comments
 (0)