/ subplot / clab.py
clab.py
 1  import io
 2  import os
 3  import yaml
 4  
 5  
 6  def install_clab(ctx):
 7      runcmd_prepend_to_path = globals()["runcmd_prepend_to_path"]
 8      srcdir = globals()["srcdir"]
 9  
10      # Add the directory with built Rust binaries to the path.
11      default_target = os.path.join(srcdir, "target")
12      target = os.environ.get("CARGO_TARGET_DIR", default_target)
13      runcmd_prepend_to_path(ctx, dirname=os.path.join(target, "debug"))
14      ctx["server-binary"] = os.path.join(target, "debug", "obnam-server")
15  
16  
17  def stdout_is_yaml(ctx):
18      runcmd_get_stdout = globals()["runcmd_get_stdout"]
19      stdout = runcmd_get_stdout(ctx)
20      yaml.safe_load(io.StringIO(stdout))