Description
What is your question?
Hi, I am working with migration to conan2.
I have a recipe "Libs" which consumes another recipe "Base_recipe" through python_requires. Now the "Base_recipe" contains a file which generates a new conanfile by defining everything. Options, requires(), build_requires(), etc. The thing is this has been created to add some specific build_requirements() and options to different recipes which consumes this recipe through python_requires.
Now, In conan1, we used to directly define or modify options by:
options = self.conan_data.get("options", {})
for (name, values) in options.items():
name = str(name)
self.options[name] = values
self.default_options[name] = values[0]
But directly assigning value to options is not allowed in conan2. So I tried
opts = self.conan_data.get("options", {})
self.options.update(options_values=OrderedDict(opts))
for name, values in opts.items():
self.default_options[name] = values[0]
But at later stage, I am getting this error:
======== Computing necessary packages ========
ERROR: Traceback (most recent call last):
File "/home/user/.local/lib/python3.8/site-packages/conans/model/options.py", line 39, in copy_conaninfo_option
assert self._possible_values is not None # this should always come from recipe, with []
AssertionError
ERROR:
I tried
self.options = self.conan_data.get("options", {})
self.options.update({f"{name}": values})
self.default_options.update({f"{name}": values[0]})
But then I am getting this error:
File "/home/user/.local/lib/python3.8/site-packages/conan/internal/methods.py", line 97, in run_configure_method
conanfile.options.apply_downstream(down_options, profile_options, ref, is_consumer)
AttributeError: 'dict' object has no attribute 'apply_downstream'
ERROR: 'dict' object has no attribute 'apply_downstream'
I am defining this in "Base_recipe" in config_options(). I tried defining this in init() as well.
The type of options has been changed in conan2? What am I doing wrong here? I hope I was able to explain my problem properly.
Have you read the CONTRIBUTING guide?
- I've read the CONTRIBUTING guide