Skip to content

Commit

Permalink
fix source folder output (#13953)
Browse files Browse the repository at this point in the history
* fix source folder output

* fix test
  • Loading branch information
memsharded authored May 24, 2023
1 parent 7a2e3ba commit c6c50e1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
5 changes: 2 additions & 3 deletions conans/client/installer.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,6 @@ def _handle_package(self, package, install_reference, remotes, handled_count, to
conanfile = n.conanfile
# Call the info method
conanfile.folders.set_base_package(pkg_folder)
conanfile.folders.set_base_source(None)
conanfile.folders.set_base_build(None)
self._call_package_info(conanfile, pkg_folder, is_editable=False)

def _handle_node_editable(self, install_node):
Expand Down Expand Up @@ -402,7 +400,8 @@ def _call_package_info(self, conanfile, package_folder, is_editable):
self._hook_manager.execute("pre_package_info", conanfile=conanfile)

if hasattr(conanfile, "package_info"):
with conanfile_remove_attr(conanfile, ['info'], "package_info"):
with conanfile_remove_attr(conanfile, ['info', "source_folder", "build_folder"],
"package_info"):
MockInfoProperty.package = str(conanfile)
conanfile.package_info()

Expand Down
12 changes: 10 additions & 2 deletions conans/test/integration/command/test_forced_download_source.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json
import os
import textwrap

import pytest
Expand Down Expand Up @@ -27,10 +29,16 @@ def source(self):
def test_install(client):
client.run("install --requires=dep/0.1")
assert "RUNNING SOURCE" not in client.out
client.run("install --requires=dep/0.1 -c tools.build:download_source=True")
client.run("install --requires=dep/0.1 -c tools.build:download_source=True --format=json")
assert "RUNNING SOURCE" in client.out
client.run("install --requires=dep/0.1 -c tools.build:download_source=True")
graph = json.loads(client.stdout)
zlib = graph["graph"]["nodes"][1]
assert os.path.exists(zlib["source_folder"])
client.run("install --requires=dep/0.1 -c tools.build:download_source=True --format=json")
assert "RUNNING SOURCE" not in client.out
graph = json.loads(client.stdout)
zlib = graph["graph"]["nodes"][1]
assert os.path.exists(zlib["source_folder"])


def test_info(client):
Expand Down
2 changes: 0 additions & 2 deletions conans/test/integration/conanfile/folders_access_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ def package_info(self):
assert(self.package_folder == os.getcwd())
assert(isinstance(self.package_path, Path))
assert(str(self.package_path) == self.package_folder)
assert(self.source_folder is None)
assert(self.build_folder is None)
"""


Expand Down

0 comments on commit c6c50e1

Please sign in to comment.