Skip to content

Commit

Permalink
work around sphinx 1.4 warning
Browse files Browse the repository at this point in the history
this is terribly hacky, but it's the only way I see to supress the warning.
The warning is actually a red herring, because we *mean* to override the
directive in question...

closes astropy#227
  • Loading branch information
eteq authored and bsipocz committed Jun 10, 2016
1 parent 45b4d42 commit 557e7be
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion astropy_helpers/sphinx/ext/autodoc_enhancements.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import sys
import types

from io import StringIO

from sphinx.ext.autodoc import AttributeDocumenter, ModuleDocumenter
from sphinx.util.inspect import isdescriptor

Expand Down Expand Up @@ -94,5 +96,17 @@ def setup(app):
# Need to import this too since it re-registers all the documenter types
# =_=
import sphinx.ext.autosummary.generate

app.add_autodoc_attrgetter(type, type_object_attrgetter)
app.add_autodocumenter(AttributeDocumenter)

_oldwarn = app._warning
try:
# this is a really ugly hack to supress a warning that sphinx 1.4
# generates when overriding an existing directive (which is *desired*
# behavior here). If sphinx implements a better way to supress these
# warnings, that should be used (only the `app.add_autodocumenter` call
# call should be left in)
app._warning = StringIO()
app.add_autodocumenter(AttributeDocumenter)
finally:
app._warning = _oldwarn

0 comments on commit 557e7be

Please sign in to comment.