conan: Conan install cmd Errors on using options (-o).

Ref: https://github.com/conan-io/conan/issues/1556 my last entry on this ERROR issuing conan info

As per Ref above, Lib1 was packaged with conan package_files and using options with config @memsharded suggested in Ref above.

As next step I’m trying to consume Lib1 by issuing a simple conan install but this also erroring. Below is my config for the consumer, the Conan cmd and the Error output.

conanfile.py

from conans import ConanFile
import os

class ConsumerConan(ConanFile):
    name = "Consumer"
    channel = "testing" 
    version = "1.0.0"   
    description = "Consumer"
    author = "user"
    url = "http://"
    license = "BSD"
    options = { "variations": ['d1', 'd2', 'd3'] }

    def requirements(self):
        self.requires("Lib1/1.2.4@user/testing" )

    def imports(self):
      self.copy("*", dst="inc", src="inc", root_package="Lib1") 
      self.copy("*", dst="lib", src="bin", root_package="Lib1")

install.py for the Consumer’s conanfile

import os, shutil, sys

os.system("conan install . -o Lib1:variations=d1 -o variations=d1") 

Error

> python install.py

Requirements
    Lib1/1.2.4@user/testing from conan-local
Packages
    Lib1/1.2.4@user/testing:28bff110e580b5ac3ab51e5d05ee1e666409a05c

Lib1/1.2.4@user/testing: Already installed!
PROJECT: Generator txt created conanbuildinfo.txt
PROJECT: Generated conaninfo.txt
ERROR: Conanfile: 'variations' value not defined

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 24 (11 by maintainers)

Most upvoted comments

Confirmed. No problem at all.

You can read the option value to copy only the things you want to copy:

if self.options["Lib1"].variations ==  "inc":
    do some thing

Try to comment Lib1 copy’s and make sure Lib2 artifacts are copied ok, then the opposite, comment Lib2 copy’s. to make sure that the copy commands work as expected.