Can not use a list for Conanfile.default_options
See original GitHub issueTo help us debug your issue please explain:
- I’ve read the CONTRIBUTING guide.
- I’ve specified the Conan version, operating system version and any tool that can be relevant.
- I’ve explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
version 1.0.2
from conans import ConanFile, CMake, tools
class FooConan(ConanFile):
name = "Foo"
version = "1.0"
license = "<Put the package license here>"
url = "<Package recipe repository url here, for issues about the package>"
description = "<Description of Foo here>"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False]}
default_options = ["shared=False"]
Results in an error (and not the most helpful of errors, either):
david@balrog:~$ conan install .
ERROR: /home/david/conanfile.py: Error while initializing options. too many values to unpack (expected 2)
david@balrog:~$
The problem lies on line 150 of conans/model/options.py
where you check if the default options are type tuple
but ignore type list
. When that if-statement resolves as false, you jump down to the for-loop on line 158 which assumes it is a key-value pair. I would change line 150 to if isinstance(values, tuple) or isinstance(values, list)
.
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Attributes — conan 1.53.0 documentation
This optional attribute declares the set of files that should be exported together with the recipe and will be available to generate the...
Read more >conan doesn't upload export/conanfile.py to remote
I am using Windows PC for doing all above. Now I'm trying to consume that package on another machine, running Ubuntu Linux. Here...
Read more >conan Changelog - pyup.io
Feature: conan source command does not require a default profile ... Bugfix: Refactored CMakeDep using always targets instead of lists.
Read more >Installing dependencies with Conan | by Lenty Chang - Medium
Like Dockerfile in Docker, there is conanfile.py that you can write ... If you didn't use Conan or similar package manager, usually what...
Read more >Introduction to Conan package manager - Kuba Sejdak
Both libraries are header only, but this is not the point right now. ... Installing dependencies using conanfile.txt method is very simple: ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Nope, that’ll do it. Thanks for your help again
Yes, in your case due to the logic of your options, I think that is the cleanest approach.
So I’d say that we could close this issue now, or do you have any further question? Thanks!