Skip to content
This repository has been archived by the owner on Sep 24, 2024. It is now read-only.

Commit

Permalink
fixup settings_build and settings_target
Browse files Browse the repository at this point in the history
  • Loading branch information
ericLemanissier committed Sep 23, 2024
1 parent 7bc7e41 commit b126059
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion linter/transform_conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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("""
Expand Down Expand Up @@ -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,
}

Expand All @@ -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(
Expand Down

0 comments on commit b126059

Please sign in to comment.