import os
import subprocess


def install_sopass(ctx):
    runcmd_prepend_to_path = globals()["runcmd_prepend_to_path"]
    srcdir = globals()["srcdir"]

    default_target = os.path.join(srcdir, "target")
    target = os.environ.get("CARGO_TARGET_DIR", default_target)
    bindir = os.path.join(target, "debug")
    print("bindir", bindir)
    assert os.path.exists(os.path.join(bindir, "sopass"))
    runcmd_prepend_to_path(ctx, dirname=bindir)
