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

Fixed conan graph info --build=pkg download of sources #16349

Merged
merged 2 commits into from
May 28, 2024
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 conan/api/subapi/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def install_system_requires(self, graph, only_info=False):
installer.install_system_requires(graph, only_info)

def install_sources(self, graph, remotes):
""" Install sources for dependency graph
""" Install sources for dependency graph of packages to BUILD or packages that match
tools.build:download_source conf
:param remotes:
:param graph: Dependency graph to install packages for
"""
Expand Down
6 changes: 3 additions & 3 deletions conans/client/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ def __init__(self, app, global_conf, editable_packages):
self._hook_manager = app.hook_manager
self._global_conf = global_conf

def _install_source(self, node, remotes):
def _install_source(self, node, remotes, need_conf=False):
conanfile = node.conanfile
download_source = conanfile.conf.get("tools.build:download_source", check_type=bool)

if not download_source and node.binary != BINARY_BUILD:
if not download_source and (need_conf or node.binary != BINARY_BUILD):
return

conanfile = node.conanfile
Expand Down Expand Up @@ -235,7 +235,7 @@ def install_sources(self, graph, remotes):
for level in install_order:
for install_reference in level:
for package in install_reference.packages.values():
self._install_source(package.nodes[0], remotes)
self._install_source(package.nodes[0], remotes, need_conf=True)

def install(self, deps_graph, remotes, install_order=None):
assert not deps_graph.error, "This graph cannot be installed: {}".format(deps_graph)
Expand Down
3 changes: 3 additions & 0 deletions test/integration/command/test_forced_download_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@ def test_install(client):
def test_info(client):
client.run("graph info --requires=dep/0.1")
assert "RUNNING SOURCE" not in client.out
# Even if the package is to be built, it shouldn't download sources unless the conf is defined
client.run("graph info --requires=dep/0.1 --build=dep*")
assert "RUNNING SOURCE" not in client.out
client.run("graph info --requires=dep/0.1 -c tools.build:download_source=True")
assert "RUNNING SOURCE" in client.out
client.run("graph info --requires=dep/0.1 -c tools.build:download_source=True")
Expand Down