INNER CODE UNIT · Python
package_status
ExplosionEngine/Explosion · ThirdParty/ConanRecipes/build_recipes.py:175
def package_status(args: argparse.Namespace, recipe: Recipe, create_extra: list[str]) -> str:
# Export so the local recipe revision (a hash of the recipe's contents) lands in the cache, then
# resolve the package id for the current profile via 'conan graph info'. With both in hand, query the
# local cache and (when a remote is configured) the remote for that exact recipe-revision +
# package-id binary -- 'conan graph info' alone cannot tell the two apart, since a cache hit masks the
# remote. Returns "remote" if published, "local" if only cached locally, else "build". Any
# uncertainty -- a failed export/query, unparseable output, a missing id -- yields "build", so the
# pre-check only ever short-circuits a sure hit, never a guess.
export = [args.conan, "export", f"{recipe.dir_name}/conanfile.py", "--version", recipe.version]
if run(export, cwd=args.recipes_root) != 0:
return "build"
info = [args.conan, "graph", "info", f"--requires={recipe.reference}", "--format=json"]
if args.remote:
info += ["-r", args.remote]
info += create_extra
code, out = run_capture(info, cwd=args.recipes_root)
if code != 0: