From b126059dc3306db4b0656e063e2d3126c83bab88 Mon Sep 17 00:00:00 2001 From: ericLemanissier Date: Mon, 23 Sep 2024 12:29:00 +0000 Subject: [PATCH] fixup settings_build and settings_target --- linter/transform_conanfile.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/linter/transform_conanfile.py b/linter/transform_conanfile.py index 3ec79b60a29cf..0daf500ab5c4c 100644 --- a/linter/transform_conanfile.py +++ b/linter/transform_conanfile.py @@ -9,6 +9,19 @@ from astroid.inference_tip import inference_tip from astroid.manager import AstroidManager + +def _settings_transform(): + module = AstroidBuilder(AstroidManager()).string_build( + textwrap.dedent(""" + class Settings(object): + os = None + arch = None + compiler = None + build_type = None + """) + ) + return module['Settings'] + def _user_info_build_transform(): module = AstroidBuilder(AstroidManager()).string_build( textwrap.dedent(""" @@ -48,6 +61,8 @@ def transform_conanfile(node): "info": info_class, "python_requires": [str_class, python_requires_class], "recipe_folder": str_class, + "settings_build": [_settings_transform()], + "settings_target": [_settings_transform()], "conf": dict_class, } @@ -61,7 +76,7 @@ def transform_conanfile(node): def _looks_like_settings(node: astroid.Attribute) -> bool: - return node.attrname in ["settings", "settings_build", "settings_target"] + return node.attrname == "settings" def infer_settings(node, context): return astroid.MANAGER.ast_from_module_name(