question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can not use a list for Conanfile.default_options

See original GitHub issue

To 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:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DavidZemoncommented, Jan 30, 2018

Nope, that’ll do it. Thanks for your help again

0reactions
memshardedcommented, Jan 30, 2018

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!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found