Skip to content
Open
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
6 changes: 6 additions & 0 deletions conan/internal/model/conanfile_interface.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from pathlib import Path

from conan.internal.graph.graph import CONTEXT_BUILD


Expand Down Expand Up @@ -143,6 +144,11 @@ def url(self):
def extension_properties(self):
return getattr(self._conanfile, "extension_properties", {})

@property
def recipe(self) -> str:
# IMPORTANT: this should be used only for "informational" purposes, see GH#18996.
return self._conanfile._conan_node.recipe

@property
def conf(self):
return self._conanfile.conf
8 changes: 3 additions & 5 deletions conan/internal/model/dependencies.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from collections import OrderedDict

from conan.internal.graph.graph import RECIPE_PLATFORM
from conan.errors import ConanException
from conan.api.model import RecipeReference
from conan.errors import ConanException
from conan.internal.graph.graph import RECIPE_PLATFORM
from conan.internal.model.conanfile_interface import ConanFileInterface


Expand Down Expand Up @@ -117,9 +117,7 @@ def filter_fn(require):

data = OrderedDict((k, v) for k, v in self._data.items() if filter_fn(k))
if remove_system:
data = OrderedDict((k, v) for k, v in data.items()
# TODO: Make "recipe" part of ConanFileInterface model
if v._conanfile._conan_node.recipe != RECIPE_PLATFORM)
data = OrderedDict((k, v) for k, v in data.items() if v.recipe != RECIPE_PLATFORM)
return ConanFileDependencies(data, require_filter)

def transitive_requires(self, other):
Expand Down
15 changes: 9 additions & 6 deletions test/integration/graph/test_dependencies_visit.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,13 @@ class Pkg(ConanFile):
class User(ConanFile):
requires = "dep/1.0"
def generate(self):
self.output.info("HOME: {}".format(self.dependencies["dep"].homepage))
self.output.info("URL: {}".format(self.dependencies["dep"].url))
self.output.info("LICENSE: {}".format(self.dependencies["dep"].license))
self.output.info("RECIPE: {}".format(self.dependencies["dep"].recipe_folder))
self.output.info("CONANDATA: {}".format(self.dependencies["dep"].conan_data))
dep = self.dependencies["dep"]
self.output.info("HOME: {}".format(dep.homepage))
self.output.info("URL: {}".format(dep.url))
self.output.info("LICENSE: {}".format(dep.license))
self.output.info("RECIPE FOLDER: {}".format(dep.recipe_folder))
self.output.info("CONANDATA: {}".format(dep.conan_data))
self.output.info("RECIPE: {}".format(dep.recipe))

""")
c.save({"dep/conanfile.py": conanfile,
Expand All @@ -270,8 +272,9 @@ def generate(self):
assert "conanfile.py: HOME: myhome" in c.out
assert "conanfile.py: URL: myurl" in c.out
assert "conanfile.py: LICENSE: MIT" in c.out
assert "conanfile.py: RECIPE:" in c.out
assert "conanfile.py: RECIPE FOLDER:" in c.out
assert "conanfile.py: CONANDATA: {}" in c.out
assert "conanfile.py: RECIPE: Cache" in c.out


def test_dependency_interface_validate():
Expand Down
Loading