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

Fix conan profile show --format=json for profiles with scoped confs #15747

Merged
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
2 changes: 1 addition & 1 deletion conans/model/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,7 +645,7 @@ def serialize(self):
if pattern is None:
result.update(conf.serialize())
else:
for k, v in conf.serialize():
for k, v in conf.serialize().items():
result[f"{pattern}:{k}"] = v
return result

Expand Down
6 changes: 5 additions & 1 deletion conans/test/integration/command/test_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,13 @@ def test_shorthand_syntax():

def test_profile_show_json():
c = TestClient()
c.save({"myprofilewin": "[settings]\nos=Windows\n[tool_requires]\nmytool/*:mytool/1.0",
c.save({"myprofilewin": "[settings]\nos=Windows\n"
"[tool_requires]\nmytool/*:mytool/1.0\n"
"[conf]\nuser.conf:value=42\nlibiconv/*:tools.env.virtualenv:powershell=False\n"
"[options]\n*:myoption=True",
"myprofilelinux": "[settings]\nos=Linux"})
c.run("profile show -pr:b=myprofilewin -pr:h=myprofilelinux --format=json")

profile = json.loads(c.stdout)
assert profile["host"]["settings"] == {"os": "Linux"}

Expand Down