Skip to content

Commit 68e5b6b

Browse files
committed
fix: catch all MissingKconfigError exception
1 parent 9a37b4c commit 68e5b6b

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

idf_component_tools/manifest/models.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -325,14 +325,21 @@ def short_name(self):
325325

326326
@property
327327
def meet_optional_dependencies(self) -> bool:
328-
if (not self.matches) and (not self.rules):
329-
return True
328+
try:
329+
if (not self.matches) and (not self.rules):
330+
return True
330331

331-
if self.optional_requirement.version_spec_if_meet_conditions(self.version_spec) is not None:
332-
return True
332+
if (
333+
self.optional_requirement.version_spec_if_meet_conditions(self.version_spec)
334+
is not None
335+
):
336+
return True
333337

334-
notice('Skipping optional dependency: {}'.format(self.name))
335-
return False
338+
notice('Skipping optional dependency: {}'.format(self.name))
339+
return False
340+
except MissingKconfigError as e:
341+
KCONFIG_CONTEXT.get().set_missed_kconfig(str(e), self)
342+
return False
336343

337344
@classmethod
338345
def from_dependency_response(cls, dep_resp: DependencyResponse) -> 'ComponentRequirement':
@@ -637,14 +644,10 @@ def raw_requirements(self) -> t.List[ComponentRequirement]:
637644

638645
@property
639646
def requirements(self) -> t.List[ComponentRequirement]:
640-
kconfig_ctx = KCONFIG_CONTEXT.get()
641647
res = []
642648
for r in self.raw_requirements:
643-
try:
644-
if r.meet_optional_dependencies:
645-
res.append(r)
646-
except MissingKconfigError as e:
647-
kconfig_ctx.set_missed_kconfig(str(e), r)
649+
if r.meet_optional_dependencies:
650+
res.append(r)
648651

649652
return sorted(res, key=lambda x: x.name)
650653

0 commit comments

Comments
 (0)