Skip to content

Commit

Permalink
Fix 9331 (#9360)
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Aug 9, 2021
1 parent c1ab505 commit bb5f590
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
7 changes: 6 additions & 1 deletion conans/client/installer.py
Expand Up @@ -699,9 +699,14 @@ def _call_package_info(self, conanfile, package_folder, ref, is_editable):

if conanfile._conan_dep_cpp_info is None:
try:
if not is_editable:
if not is_editable and not hasattr(conanfile, "layout"):
# FIXME: The default for the cppinfo from build are not the same
# so this check fails when editable
# FIXME: Remove when new cppinfo model. If using the layout method
# the cppinfo object is filled from self.cpp.package new
# model and we cannot check if the defaults have been modified
# because it doesn't exist in the new model where the defaults
# for the components are always empty
conanfile.cpp_info._raise_incorrect_components_definition(
conanfile.name, conanfile.requires)
except ConanException as e:
Expand Down
Expand Up @@ -62,3 +62,26 @@ class Pkg(ConanFile):
client.run("install . -s:b os=Windows -s:h os=Linux --build=missing")
cmake_data = client.load("pkg-release-x86_64-data.cmake")
assert "gtest" not in cmake_data


def test_components_error():
# https://github.com/conan-io/conan/issues/9331
client = TestClient()

conan_hello = textwrap.dedent("""
import os
from conans import ConanFile
from conan.tools.files import save
class Pkg(ConanFile):
settings = "os", "arch", "compiler", "build_type"
def layout(self):
pass
def package_info(self):
self.cpp_info.components["say"].includedirs = ["include"]
""")

client.save({"conanfile.py": conan_hello})
client.run("create . hello/1.0@")

0 comments on commit bb5f590

Please sign in to comment.