From 46b32bc7d34adb0df063eaca579c7a2164a76cc9 Mon Sep 17 00:00:00 2001
From: Jason Madden <jamadden@gmail.com>
Date: Tue, 8 Dec 2020 05:39:11 -0600
Subject: [PATCH] Remove mysphinxext.py. It seemed unused. (Fixes a FTBFS)

Bumping its 'noisy' value up, while there were plenty of missing-reference
events it got called for, it never actually printed the line that showed it
resolved something.

--- python-gevent.orig/docs/conf.py
+++ python-gevent/docs/conf.py
@@ -19,8 +19,6 @@
 # for better documentation extraction and ease of tweaking docs.
 os.environ['PURE_PYTHON'] = '1'
 
-sys.path.append(os.path.dirname(__file__))  # for mysphinxext
-
 # If extensions (or modules to document with autodoc) are in another directory,
 # add these directories to sys.path here. If the directory is relative to the
 # documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -45,9 +43,6 @@
     # Third-party
     'repoze.sphinx.autointerface',
     'sphinxcontrib.programoutput',
-
-    # Ours
-    'mysphinxext',
 ]
 
 intersphinx_mapping = {
--- python-gevent.orig/docs/mysphinxext.py
+++ /dev/null
@@ -1,74 +0,0 @@
-from __future__ import print_function
-from sphinx.ext.autodoc import cut_lines
-from sphinx.ext import intersphinx
-from docutils import nodes
-
-noisy = 0
-message_cache = set()
-
-
-def missing_reference(app, env, node, contnode):
-    """Search the index for missing references.
-    For example, resolve :class:`Event` to :class:`Event <gevent.event.Event>`"""
-    # XXX methods and functions resolved by this function miss their ()
-
-    if intersphinx.missing_reference(app, env, node, contnode) is not None:
-        # is there a better way to give intersphinx a bigger priority?
-        return
-
-    env = app.builder.env
-
-    type = node['reftype']
-    target = node['reftarget']
-    modname = node.get('py:module')
-    classname = node.get('py:class')
-
-    if modname and classname:
-        return
-
-    def new_reference(refuri, reftitle):
-        newnode = nodes.reference('', '')
-        newnode['refuri'] = refuri
-        newnode['reftitle'] = reftitle
-        newnode['py:class'] = 'external-xref'
-        newnode['classname'] = 'external-xref'
-        newnode.append(contnode)
-        msg = 'Resolved missing-reference: :%5s:`%s` -> %s' % (type, target, refuri)
-        if noisy >= 1 or msg not in message_cache:
-            print(msg)
-            message_cache.add(msg)
-        return newnode
-
-    if noisy >= 1:
-        print('Looking for %s' % [type, target, modname, classname])
-        print(node)
-
-    for docname, items in env.indexentries.items():
-        if noisy >= 2:
-            print(docname)
-        for _x in items:
-            if noisy >= 4:
-                print(_x)
-            (i_type, i_string, i_target, i_aliasname) = _x[:4]
-            if noisy >= 3:
-                print('---', [i_type, i_string, i_target, i_aliasname])
-            if i_aliasname.endswith(target):
-                stripped_aliasname = i_aliasname[len(docname):]
-                if stripped_aliasname:
-                    assert stripped_aliasname[0] == '.', repr(stripped_aliasname)
-                    stripped_aliasname = stripped_aliasname[1:]
-                    if stripped_aliasname == target:
-                        if noisy >= 1:
-                            print('--- found %s %s in %s' % (type, target, i_aliasname))
-                        return new_reference(docname + '.html#' + i_aliasname, i_aliasname)
-
-    if type == 'mod':
-        modules = [x for x in env.indexentries.keys() if x.startswith('gevent.')]
-        target = 'gevent.' + target
-        if target in modules:
-            return new_reference(target + '.html', target)
-
-
-def setup(app):
-    app.connect('missing-reference', missing_reference)
-    app.connect('autodoc-process-docstring', cut_lines(2, what=['module']))
