|
1 |
| -import os |
2 |
| -import sys |
3 |
| - |
4 |
| -# This is needed since django_select2 requires django model modules |
5 |
| -# and those modules assume that django settings is configured and |
6 |
| -# have proper DB settings. |
7 |
| -# Using this we give a proper environment with working django settings. |
8 |
| -os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings") |
9 |
| - |
10 |
| -# If extensions (or modules to document with autodoc) are in another directory, |
11 |
| -# add these directories to sys.path here. If the directory is relative to the |
12 |
| -# documentation root, use os.path.abspath to make it absolute, like shown here. |
13 |
| -sys.path.insert(0, os.path.abspath('../tests.testapp')) |
14 |
| -sys.path.insert(0, os.path.abspath('..')) |
15 |
| - |
16 |
| -extensions = [ |
17 |
| - 'sphinx.ext.autodoc', |
18 |
| - 'sphinx.ext.napoleon', |
19 |
| - 'sphinx.ext.inheritance_diagram', |
20 |
| - 'sphinx.ext.intersphinx', |
21 |
| - 'sphinx.ext.viewcode', |
22 |
| - 'sphinx.ext.doctest', |
23 |
| -] |
24 |
| - |
25 |
| -intersphinx_mapping = { |
26 |
| - 'python': ('http://docs.python.org/3', None), |
27 |
| - 'django': ('https://docs.djangoproject.com/en/stable/', |
28 |
| - 'https://docs.djangoproject.com/en/stable/_objects/'), |
29 |
| -} |
30 |
| - |
31 |
| -autodoc_default_flags = ['members', 'show-inheritance'] |
32 |
| -autodoc_member_order = 'bysource' |
33 |
| - |
34 |
| -inheritance_graph_attrs = dict(rankdir='TB') |
35 |
| - |
36 |
| -inheritance_node_attrs = dict(shape='rect', fontsize=14, fillcolor='gray90', |
37 |
| - color='gray30', style='filled') |
38 |
| - |
39 |
| -inheritance_edge_attrs = dict(penwidth=0.75) |
| 1 | +import os |
| 2 | +import sys |
| 3 | + |
| 4 | +from pkg_resources import get_distribution |
| 5 | + |
| 6 | +# This is needed since django_select2 requires django model modules |
| 7 | +# and those modules assume that django settings is configured and |
| 8 | +# have proper DB settings. |
| 9 | +# Using this we give a proper environment with working django settings. |
| 10 | +os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.settings") |
| 11 | + |
| 12 | +# If extensions (or modules to document with autodoc) are in another directory, |
| 13 | +# add these directories to sys.path here. If the directory is relative to the |
| 14 | +# documentation root, use os.path.abspath to make it absolute, like shown here. |
| 15 | +sys.path.insert(0, os.path.abspath('../tests.testapp')) |
| 16 | +sys.path.insert(0, os.path.abspath('..')) |
| 17 | + |
| 18 | + |
| 19 | +release = get_distribution('django_select2').version |
| 20 | +version = '.'.join(release.split('.')[:2]) |
| 21 | + |
| 22 | + |
| 23 | +extensions = [ |
| 24 | + 'sphinx.ext.autodoc', |
| 25 | + 'sphinx.ext.napoleon', |
| 26 | + 'sphinx.ext.inheritance_diagram', |
| 27 | + 'sphinx.ext.intersphinx', |
| 28 | + 'sphinx.ext.viewcode', |
| 29 | + 'sphinx.ext.doctest', |
| 30 | +] |
| 31 | + |
| 32 | +intersphinx_mapping = { |
| 33 | + 'python': ('http://docs.python.org/3', None), |
| 34 | + 'django': ('https://docs.djangoproject.com/en/stable/', |
| 35 | + 'https://docs.djangoproject.com/en/stable/_objects/'), |
| 36 | +} |
| 37 | + |
| 38 | +autodoc_default_flags = ['members', 'show-inheritance'] |
| 39 | +autodoc_member_order = 'bysource' |
| 40 | + |
| 41 | +inheritance_graph_attrs = dict(rankdir='TB') |
| 42 | + |
| 43 | +inheritance_node_attrs = dict(shape='rect', fontsize=14, fillcolor='gray90', |
| 44 | + color='gray30', style='filled') |
| 45 | + |
| 46 | +inheritance_edge_attrs = dict(penwidth=0.75) |
0 commit comments