Skip to content

Commit

Permalink
allow conf in exports-sources and export (conan-io#16034)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Apr 10, 2024
1 parent 76cfbae commit d6a0d60
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
1 change: 1 addition & 0 deletions conans/client/cmd/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ def cmd_export(app, global_conf, conanfile_path, name, version, user, channel, g
ref.validate_ref(allow_uppercase=global_conf.get("core:allow_uppercase_pkg_names",
check_type=bool))

conanfile.conf = global_conf.get_conanfile_conf(ref, is_consumer=True)
conanfile.display_name = str(ref)
conanfile.output.scope = conanfile.display_name
scoped_output = conanfile.output
Expand Down
26 changes: 26 additions & 0 deletions conans/test/functional/tools/test_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,32 @@ def source(self):
client.save({"profile": profile})
client.run("create . -pr=profile")

def test_download_export_sources(self):
client = TestClient(light=True)
file_server = TestFileServer()
client.servers["file_server"] = file_server
save(os.path.join(file_server.store, "myfile.txt"), "some content")
save(os.path.join(file_server.store, "myfile2.txt"), "some content")

conanfile = textwrap.dedent(f"""
import os
from conan import ConanFile
from conan.tools.files import download
class Pkg(ConanFile):
name = "mypkg"
version = "1.0"
def export(self):
download(self, "{file_server.fake_url}/myfile.txt", "myfile.txt")
assert os.path.exists("myfile.txt")
def export_sources(self):
download(self, "{file_server.fake_url}/myfile2.txt", "myfile2.txt")
assert os.path.exists("myfile2.txt")
""")

client.save({"conanfile.py": conanfile})
client.run("create .")


def test_patch(mock_patch_ng):
conanfile = textwrap.dedent("""
Expand Down

0 comments on commit d6a0d60

Please sign in to comment.