Skip to content

Commit 01703ad

Browse files
committed
merge doc changes from numpy
1 parent 3947af9 commit 01703ad

File tree

3 files changed

+27
-12
lines changed

3 files changed

+27
-12
lines changed

doc/Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ SPHINXOPTS =
99
SPHINXBUILD = LANG=C sphinx-build
1010
PAPER =
1111

12+
NEED_AUTOSUMMARY = $(shell $(PYTHON) -c 'import sphinx; print sphinx.__version__ >= "0.7" and "1" or ""')
13+
1214
# Internal variables.
1315
PAPEROPT_a4 = -D latex_paper_size=a4
1416
PAPEROPT_letter = -D latex_paper_size=letter
@@ -95,9 +97,11 @@ dist-build:
9597
generate: build/generate-stamp
9698
build/generate-stamp: $(wildcard source/reference/*.rst)
9799
mkdir -p build
100+
ifeq ($(NEED_AUTOSUMMARY),1)
98101
$(PYTHON) \
99102
./sphinxext/autosummary_generate.py source/reference/*.rst \
100103
-p dump.xml -o source/reference/generated
104+
endif
101105
touch build/generate-stamp
102106

103107
html: generate

doc/source/conf.py

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,29 @@
1313

1414
import sys, os
1515

16-
# If your extensions are in another directory, add it here. If the directory
17-
# is relative to the documentation root, use os.path.abspath to make it
18-
# absolute, like shown here.
19-
sys.path.append(os.path.abspath('../sphinxext'))
16+
# Check Sphinx version
17+
import sphinx
18+
if sphinx.__version__ < "0.5":
19+
raise RuntimeError("Sphinx 0.5.dev or newer required")
2020

2121
# General configuration
2222
# ---------------------
2323

2424
# Add any Sphinx extension module names here, as strings. They can be extensions
2525
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
26-
extensions = ['sphinx.ext.pngmath', 'sphinx.ext.autodoc',
27-
'ipython_console_highlighting', 'plot_directive', 'numpydoc',
28-
'docscrape', 'docscrape_sphinx', 'autosummary']
26+
27+
sys.path.append(os.path.abspath('../sphinxext'))
28+
29+
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.pngmath', 'numpydoc',
30+
'sphinx.ext.intersphinx', 'sphinx.ext.coverage',
31+
'only_directives']
32+
33+
if sphinx.__version__ >= "0.7":
34+
extensions.append('sphinx.ext.autosummary')
35+
import glob
36+
autosummary_generate = glob.glob("reference/*.rst")
37+
else:
38+
extensions.append('autosummary')
2939

3040
# Add any paths that contain templates here, relative to this directory.
3141
templates_path = ['_templates']

doc/sphinxext/autosummary.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,12 @@
6262
from docscrape_sphinx import get_doc_object
6363

6464
import warnings
65-
warnings.warn("The numpydoc.autosummary extension will be eventually moved to "
66-
"sphinx.ext.autosummary. One version is already available in "
67-
"Sphinx >= 0.6; expect this module to be deprecated after all "
68-
"remaining features have been integrated there.",
69-
FutureWarning, stacklevel=2)
65+
warnings.warn(
66+
"The numpydoc.autosummary extension can also be found as "
67+
"sphinx.ext.autosummary in Sphinx >= 0.6, and the version in "
68+
"Sphinx >= 0.7 is superior to the one in numpydoc. This numpydoc "
69+
"version of autosummary is no longer maintained.",
70+
DeprecationWarning, stacklevel=2)
7071

7172
def setup(app):
7273
app.add_directive('autosummary', autosummary_directive, True, (0, 0, False),

0 commit comments

Comments
 (0)