Skip to content

Commit c0f8fd6

Browse files
committed
Merge branch 'fix/missing-kconfig-error-local' into 'main'
fix: catch all MissingKconfigError exception Closes PACMAN-1142 See merge request espressif/idf-component-manager!518
2 parents 9a37b4c + 7576c25 commit c0f8fd6

File tree

2 files changed

+27
-13
lines changed

2 files changed

+27
-13
lines changed

idf_component_manager/prepare_components/prepare.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
from idf_component_manager.core import ComponentManager
1515
from idf_component_tools import error, setup_logging, warn
16+
from idf_component_tools.build_system_tools import get_idf_version
1617
from idf_component_tools.debugger import KCONFIG_CONTEXT
1718
from idf_component_tools.errors import FatalError
1819
from idf_component_tools.manifest import ComponentRequirement
@@ -52,8 +53,18 @@ def debug_message(req: ComponentRequirement) -> str:
5253
debug_strs.add(f' {key}, {debug_message(req)}')
5354

5455
_nl = '\n'
56+
if args.interface_version < 4:
57+
warn(
58+
f'The following Kconfig variables were used in "if" clauses, '
59+
f'but not supported by your ESP-IDF version {get_idf_version()}. '
60+
f'Ignoring these if-clauses:\n'
61+
f'{_nl.join(sorted(debug_strs))}\n'
62+
)
63+
return
64+
5565
warn(
56-
f'The following Kconfig variables were used in "if" clauses, but not found in any Kconfig file:\n'
66+
f'The following Kconfig variables were used in "if" clauses, '
67+
f'but not found in any Kconfig file:\n'
5768
f'{_nl.join(sorted(debug_strs))}\n'
5869
)
5970
exit(10)

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)