Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 9331 (usage of layout + components) #9360

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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@")