Skip to content

Commit bf34df3

Browse files
committed
Fix conanws.yml requiring 'ref' specification
1 parent f5bf02b commit bf34df3

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

conan/api/subapi/workspace.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,8 +265,16 @@ def super_build_graph(self, deps_graph, profile_host, profile_build):
265265
order = []
266266
packages = self._ws.packages()
267267

268+
def get_ref(package_info):
269+
if "ref" in package_info:
270+
return RecipeReference.loads(package_info["ref"])
271+
else:
272+
p_conanfile = self._ws.load_conanfile(package_info["path"])
273+
return RecipeReference(name=p_conanfile.name, version=p_conanfile.version,
274+
user=p_conanfile.user, channel=p_conanfile.channel)
275+
268276
def find_folder(ref):
269-
return next(p["path"] for p in packages if RecipeReference.loads(p["ref"]) == ref)
277+
return next(p["path"] for p in packages if get_ref(p) == ref)
270278

271279
for level in deps_graph.by_levels():
272280
items = [item for item in level if item.recipe == "Editable"]

conan/internal/api/new/workspace.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
- path: liba
99
ref: liba/0.1
1010
- path: libb
11-
ref: libb/0.1
1211
- path: app1
1312
ref: app1/0.1
1413
"""

test/integration/workspace/test_workspace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,7 @@ def test_new(self):
506506
assert 'name = "liba"' in c.load("liba/conanfile.py")
507507
c.run("workspace info")
508508
assert "liba/0.1" in c.out
509-
assert "libb/0.1" in c.out
509+
assert "libb" in c.out
510510
assert "app1/0.1" in c.out
511511

512512
def test_new_dep(self):
@@ -516,7 +516,7 @@ def test_new_dep(self):
516516
assert 'name = "liba"' in c.load("liba/conanfile.py")
517517
c.run("workspace info")
518518
assert "liba/0.1" in c.out
519-
assert "libb/0.1" in c.out
519+
assert "libb" in c.out
520520
assert "app1/0.1" in c.out
521521

522522

0 commit comments

Comments
 (0)