conan-package-tools
conan-package-tools copied to clipboard
No shared option name result in weird behavior
Hi!
@solvingj related an error during boost-date_time job on Travis CI.
The reported error is about a package not found (boost_base).
Actually we have a problem with remotes list, where bincrafters wasn't add into the list.
All things happen on load_cf_class. When in method is called, all build is started.
There is a condition saying to call if shared_option_name
is not defined. Indeed is not defined to conan-date_time but it there are many dependencies.
@lasote could you explain what should happen in that piece of code? It looks a bug but I could be wrong.
IMHO this method does the following: shared_option_name is None
means default behavior that is to load recipe's ConanFile
and look if its options contain attribute shared
. If they do, set shared_option_name
to <package>:shared
.
This approach is not very correct. Say, I have a recipe:
class TestConan(ConanFile)
options = {"shared": [True, False]}
def config_options(self):
if self.settings.os == "Windows":
del self.options.shared
Under Windows add_common_builds()
will still find shared
attribute by default. So we need at least configure_options()
call before checking the attribute presence. But even that is not enough. Consider:
class TestConan(ConanFile)
options = {"shared": [True, False]}
def config_options(self):
if not self.options.shared and self.settings.os == "Windows":
raise Exception("Only pkg:shared=True is supported on Windows")
How to detect that inside add_common_builds()
? I have no idea.