-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Default value for options with ANY #3232
Comments
I'm not sure why if an option admits any value has to automatically default to anything and not require a default like any other one. |
you could use a defaulted value if you want or even None, but just "config=" is something very weird |
"config=" is indeed weird. What @lasote suggests is to change the current default behavior, and assign it a None value automatically without having to specify it in the conanfile, did I understand correctly? |
You didn't understand correctly. I was asking why we should do that for the ANY options and not for others. |
Yes, that is what I suggested in the original comment. By:
I meant: "I suggest to use the last case indicated above" -> raise when "config=" and allow "config=None" |
Just to be sure, you expect all recipes to handle the "config would be empty" case in the following way: |
@ericLemanissier no, this is not related. |
@ericLemanissier it should be |
ok, my bad, |
@ericLemanissier probably you are right, @danimtb performed some tests and |
@ericLemanissier at least if you declare:
|
In options you can define a special value "ANY" as stated in the docs: https://docs.conan.io/en/latest/reference/conanfile/attributes.html#options-default-options
But in the example there is no
default_options
defined. Doing some tests Conan behaves like this:conanfile.py
default_options
: WORKSconanfile.py
But the generated conaninfo.txt has
config=
andconan search
returnsconfig:
both without value.None
as default value: Worksconanfile.py
Generates conaninfo.txt with "config=None",
conan search
returns "config: None" and package ID is NOT affected.I suggest to use the last option as default, encourage users to use
"config": "ANY
together with"config=None"
default value and do not allow just "config=". Would be breaking but more clear.The text was updated successfully, but these errors were encountered: