def sources()

in core/rust1.34/compile.py [0:0]


def sources(main, src_dir):
    # move away the action dir and replace with the new
    tmpname = str(int(time.time()))
    shutil.move("/usr/src/actions", "/usr/src/src%s" % tmpname)
    shutil.move(src_dir, "/usr/src/actions")

    # move exec in the right place
    src_file = "/usr/src/actions/exec"
    if exists(src_file):
        os.makedirs("/usr/src/actions/src", mode=0o755, exist_ok=True)
        copy_replace(src_file, "/usr/src/actions/src/lib.rs")

    # add a cargo.toml if needed
    cargo_action_file = "/usr/src/actions/Cargo.toml"
    if not exists(cargo_action_file):
        write_file(cargo_action_file, cargo_action)

    # write the boilerplate in a temp dir
    launcher = "/usr/src/action_loop/tmp%s" % tmpname
    shutil.move("/usr/src/action_loop/src/main.rs", launcher)
    copy_replace(launcher, "/usr/src/action_loop/src/main.rs",
          "use actions::main as actionMain;",
          "use actions::%s as actionMain;" % main )