Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Conan 2.0: Using is_msvc fails in validate trying access settings #12321

Closed
prince-chrismc opened this issue Oct 17, 2022 · 1 comment

Comments

@prince-chrismc
Copy link
Contributor

prince-chrismc commented Oct 17, 2022

conan-io/conan-center-index#13525 (comment)

    def validate(self):
        if is_msvc(self) and self.info.options.shared:
            raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio")

gives a ConanException: 'self.settings' access in 'validate()' method is forbidden

return settings.get_safe("compiler") == "msvc"

  • is this expected (it's the default 1.x convention)?
  • should this type of check be done in valdiate_build?
@AbrilRBS
Copy link
Member

self.info access in validate/validate_build is kept for backwards compatibility, but the recommended approach is not to use it, and directly access the necessary information, and keep self.info exclusively for the package_id() method.

Closing as solved now that the behaviour has been clarified and the mentioned error removed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants