-
Notifications
You must be signed in to change notification settings - Fork 988
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] [2.0] Options are frozen when calling configure #14528
Comments
Hi @PengZheng Thanks for your report. However, I am not sure what would be an issue. I can't reproduce it. We have a test that validates this is possible in https://github.com/conan-io/conan/blob/6f6481dbf6ae5adfd8ddeee126dc419c2249f8b3/conans/test/integration/options/options_test.py#L154C1-L154C1. Could you please double check, or try to provide a more complete reproducible case that we could reproduce? Are you sure you are at latest 2.0.9? Regarding self.requires("celix/2.3.0")
self.options['celix'].build_pushstreams = True This is not possible, as |
My situation is similar to the following code snippet. Note that options = {"without_stacktrace": [True, False],
"with_stacktrace_backtrace": [True, False]}
# with_stacktrace_backtrace has default False
default_options = {"without_stacktrace": True, "with_stacktrace_backtrace": False}
def configure(self):
if self.options.without_stacktrace:
del self.options.with_stacktrace_backtrace
else:
# Incorrect attempt to modify options 'with_stacktrace_backtrace'
self.options.with_stacktrace_backtrace = True
if self.options.build_cxx_rsa_integration:
self.options.build_cxx_remote_service_admin = True
# Incorrect attempt to modify options 'build_pushstreams'
self.options.build_pushstreams = True Now turning
Yes, this is indeed an issue.The solution you suggested is concise and clean. Thanks. |
Yes, that is true. If you plan to define the default dynamically in the |
I tried the following, but it does not work in Conan 1 (the option is ignored): def requirements(self):
if self.options.build_utils:
# self.requires("libzip/[>=1.7.3 <2.0.0]")
# self.options['libzip'].shared = True
self.requires("libzip/[>=1.7.3 <2.0.0]", options={"shared": True}) Is this expected? I found no such usage in conan-center-index I have updated the project to use Conan2's generators: The remaining issues:
I will update if I made any progress. |
Yes, this is expected, it is a Conan 2.0 feature only, it doesn't work in Conan 1.X, and it is not planned to add it to 1.X. If the question has been responded and defining values in |
Dynamic defaults is unsupported by Conan2 according to conan-io/conan#14528
Dynamic defaults have been implemented and dependency options are set in But I encountered version conflicts caused by indirect dependencies. I'll create a separate issue for this. |
Great, thanks for the feedback! |
I manipulate option values in configure() for a different purpose
framework
andutils
are two different components in the same conan package.When user wants
framework
,utils
should be built automatically.For more context, see this PR.
This automatic intra-package dependency deduction is important when using complex middleware like Celix in large scale.
Note that all these
build_
options default to false so that users don't get what they don't need.How to support it in Conan 2.0?
Any recommendation specific to the Celix project can be given in this issue:
apache/celix#483
Originally posted by @PengZheng in #10104 (comment)
The text was updated successfully, but these errors were encountered: