Skip to content

Commit

Permalink
Merge develop
Browse files Browse the repository at this point in the history
  • Loading branch information
lasote committed Jun 17, 2022
2 parents ee0f42e + 2ddd17f commit 0f636a1
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 4 deletions.
2 changes: 1 addition & 1 deletion conan/tools/gnu/autotoolstoolchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def _get_argument(argument_name, cppinfo_name):
_get_argument("includedir", "includedirs"),
_get_argument("oldincludedir", "includedirs"),
_get_argument("datarootdir", "resdirs")])
return configure_install_flags
return [el for el in configure_install_flags if el]

def _default_autoreconf_flags(self):
return ["--force", "--install"]
Expand Down
6 changes: 3 additions & 3 deletions conans/test/functional/layout/test_editables_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,16 +217,16 @@ def build(self):

out = str(client2.out).replace(r"\\", "/").replace(package_folder, "")
assert "**FOO includedirs:['package_include_foo']**" in out
assert "**FOO libdirs:[]**" in out # The components don't have default dirs
assert "**FOO builddirs:[]**" in out # The components don't have default dirs
assert "**FOO libdirs:['lib']**" in out # The components does have default dirs
assert "**FOO builddirs:[]**" in out # The components don't have default dirs for builddirs
assert "**FOO libs:['lib_when_package_foo', 'lib_when_package2_foo']**" in out
assert "**FOO objects:['myobject.o']**" in out
assert "**FOO build_modules:['mymodules/mybuildmodule']**" in out
assert "**FOO cxxflags:['my_cxx_flag2_foo']**" in out
assert "**FOO cflags:['my_c_flag_foo']**" in out

assert "**VAR includedirs:['package_include_var']**" in out
assert "**VAR libdirs:[]**" in out # The components don't have default dirs
assert "**VAR libdirs:['lib']**" in out # The components does have default dirs
assert "**VAR builddirs:[]**" in out # The components don't have default dirs
assert "**VAR libs:['lib_when_package_var', 'lib_when_package2_var']**" in out
assert "**VAR cxxflags:['my_cxx_flag2_var']**" in out
Expand Down
3 changes: 3 additions & 0 deletions conans/test/functional/toolchains/gnu/autotools/test_ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class TestConan(ConanFile):
exports_sources = "configure.ac", "Makefile.am", "main.cpp"
generators = "AutotoolsToolchain", "AutotoolsDeps"
def layout(self):
self.cpp.package.resdirs = ["res"]
def build(self):
autotools = Autotools(self)
autotools.autoreconf()
Expand Down
80 changes: 80 additions & 0 deletions conans/test/integration/command/create_test.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import json
import os
import re
import textwrap
import unittest
import pytest

import pytest

Expand Down Expand Up @@ -696,3 +698,81 @@ def package_info(self):
client.save({"conanfile.py": conanfile})
client.run("create .")
assert "FRAMEWORKS: []" in client.out


import pytest
import re
@pytest.mark.parametrize("with_layout", [True, False])
def test_defaults_in_components_without_layout(with_layout):
lib_conan_file = textwrap.dedent("""
from conan import ConanFile
class LibConan(ConanFile):
name = "lib"
version = "1.0"
def layout(self):
pass
def package_info(self):
self.cpp_info.components["foo"].libs = ["foolib"]
""")
if not with_layout:
lib_conan_file = lib_conan_file.replace("def layout(", "def potato(")
client = TestClient()
client.save({"conanfile.py": lib_conan_file})
client.run("create . ")

consumer_conanfile = textwrap.dedent("""
from conan import ConanFile
class Consumer(ConanFile):
name = "consumer"
version = "1.0"
requires = "lib/1.0"
def layout(self):
pass
def generate(self):
if hasattr(self, "layout"):
cppinfo = self.dependencies["lib"].cpp_info
else:
cppinfo = dict(self.deps_cpp_info.dependencies)["lib"]
components = cppinfo.components
self.output.warn("BINDIRS: {}".format(cppinfo.bindirs))
self.output.warn("LIBDIRS: {}".format(cppinfo.libdirs))
self.output.warn("INCLUDEDIRS: {}".format(cppinfo.includedirs))
self.output.warn("RESDIRS: {}".format(cppinfo.resdirs))
self.output.warn("FOO LIBDIRS: {}".format(components["foo"].libdirs))
self.output.warn("FOO INCLUDEDIRS: {}".format(components["foo"].includedirs))
self.output.warn("FOO RESDIRS: {}".format(components["foo"].resdirs))
""")

if not with_layout:
consumer_conanfile = consumer_conanfile.replace("def layout(", "def potato(")

client.save({"conanfile.py": consumer_conanfile})
client.run("create . ")

if with_layout:
# The paths are absolute and the components have defaults
# ".+" Check that there is a path, not only "lib"
assert re.search("BINDIRS: \['.+bin'\]", str(client.out))
assert re.search("LIBDIRS: \['.+lib'\]", str(client.out))
assert re.search("INCLUDEDIRS: \['.+include'\]", str(client.out))
assert "WARN: RES DIRS: []"
assert bool(re.search("WARN: FOO LIBDIRS: \['.+lib'\]", str(client.out))) is with_layout
assert bool(re.search("WARN: FOO INCLUDEDIRS: \['.+include'\]", str(client.out))) is with_layout
assert "WARN: FOO RESDIRS: []" in client.out
else:
# The paths are not absolute and the components have defaults
assert "BINDIRS: ['bin']" in client.out
assert "LIBDIRS: ['lib']" in client.out
assert "INCLUDEDIRS: ['include']" in client.out
assert "FOO LIBDIRS: ['lib']" in client.out
assert "FOO INCLUDEDIRS: ['include']" in client.out
assert "FOO RESDIRS: ['res']" in client.out

0 comments on commit 0f636a1

Please sign in to comment.