# Path: doodad/utils/cmd_builder.py
# class CommandBuilder(object):
#     def __init__(self):
#     def append(self, cmd, *args):
#     def echo(self, msg):
#     def to_string(self, separator=';'):
#     def __str__(self):
#     def __iter__(self):
#     def dump_script(self):


import os
import pathlib
import sys
import tempfile
import shutil
import time
import subprocess
import uuid
import contextlib
import uuid
import doodad
from doodad.utils import cmd_builder
                                   verbose=verbose,
                                   use_nvidia_docker=use_gpu_image)
        elif container_type == 'docker':
            write_docker_hook(archive_dir, docker_image, mounts,
                              extra_flags=extra_container_flags,
                              script_name=FINAL_SCRIPT,
                              verbose=verbose,
                              use_nvidia_docker=use_gpu_image)
        else:
            raise NotImplementedError()
        write_metadata(archive_dir)

        # create the self-extracting archive
        compile_archive(archive_dir, archive_filename, FINAL_SCRIPT,
                        verbose=verbose)
    finally:
        shutil.rmtree(work_dir)
    return archive_filename

def write_metadata(arch_dir):
    with open(os.path.join(arch_dir, 'METADATA'), 'w') as f:
        f.write('doodad_version=%s\n' % doodad.__version__)
        f.write('unix_timestamp=%d\n' % time.time())
        f.write('uuid=%s\n' % uuid.uuid4())

def write_docker_hook(
        arch_dir, image_name, mounts, script_name,
        extra_flags='',
        verbose=False, use_nvidia_docker=False):
    docker_hook_file = os.path.join(arch_dir, script_name)

# Path: doodad/utils/cmd_builder.py
# class CommandBuilder(object):
#     def __init__(self):
#     def append(self, cmd, *args):
#     def echo(self, msg):
#     def to_string(self, separator=';'):
#     def __str__(self):
#     def __iter__(self):
#     def dump_script(self):


# Path: doodad/darchive/archive_builder_docker.py
import os
import pathlib
import sys
import tempfile
import shutil
import time
import subprocess
import uuid
import contextlib
import uuid
import doodad
from doodad.utils import cmd_builder

                                   verbose=verbose,
                                   use_nvidia_docker=use_gpu_image)
        elif container_type == 'docker':
            write_docker_hook(archive_dir, docker_image, mounts,
                              extra_flags=extra_container_flags,
                              script_name=FINAL_SCRIPT,
                              verbose=verbose,
                              use_nvidia_docker=use_gpu_image)
        else:
            raise NotImplementedError()
        write_metadata(archive_dir)

        # create the self-extracting archive
        compile_archive(archive_dir, archive_filename, FINAL_SCRIPT,
                        verbose=verbose)
    finally:
        shutil.rmtree(work_dir)
    return archive_filename

def write_metadata(arch_dir):
    with open(os.path.join(arch_dir, 'METADATA'), 'w') as f:
        f.write('doodad_version=%s\n' % doodad.__version__)
        f.write('unix_timestamp=%d\n' % time.time())
        f.write('uuid=%s\n' % uuid.uuid4())

def write_docker_hook(
        arch_dir, image_name, mounts, script_name,
        extra_flags='',
        verbose=False, use_nvidia_docker=False):
    docker_hook_file = os.path.join(arch_dir, script_name)

    builder = cmd_builder.CommandBuilder()