Clean output of driver list generation
The driver list generation takes driver docstrings and attempts to parse that into rst formatted output for publication. With the way this content is formatted within the docstring, this would cause some slightly off formatting in the html output. This attempts to better extract that information to make the output cleaner and more readable. Change-Id: I3b7e0817ade1c86b6d157c96872f00bb1b99c3d8
This commit is contained in:
parent
9aa6c97e00
commit
113b383196
@ -17,6 +17,7 @@
|
|||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import json
|
import json
|
||||||
|
import textwrap
|
||||||
|
|
||||||
from cinder.interface import util
|
from cinder.interface import util
|
||||||
from cinder import objects
|
from cinder import objects
|
||||||
@ -68,9 +69,9 @@ class Output(object):
|
|||||||
def format_description(desc, output):
|
def format_description(desc, output):
|
||||||
desc = desc or '<None>'
|
desc = desc or '<None>'
|
||||||
lines = desc.rstrip('\n').split('\n')
|
lines = desc.rstrip('\n').split('\n')
|
||||||
for line in lines:
|
output.write('* Description: %s' % lines[0])
|
||||||
output.write(' %s' % line)
|
output.write('')
|
||||||
|
output.write(textwrap.dedent('\n'.join(lines[1:])))
|
||||||
|
|
||||||
def print_drivers(drivers, config_name, output):
|
def print_drivers(drivers, config_name, output):
|
||||||
for driver in sorted(drivers, key=lambda x: x.class_fqn):
|
for driver in sorted(drivers, key=lambda x: x.class_fqn):
|
||||||
@ -85,7 +86,6 @@ def print_drivers(drivers, config_name, output):
|
|||||||
if driver.ci_wiki_name and 'Cinder_Jenkins' not in driver.ci_wiki_name:
|
if driver.ci_wiki_name and 'Cinder_Jenkins' not in driver.ci_wiki_name:
|
||||||
output.write('* CI info: %s%s' % (CI_WIKI_ROOT,
|
output.write('* CI info: %s%s' % (CI_WIKI_ROOT,
|
||||||
driver.ci_wiki_name))
|
driver.ci_wiki_name))
|
||||||
output.write('* Description:')
|
|
||||||
format_description(driver.desc, output)
|
format_description(driver.desc, output)
|
||||||
output.write('')
|
output.write('')
|
||||||
output.write('')
|
output.write('')
|
||||||
|
Loading…
Reference in New Issue
Block a user