You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think there is a misunderstanding about what is happening: del self.options.foo_bar # valid is not removing anything. The del operator is coded so it doesn't fail when the option doesn't exist that is all (and can't be changed without breaking). Given the option name, I see no other possibility than doing it via delattr, we are not converting hyphens to underscores, that is also problematic at least if not fully breaking.
How? 😅
You mean, by raising an error for del self.options.foo_bar if it doesn't exist? I think that has already been addressed in 2.0, but I can check, yes.
Update: Yes, we are good:
ERROR: pkg/0.1: Error in config_options() method, line 28
del self.options.some_thing
ConanException: option 'some_thing' doesn't exist
Possible options are ['shared']
That's a limitation with python which creates an inconsistent situation with Conan recipes.
When naming an option using hyphen e.g.
foo-bar
, on python, it will be parsed asfoo_bar
, because-
means minus operator.However, once deleted with underscore character, the option is still valid when passing option as command argument.
The current workaround is using
delattr
.We can't restrict option names to underscore only, but we need to remove accordingly and show the no option error message.
Related to conan-io/conan-center-index#9248
Environment Details (include every applicable attribute)
Steps to reproduce (Include if Applicable)
Expected Behavior
The follow statement must return an error:
The text was updated successfully, but these errors were encountered: