-
Notifications
You must be signed in to change notification settings - Fork 980
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
[feature] Revisit precedence of values assigned to requirements' options (ATM, hardcoded value in configure method cannot be overridden) #7786
Comments
Link to the |
I would like to notice that it will break some CCI recipes:
So:
IMOO:
|
The proposal in this issue is to add more flexibility. Right now if you override an option in the With this change, class GDAL(ConanFile):
requires = "qhull/..."
def configure():
self.options['qhull'].reentrant = False The difference would be for consumers and the command line. Right now the
with the proposed change, the option in the command line will be taken into account... and yes, the recipe should implement some kind of validation (#7591) to raise if it is not able to build with that value. This change can break existing builds that rely on this final assignment, that's the reason we cannot modify it before |
I misunderstood, sorry, so this modification sounds good to me :) |
No problem 😊 We are also wrong from time to time and we really appreciate all of you questioning new features and decisions. |
Will this also allow the current recipe option overriding to be treated in the same manner as Also, regarding the upstream package option overriding - #6408 |
AFAIK, you can conditionally set options values in |
@SpaceIm It's explicitly forbidden to set option values in
|
See libcurl recipe: https://github.com/conan-io/conan-center-index/blob/4ac63884d528d6abb2d4740acb88d5cbd3d6b76a/recipes/libcurl/all/conanfile.py#L85 |
Unfortunately, Conan v1.x is not enforcing the scope for some attributes (access and modification) and it hasn't been exhaustively documented, so we feel like changing it (or being more strict) might be considered breaking. Conan v2 should enforce it and make available to each function only the attributes that can be modified. At some point in time we will be more strict in ConanCenter so we detect these errors and fix them before moving to Conan 2.0 (probably we will take advantage of CONAN_V2_MODE variable). |
The precedence has already been modified for Conan 2.0. Downstream options values will always have higher precedence. This enables things as settings options values conditionally in recipes methods (no need to conditionally define the defaults, as defining the values is good too, as downstream values still prevail). So I think we can close this issue as solved in 2.0 |
Right now a recipe can do:
This has absolute precedence. It can never be overridden, even from command line doing
-o mydep:myoption=othervalue
I would suggest to change this in Conan 2.0:
default_options
, can be overriden by command linevalidate()
, post graph expansion and raise if they do not accept some upstream configuration.The text was updated successfully, but these errors were encountered: