Add argument to support-matrix sphinx extension

Make it easier to add additional support-matrix entries by making the
filename of the ini file a required argument of the directive.

As a side effect, its clearer in the rst file where the data is stored.

Change-Id: I05bd30b64152368b53c030a32754d0ed4a35bf88
This commit is contained in:
John Garbutt 2016-01-06 11:29:39 +00:00
parent 21f6f7b63a
commit b583604f05
2 changed files with 4 additions and 6 deletions

View File

@ -115,9 +115,8 @@ class SupportMatrixTarget(object):
class SupportMatrixDirective(rst.Directive):
option_spec = {
'support-matrix': six.text_type,
}
# The argument is the filename, e.g. support-matrix.ini
required_arguments = 1
def run(self):
matrix = self._load_support_matrix()
@ -132,8 +131,7 @@ class SupportMatrixDirective(rst.Directive):
cfg = configparser.SafeConfigParser()
env = self.state.document.settings.env
fname = self.options.get("support-matrix",
"support-matrix.ini")
fname = self.arguments[0]
rel_fpath, fpath = env.relfn2path(fname)
with open(fpath) as fp:
cfg.readfp(fp)

View File

@ -39,4 +39,4 @@ following general guiding principles were applied
optional feature becoming mandatory at a later date, based on other
principles above.
.. support_matrix::
.. support_matrix:: support-matrix.ini