def install():
    """
    Main entry point for running sphinx_me as a script.
    Creates a docs directory in the current directory and adds the
    required files for generating Sphinx docs from the project's
    README file - a conf module that calls setup_conf() from this
    module, and an index file that includes the project's README.
    """
    for name in listdir(getcwd()):
        if splitext(name)[0].upper() == "README":
            readme = name
            break
    else:
        print()
        print("ABORT: No README file in the current directory.")
        return

    docs_path = join(getcwd(), "docs")
    if not isdir(docs_path):
        mkdir(docs_path)
    with open(join(docs_path, "index.rst"), "w") as f:
        f.write(".. include:: ../%s" % readme)
    with open(join(docs_path, "conf.py"), "w") as f:
        f.write("# This file is automatically generated via sphinx-me\n")
        f.write("from sphinx_me import setup_conf; setup_conf(globals())\n")
    print()
    print("SUCCESS: Sphinx docs layout created in %s" % docs_path)
    try:
        import sphinx
    except ImportError:
        print()
        print("Sphinx not installed. Not building docs.")
    else:
        build_path = join(docs_path, "build")
        Popen(["sphinx-build", docs_path, build_path]).wait()
        print()
        print("Docs built in %s" % build_path)