INNER CODE UNIT · Python
graph_recipe_node
ExplosionEngine/Explosion · ThirdParty/ConanRecipes/build_recipes.py:135
def graph_recipe_node(graph_json: str, reference: str) -> dict | None:
try:
nodes = json.loads(graph_json).get("graph", {}).get("nodes", {})
except (json.JSONDecodeError, AttributeError):
return None
for node in nodes.values():
if (node.get("ref") or "").split("#", 1)[0] == reference:
return node
return None
def list_has_binary(list_json: str, reference: str, package_id: str) -> bool:
# 'conan list' reports each scope (the local cache or a remote) as either an {"error": ...} payload
# when the reference is absent, or a revisions -> packages tree when it is present; the binary exists
# there only if our package id shows up under some revision of that tree.
name_version = reference.split("#", 1)[0]
try:
data = json.loads(list_json)