|
12 | 12 |
|
13 | 13 | import sys
|
14 | 14 | import os
|
| 15 | +import re |
15 | 16 | from pandas.compat import u
|
16 | 17 |
|
17 | 18 | # If extensions (or modules to document with autodoc) are in another directory,
|
|
46 | 47 | 'sphinx.ext.coverage',
|
47 | 48 | 'sphinx.ext.pngmath',
|
48 | 49 | 'sphinx.ext.ifconfig',
|
49 |
| - 'sphinx.ext.autosummary', |
50 | 50 | 'matplotlib.sphinxext.only_directives',
|
51 | 51 | 'matplotlib.sphinxext.plot_directive',
|
52 | 52 | ]
|
53 | 53 |
|
| 54 | + |
| 55 | + |
| 56 | +with open("index.rst") as f: |
| 57 | + lines = f.readlines() |
| 58 | + |
| 59 | +# only include the slow autosummary feature if we're building the API section |
| 60 | +# of the docs |
| 61 | + |
| 62 | +# JP: added from sphinxdocs |
| 63 | +autosummary_generate = False |
| 64 | + |
| 65 | +if any([re.match("\s*api\s*",l) for l in lines]): |
| 66 | + extensions.append('sphinx.ext.autosummary') |
| 67 | + autosummary_generate = True |
| 68 | + |
| 69 | +ds = [] |
| 70 | +for f in os.listdir(os.path.dirname(__file__)): |
| 71 | + if (not f.endswith(('.rst'))) or (f.startswith('.')) or os.path.basename(f) == 'index.rst': |
| 72 | + continue |
| 73 | + |
| 74 | + _f = f.split('.rst')[0] |
| 75 | + if not any([re.match("\s*%s\s*$" % _f,l) for l in lines]): |
| 76 | + ds.append(f) |
| 77 | + |
| 78 | +if ds: |
| 79 | + print("I'm about to DELETE the following:\n%s\n" % list(sorted(ds))) |
| 80 | + sys.stdout.write("WARNING: I'd like to delete those to speed up proccesing (yes/no)? ") |
| 81 | + answer = raw_input() |
| 82 | + |
| 83 | + if answer.lower().strip() in ('y','yes'): |
| 84 | + for f in ds: |
| 85 | + f = os.path.join(os.path.join(os.path.dirname(__file__),f)) |
| 86 | + f= os.path.abspath(f) |
| 87 | + try: |
| 88 | + print("Deleting %s" % f) |
| 89 | + os.unlink(f) |
| 90 | + except: |
| 91 | + print("Error deleting %s" % f) |
| 92 | + pass |
| 93 | + |
54 | 94 | # Add any paths that contain templates here, relative to this directory.
|
55 | 95 | templates_path = ['../_templates']
|
56 | 96 |
|
|
80 | 120 | # The full version, including alpha/beta/rc tags.
|
81 | 121 | release = version
|
82 | 122 |
|
83 |
| -# JP: added from sphinxdocs |
84 |
| -autosummary_generate = True |
85 |
| - |
86 | 123 | # The language for content autogenerated by Sphinx. Refer to documentation
|
87 | 124 | # for a list of supported languages.
|
88 | 125 | # language = None
|
|
0 commit comments