Setup function that is called from within the project's
    docs/conf.py module that takes the conf module's globals() and
    assigns the values that can be automatically determined from the
    current project, such as project name, package name, version and
    author.

def setup_conf(conf_globals):
    """
    Setup function that is called from within the project's
    docs/conf.py module that takes the conf module's globals() and
    assigns the values that can be automatically determined from the
    current project, such as project name, package name, version and
    author.
    """
    project_path = abspath(join(dirname(conf_globals["__file__"]), ".."))
    chdir(project_path)
    sys.path.insert(0, project_path)
    authors_file = "AUTHORS"
    version = None
    author = None
    setup = "setup.py"
    setup_path = join(project_path, setup)
    ignore = (setup,)

    # First try and get the author and version from setup.py
    if exists(setup_path):
        try:
            import setuptools
        except ImportError:
            pass
        else:
            version = get_setup_attribute("version", setup_path)
            if version == "0.0.0":
                version = None
            author = get_setup_attribute("author", setup_path)
            if author == "UNKNOWN":
                author = None

    # Iterate through each of the files in the project's directory,
    # looking for an AUTHORS file for the project's author, or
    # importable packages/modules for the version.
    for name in listdir(project_path):
        path = join(project_path, name)
        if name.upper() == authors_file:
            with open(path, "r") as f:
                for line in f.readlines():
                    line = line.strip("*- \n\r\t")
                    if line:
                        author = decode_utf8(line)
                        break
        elif name not in ignore and (isdir(path) or splitext(name)[1] == ".py"):
            try:
                module = __import__(name)
            except (ImportError, ValueError):
                continue
            if not version:
                version = get_version(module)
            if version and not author:
                try:
                    author = decode_utf8(getattr(module, "__author__"))
                except AttributeError:
                    pass

    # Ask for any values that couldn't be found.
    if not version:
        version = input("No version number found, please enter one: ")
    if not author:
        author = input("No author found, please enter one: ")
        author = decode_utf8(author)
        with open(join(project_path, authors_file), "wb") as f:
            f.write(author.encode('utf-8'))

    # Inject the minimum required names into the conf module.
    settings = {
        "version": version,
        "release": version,
        "project": project_path.rstrip(sep).split(sep)[-1],
        "master_doc": "index",
        "copyright": "%s, %s" % (datetime.now().year, author),
    }
    pad = max([len(k) for k in settings.keys()]) + 3
    print()
    print("sphinx-me using the following values:")
    print()
    print("\n".join([(k + ":").ljust(pad) + v for k, v in settings.items()]))
    print()
    conf_globals.update(settings)