Remove modules and extension that fail during_bootup
This commit is contained in:
parent
bff7584fe0
commit
b9c85c02e2
@ -524,18 +524,24 @@ class KMKKeyboard:
|
|||||||
self._init_matrix()
|
self._init_matrix()
|
||||||
self._init_coord_mapping()
|
self._init_coord_mapping()
|
||||||
|
|
||||||
for module in self.modules:
|
# Modules and extensions that fail `during_bootup` get removed from
|
||||||
|
# their respective lists. This serves as a self-check mechanism; any
|
||||||
|
# modules or extensions that initialize peripherals or data structures
|
||||||
|
# should do that in `during_bootup`.
|
||||||
|
for idx, module in enumerate(self.modules):
|
||||||
try:
|
try:
|
||||||
module.during_bootup(self)
|
module.during_bootup(self)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if debug.enabled:
|
if debug.enabled:
|
||||||
debug(f'Failed to load module {module}: {err}')
|
debug(f'Failed to load module {module}: {err}')
|
||||||
for ext in self.extensions:
|
del self.modules[idx]
|
||||||
|
for idx, ext in enumerate(self.extensions):
|
||||||
try:
|
try:
|
||||||
ext.during_bootup(self)
|
ext.during_bootup(self)
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
if debug.enabled:
|
if debug.enabled:
|
||||||
debug(f'Failed to load extensions {module}: {err}')
|
debug(f'Failed to load extensions {module}: {err}')
|
||||||
|
del self.extensions[idx]
|
||||||
|
|
||||||
if debug.enabled:
|
if debug.enabled:
|
||||||
debug(f'init: {self}')
|
debug(f'init: {self}')
|
||||||
|
Loading…
Reference in New Issue
Block a user