Skip to content

Commit

Permalink
fix for editables when package_id_unknown used (#14711)
Browse files Browse the repository at this point in the history
* fix for editables when package_id_unknown used

* missing :
  • Loading branch information
memsharded committed Sep 13, 2023
1 parent e0f2801 commit 50a0bf7
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 8 deletions.
11 changes: 6 additions & 5 deletions conans/client/generators/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,12 @@ def write_generators(self, conanfile, old_gen_folder, new_gen_folder, output):
try:
generator.output_path = old_gen_folder
content = generator.content
conanfile.output.warn(f"\n"
f" ************************************************\n"
f" The '{generator_name}' generator is deprecated.\n"
f" Please update your code and remove it.\n"
f" *************************************************\n")
if generator_name != "txt":
conanfile.output.warn(f"\n"
f" ************************************************\n"
f" The '{generator_name}' generator is deprecated.\n"
f" Please update your code and remove it.\n"
f" *************************************************\n")
if isinstance(content, dict):
if generator.filename:
output.warn("Generator %s is multifile. Property 'filename' not used"
Expand Down
7 changes: 4 additions & 3 deletions conans/client/graph/graph_binaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ def _process_node(self, node, pref, build_mode, update, remotes):
return

conanfile = node.conanfile
if node.recipe == RECIPE_EDITABLE:
node.binary = BINARY_EDITABLE # TODO: PREV?
return
assert node.recipe != RECIPE_EDITABLE

if pref.id == PACKAGE_ID_INVALID:
# annotate pattern, so unused patterns in --build are not displayed as errors
Expand Down Expand Up @@ -450,6 +448,9 @@ def evaluate_graph(self, deps_graph, build_mode, update, remotes, nodes_subset=N
self._compute_package_id(node, default_package_id_mode, default_python_requires_id_mode)
if node.recipe in (RECIPE_CONSUMER, RECIPE_VIRTUAL):
continue
if node.recipe == RECIPE_EDITABLE:
node.binary = BINARY_EDITABLE
continue
if node.package_id == PACKAGE_ID_UNKNOWN:
assert node.binary is None, "Node.binary should be None"
node.binary = BINARY_UNKNOWN
Expand Down
30 changes: 30 additions & 0 deletions conans/test/integration/editable/transitive_editable_test.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# coding=utf-8

import os
import textwrap
import unittest

from conans.model.ref import ConanFileReference
Expand Down Expand Up @@ -34,3 +35,32 @@ def test_transitive_editables(self):
client2.current_folder = os.path.join(client2.current_folder, "build")
mkdir(client2.current_folder)
client2.run("install ..")

def test_transitive_editables_build(self):
# https://github.com/conan-io/conan/issues/6064
c = TestClient()
c.run("config set general.default_package_id_mode=package_revision_mode")
libb = textwrap.dedent("""\
from conan import ConanFile
class LibB(ConanFile):
name = "libb"
version = "0.1"
build_policy = "missing"
settings = "os", "compiler", "arch"
def build_requirements(self):
self.build_requires("liba/[>=0.0]")
def requirements(self):
self.requires("liba/[>=0.0]")
""")
c.save({"liba/conanfile.py": GenConanfile("liba", "0.1"),
"libb/conanfile.py": libb,
"app/conanfile.txt": "[requires]\nlibb/0.1"})
c.run("editable add liba liba/0.1")
c.run("editable add libb libb/0.1")
c.run("install app --build=*")
# It doesn't crash
# Try also with 2 profiles
c.run("install app -s:b os=Windows --build=*")
# it doesn't crash

0 comments on commit 50a0bf7

Please sign in to comment.