def _get_directives_and_roles_from_sphinx():
    """Return a tuple of Sphinx directive and roles."""
    if SPHINX_INSTALLED:
        sphinx_directives = list(sphinx.domains.std.StandardDomain.directives)
        sphinx_roles = list(sphinx.domains.std.StandardDomain.roles)

        for domain in [sphinx.domains.c.CDomain,
                       sphinx.domains.cpp.CPPDomain,
                       sphinx.domains.javascript.JavaScriptDomain,
                       sphinx.domains.python.PythonDomain]:

            sphinx_directives += list(domain.directives) + [
                '{}:{}'.format(domain.name, item)
                for item in list(domain.directives)]

            sphinx_roles += list(domain.roles) + [
                '{}:{}'.format(domain.name, item)
                for item in list(domain.roles)]
    else:
        sphinx_roles = [
            'abbr',
            'command',
            'dfn',
            'doc',
            'download',
            'envvar',
            'file',
            'guilabel',
            'kbd',
            'keyword',
            'mailheader',
            'makevar',
            'manpage',
            'menuselection',
            'mimetype',
            'newsgroup',
            'option',
            'program',
            'py:func',
            'ref',
            'regexp',
            'samp',
            'term',
            'token']

        sphinx_directives = [
            'autosummary',
            'currentmodule',
            'centered',
            'c:function',
            'c:type',
            'include',
            'deprecated',
            'envvar',
            'glossary',
            'index',
            'no-code-block',
            'literalinclude',
            'hlist',
            'option',
            'productionlist',
            'py:function',
            'seealso',
            'toctree',
            'todo',
            'versionadded',
            'versionchanged']

    return (sphinx_directives, sphinx_roles)
Return a tuple of Sphinx directive and roles.