def check_and_remove_dir()

in build_docs.py [0:0]


def check_and_remove_dir(dir_name):
    """Check to see if the named directory exists. If it does, then remove it.
    Throw an exception if the directory can't be removed."""

    if os.path.exists(dir_name):
        print("Removing directory: " + dir_name)
        try:
            shutil.rmtree(dir_name)
        except:
            print("Couldn't remove " + dir_name)
            print("Remove this directory before building!")
            sys.exit(1)