From b583604f0528a3666e12128b09be5ed783b29b51 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Wed, 6 Jan 2016 11:29:39 +0000 Subject: [PATCH] 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 --- doc/ext/support_matrix.py | 8 +++----- doc/source/support-matrix.rst | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/doc/ext/support_matrix.py b/doc/ext/support_matrix.py index 2cad277d689b..0199efc46e5a 100644 --- a/doc/ext/support_matrix.py +++ b/doc/ext/support_matrix.py @@ -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) diff --git a/doc/source/support-matrix.rst b/doc/source/support-matrix.rst index fa3d2a482a2b..ccf9090f478c 100644 --- a/doc/source/support-matrix.rst +++ b/doc/source/support-matrix.rst @@ -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