Skip to content

Commit

Permalink
add profile [tool_requires] (#10462)
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Jan 31, 2022
1 parent 0490530 commit 77ef353
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
8 changes: 6 additions & 2 deletions conans/client/profile_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,8 @@ def _load_profile(text, profile_path, default_folder):

# Current profile before update with parents (but parent variables already applied)
doc = ConfigParser(profile_parser.profile_text,
allowed_fields=["build_requires", "settings", "env", "options", "conf",
"buildenv"])
allowed_fields=["build_requires", "tool_requires", "settings", "env",
"options", "conf", "buildenv"])

# Merge the inherited profile with the readed from current profile
_apply_inner_profile(doc, inherited_profile)
Expand Down Expand Up @@ -222,6 +222,10 @@ def get_package_name_value(item):
for req in doc.build_requires.splitlines():
_load_single_build_require(base_profile, req)

if doc.tool_requires:
for req in doc.tool_requires.splitlines():
_load_single_build_require(base_profile, req)

if doc.options:
base_profile.options.update(OptionsValues.loads(doc.options))

Expand Down
10 changes: 10 additions & 0 deletions conans/test/unittests/client/profile_loader/profile_loader_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -467,3 +467,13 @@ def test_profile_buildenv():
env_vars = env.vars(conanfile)
assert env_vars.get("MyVar1") == "My Value; 11 MyValue12"
assert env_vars.get("MyPath1") == "/some/path11{}/other path/path12".format(os.pathsep)


def test_profile_tool_requires():
tmp = temp_folder()
txt = textwrap.dedent("""
[tool_requires]
tool/0.1
""")
profile, _ = get_profile(tmp, txt)
assert profile.build_requires["*"] == [ConanFileReference.loads("tool/0.1")]

0 comments on commit 77ef353

Please sign in to comment.