Skip to content

Commit

Permalink
unconditionally adding the folder
Browse files Browse the repository at this point in the history
  • Loading branch information
memsharded committed Dec 9, 2024
1 parent 7b9ce4b commit 816978a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
9 changes: 3 additions & 6 deletions conan/internal/api/profile/profile_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,9 @@ def _load_profile(self, profile_name, cwd):
"conan_version": conan_version,
"detect_api": detect_api}

# If the profile is in the home profiles folder, use the profiles folder as search
# path too, to allow loading "common" profiles in common folders, not only children
loader_paths = base_path
if os.path.commonpath([profiles_folder]) == os.path.commonpath([profiles_folder,
profile_path]):
loader_paths = [base_path, profiles_folder]
# Always include the root Conan home "profiles" folder as secondary route for loading
# imports and includes from jinja2 templates.
loader_paths = [base_path, profiles_folder]
rtemplate = Environment(loader=FileSystemLoader(loader_paths)).from_string(text)

try:
Expand Down
18 changes: 18 additions & 0 deletions test/integration/configuration/test_profile_jinja.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,24 @@ def test_profile_template_include_sibling():
assert "os=FreeBSD" in client.out


def test_profile_template_include_from_cache():
# https://github.com/conan-io/conan/issues/17431
client = TestClient()
tpl1 = textwrap.dedent(r"""
{% include "sub2/profile_vars" %}
""")
tpl2 = textwrap.dedent("""
{% set a = "FreeBSD" %}
[settings]
os = {{ a }}
""")
client.save_home({"profiles/sub2/profile_vars": tpl2})
client.save({"conanfile.py": GenConanfile(),
"sub1/profile1": tpl1})
client.run("install . -pr=sub1/profile1")
assert "os=FreeBSD" in client.out


def test_profile_template_profile_dir():
client = TestClient()
tpl1 = textwrap.dedent("""
Expand Down

0 comments on commit 816978a

Please sign in to comment.