forked from platypush/platypush
Fixed maxdepth
attribute in generate docs.
This commit is contained in:
parent
6d674fef21
commit
efe400f921
1 changed files with 77 additions and 25 deletions
|
@ -16,7 +16,9 @@ def get_all_plugins():
|
||||||
manifests = {mf.component_name for mf in get_manifests(Plugin)}
|
manifests = {mf.component_name for mf in get_manifests(Plugin)}
|
||||||
return {
|
return {
|
||||||
plugin_name: plugin_info
|
plugin_name: plugin_info
|
||||||
for plugin_name, plugin_info in _get_inspect_plugin().get_all_plugins().output.items()
|
for plugin_name, plugin_info in _get_inspect_plugin()
|
||||||
|
.get_all_plugins()
|
||||||
|
.output.items()
|
||||||
if plugin_name in manifests
|
if plugin_name in manifests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +27,9 @@ def get_all_backends():
|
||||||
manifests = {mf.component_name for mf in get_manifests(Backend)}
|
manifests = {mf.component_name for mf in get_manifests(Backend)}
|
||||||
return {
|
return {
|
||||||
backend_name: backend_info
|
backend_name: backend_info
|
||||||
for backend_name, backend_info in _get_inspect_plugin().get_all_backends().output.items()
|
for backend_name, backend_info in _get_inspect_plugin()
|
||||||
|
.get_all_backends()
|
||||||
|
.output.items()
|
||||||
if backend_name in manifests
|
if backend_name in manifests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,8 +44,16 @@ def get_all_responses():
|
||||||
|
|
||||||
# noinspection DuplicatedCode
|
# noinspection DuplicatedCode
|
||||||
def generate_plugins_doc():
|
def generate_plugins_doc():
|
||||||
plugins_index = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'plugins.rst')
|
plugins_index = os.path.join(
|
||||||
plugins_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'platypush', 'plugins')
|
os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'plugins.rst'
|
||||||
|
)
|
||||||
|
plugins_dir = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
'docs',
|
||||||
|
'source',
|
||||||
|
'platypush',
|
||||||
|
'plugins',
|
||||||
|
)
|
||||||
all_plugins = sorted(plugin for plugin in get_all_plugins().keys())
|
all_plugins = sorted(plugin for plugin in get_all_plugins().keys())
|
||||||
|
|
||||||
for plugin in all_plugins:
|
for plugin in all_plugins:
|
||||||
|
@ -57,15 +69,17 @@ def generate_plugins_doc():
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
|
||||||
with open(plugins_index, 'w') as f:
|
with open(plugins_index, 'w') as f:
|
||||||
f.write('''
|
f.write(
|
||||||
|
'''
|
||||||
Plugins
|
Plugins
|
||||||
=======
|
=======
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Plugins:
|
:caption: Plugins:
|
||||||
|
|
||||||
''')
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
for plugin in all_plugins:
|
for plugin in all_plugins:
|
||||||
f.write(' platypush/plugins/' + plugin + '.rst\n')
|
f.write(' platypush/plugins/' + plugin + '.rst\n')
|
||||||
|
@ -73,8 +87,16 @@ Plugins
|
||||||
|
|
||||||
# noinspection DuplicatedCode
|
# noinspection DuplicatedCode
|
||||||
def generate_backends_doc():
|
def generate_backends_doc():
|
||||||
backends_index = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'backends.rst')
|
backends_index = os.path.join(
|
||||||
backends_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'platypush', 'backend')
|
os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'backends.rst'
|
||||||
|
)
|
||||||
|
backends_dir = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
'docs',
|
||||||
|
'source',
|
||||||
|
'platypush',
|
||||||
|
'backend',
|
||||||
|
)
|
||||||
all_backends = sorted(backend for backend in get_all_backends().keys())
|
all_backends = sorted(backend for backend in get_all_backends().keys())
|
||||||
|
|
||||||
for backend in all_backends:
|
for backend in all_backends:
|
||||||
|
@ -90,15 +112,17 @@ def generate_backends_doc():
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
|
||||||
with open(backends_index, 'w') as f:
|
with open(backends_index, 'w') as f:
|
||||||
f.write('''
|
f.write(
|
||||||
|
'''
|
||||||
Backends
|
Backends
|
||||||
========
|
========
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Backends:
|
:caption: Backends:
|
||||||
|
|
||||||
''')
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
for backend in all_backends:
|
for backend in all_backends:
|
||||||
f.write(' platypush/backend/' + backend + '.rst\n')
|
f.write(' platypush/backend/' + backend + '.rst\n')
|
||||||
|
@ -107,8 +131,17 @@ Backends
|
||||||
# noinspection DuplicatedCode
|
# noinspection DuplicatedCode
|
||||||
def generate_events_doc():
|
def generate_events_doc():
|
||||||
from platypush.message import event as event_module
|
from platypush.message import event as event_module
|
||||||
events_index = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'events.rst')
|
|
||||||
events_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'platypush', 'events')
|
events_index = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'events.rst'
|
||||||
|
)
|
||||||
|
events_dir = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
'docs',
|
||||||
|
'source',
|
||||||
|
'platypush',
|
||||||
|
'events',
|
||||||
|
)
|
||||||
all_events = sorted(event for event in get_all_events().keys() if event)
|
all_events = sorted(event for event in get_all_events().keys() if event)
|
||||||
|
|
||||||
for event in all_events:
|
for event in all_events:
|
||||||
|
@ -116,22 +149,26 @@ def generate_events_doc():
|
||||||
if not os.path.exists(event_file):
|
if not os.path.exists(event_file):
|
||||||
header = '``{}``'.format(event)
|
header = '``{}``'.format(event)
|
||||||
divider = '=' * len(header)
|
divider = '=' * len(header)
|
||||||
body = '\n.. automodule:: {}.{}\n :members:\n'.format(event_module.__name__, event)
|
body = '\n.. automodule:: {}.{}\n :members:\n'.format(
|
||||||
|
event_module.__name__, event
|
||||||
|
)
|
||||||
out = '\n'.join([header, divider, body])
|
out = '\n'.join([header, divider, body])
|
||||||
|
|
||||||
with open(event_file, 'w') as f:
|
with open(event_file, 'w') as f:
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
|
||||||
with open(events_index, 'w') as f:
|
with open(events_index, 'w') as f:
|
||||||
f.write('''
|
f.write(
|
||||||
|
'''
|
||||||
Events
|
Events
|
||||||
======
|
======
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Events:
|
:caption: Events:
|
||||||
|
|
||||||
''')
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
for event in all_events:
|
for event in all_events:
|
||||||
f.write(' platypush/events/' + event + '.rst\n')
|
f.write(' platypush/events/' + event + '.rst\n')
|
||||||
|
@ -140,31 +177,46 @@ Events
|
||||||
# noinspection DuplicatedCode
|
# noinspection DuplicatedCode
|
||||||
def generate_responses_doc():
|
def generate_responses_doc():
|
||||||
from platypush.message import response as response_module
|
from platypush.message import response as response_module
|
||||||
responses_index = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'responses.rst')
|
|
||||||
responses_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'platypush', 'responses')
|
responses_index = os.path.join(
|
||||||
all_responses = sorted(response for response in get_all_responses().keys() if response)
|
os.path.dirname(os.path.abspath(__file__)), 'docs', 'source', 'responses.rst'
|
||||||
|
)
|
||||||
|
responses_dir = os.path.join(
|
||||||
|
os.path.dirname(os.path.abspath(__file__)),
|
||||||
|
'docs',
|
||||||
|
'source',
|
||||||
|
'platypush',
|
||||||
|
'responses',
|
||||||
|
)
|
||||||
|
all_responses = sorted(
|
||||||
|
response for response in get_all_responses().keys() if response
|
||||||
|
)
|
||||||
|
|
||||||
for response in all_responses:
|
for response in all_responses:
|
||||||
response_file = os.path.join(responses_dir, response + '.rst')
|
response_file = os.path.join(responses_dir, response + '.rst')
|
||||||
if not os.path.exists(response_file):
|
if not os.path.exists(response_file):
|
||||||
header = '``{}``'.format(response)
|
header = '``{}``'.format(response)
|
||||||
divider = '=' * len(header)
|
divider = '=' * len(header)
|
||||||
body = '\n.. automodule:: {}.{}\n :members:\n'.format(response_module.__name__, response)
|
body = '\n.. automodule:: {}.{}\n :members:\n'.format(
|
||||||
|
response_module.__name__, response
|
||||||
|
)
|
||||||
out = '\n'.join([header, divider, body])
|
out = '\n'.join([header, divider, body])
|
||||||
|
|
||||||
with open(response_file, 'w') as f:
|
with open(response_file, 'w') as f:
|
||||||
f.write(out)
|
f.write(out)
|
||||||
|
|
||||||
with open(responses_index, 'w') as f:
|
with open(responses_index, 'w') as f:
|
||||||
f.write('''
|
f.write(
|
||||||
|
'''
|
||||||
Responses
|
Responses
|
||||||
=========
|
=========
|
||||||
|
|
||||||
.. toctree::
|
.. toctree::
|
||||||
:maxdepth: 2
|
:maxdepth: 1
|
||||||
:caption: Responses:
|
:caption: Responses:
|
||||||
|
|
||||||
''')
|
'''
|
||||||
|
)
|
||||||
|
|
||||||
for response in all_responses:
|
for response in all_responses:
|
||||||
f.write(' platypush/responses/' + response + '.rst\n')
|
f.write(' platypush/responses/' + response + '.rst\n')
|
||||||
|
|
Loading…
Reference in a new issue