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

do not skip requirements of editable packages #13544

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion conans/client/graph/graph_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ def _skip_binaries(graph):
required_nodes = set()
required_nodes.add(graph.root)
for node in graph.nodes:
if node.binary != BINARY_BUILD and node is not graph.root:
if node.binary not in (BINARY_BUILD, BINARY_EDITABLE_BUILD, BINARY_EDITABLE) \
and node is not graph.root:
continue
for req, dep in node.transitive_deps.items():
dep_node = dep.node
Expand Down
96 changes: 66 additions & 30 deletions conans/test/integration/editable/transitive_editable_test.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,76 @@
# coding=utf-8
import textwrap

import os
import unittest
from conans.test.utils.tools import TestClient, GenConanfile

import pytest

from conans.model.recipe_ref import RecipeReference
from conans.test.utils.tools import TestClient, GenConanfile
from conans.util.files import mkdir
def test_transitive_editables_half_diamond():
# https://github.com/conan-io/conan/issues/4445
client = TestClient()
client.save({"libc/conanfile.py": GenConanfile("libc", "0.1"),
"libb/conanfile.py": GenConanfile("libb", "0.1").with_require("libc/0.1"),
"liba/conanfile.py": GenConanfile("liba", "0.1").with_requires("libb/0.1",
"libc/0.1")})
client.run("editable add libc")
client.run("create libb")
client.run("install liba")
assert "libc/0.1 - Editable" in client.out
with client.chdir("liba/build"):
client.run("install ..")
assert "libc/0.1 - Editable" in client.out


def test_transitive_editable_test_requires():
"""
This test was crashing because editable packages was "SKIP"ing some dependencies as
"test_requires", but editables need the dependencies to generate() and to build()

https://github.com/conan-io/conan/issues/13543
"""
c = TestClient()
pkga = textwrap.dedent("""
from conan import ConanFile
from conan.tools.cmake import CMakeDeps, cmake_layout

class Pkg(ConanFile):
name = "pkga"
version = "1.0"

# Binary configuration
settings = "os", "compiler", "build_type", "arch"

def build_requirements(self):
self.test_requires("gtest/1.0")

class TransitiveEditableTest(unittest.TestCase):
def layout(self):
cmake_layout(self)

@pytest.mark.xfail(reason="Editables not taken into account for cache2.0 yet."
"TODO: cache2.0 fix with editables")
def test_transitive_editables(self):
# https://github.com/conan-io/conan/issues/4445
libc_ref = RecipeReference.loads("LibC/0.1@user/testing")
libb_ref = RecipeReference.loads("LibB/0.1@user/testing")
def generate(self):
cd = CMakeDeps(self)
cd.generate()
""")
pkgb = textwrap.dedent("""
from conan import ConanFile
from conan.tools.cmake import cmake_layout

client = TestClient()
conanfileC = GenConanfile()
client.save({"conanfile.py": str(conanfileC)})
client.run("editable add . LibC/0.1@user/testing")
class Pkg(ConanFile):
name = "pkgb"
version = "1.0"

client2 = TestClient(client.cache_folder)
conanfileB = GenConanfile().with_name("LibB").with_version("0.1").with_require(libc_ref)
# Binary configuration
settings = "os", "compiler", "build_type", "arch"

client2.save({"conanfile.py": str(conanfileB)})
client2.run("create . --user=user --channel=testing")
def requirements(self):
self.requires("pkga/1.0")

conanfileA = GenConanfile().with_name("LibA").with_version("0.1")\
.with_require(libb_ref)\
.with_require(libc_ref)
client2.save({"conanfile.py": str(conanfileA)})
client2.run("install .")
client2.current_folder = os.path.join(client2.current_folder, "build")
mkdir(client2.current_folder)
client2.run("install ..")
def layout(self):
cmake_layout(self)
""")
c.save({"gtest/conanfile.py": GenConanfile("gtest", "1.0"),
"pkga/conanfile.py": pkga,
"pkgb/conanfile.py": pkgb})
c.run("create gtest")
c.run("build pkga")
c.run("editable add pkga")
# This used to crash, due to paths in test_requires not being processed (package_info() not
# being called
c.run("build pkgb")