def create_symlink_or_hardcopy()

in fix_tfvars_symlinks.py [0:0]


def create_symlink_or_hardcopy(src_file_path, dst_file_path):
    if os.path.exists(dst_file_path):
        return (dst_file_path,"exists")
    try:
        os.symlink(src_file_path, dst_file_path)
        return (dst_file_path,"symlink")
    except:
        print("Could not symlink {} to {}".format(src_file_path,dst_file_path))
    try:
        shutil.copy2(src_file_path,dst_file_path)
        return (dst_file_path,"hardlink")
    except:
        print("Could not copy {} to {}".format(src_file_path,dst_file_path))
    return None