From 99f1911520322f173424d51289d8e19dc8b20604 Mon Sep 17 00:00:00 2001 From: Stephanos Ioannidis Date: Mon, 25 Jul 2022 01:04:06 +0900 Subject: [PATCH] doc: gen_devicetree_rest: Fix binding doc file name resolution The `binding_filename` function, which resolves the binding documentation file name from the binding yaml file name, made a very crude assumption that the binding yaml file name will always have the extension name of `yaml` -- this is no longer true after the commit c4532200061c7bda595745a5a07b5d341158513c, which added support for both `yaml` or `yml`. This commit reworks the function such that its implementation is not dependent on the extension name of the binding yaml file. Signed-off-by: Stephanos Ioannidis --- doc/_scripts/gen_devicetree_rest.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/_scripts/gen_devicetree_rest.py b/doc/_scripts/gen_devicetree_rest.py index bf38526a0b0..b87cb1dd86f 100644 --- a/doc/_scripts/gen_devicetree_rest.py +++ b/doc/_scripts/gen_devicetree_rest.py @@ -796,9 +796,9 @@ def binding_filename(binding): if idx == -1: raise ValueError(f'binding path has no {dts_bindings}: {binding.path}') - # Cut past dts/bindings, strip off the .yaml, and replace with - # .rst. - return as_posix[idx + len(dts_bindings):-4] + 'rst' + # Cut past dts/bindings, strip off the extension (.yaml or .yml), and + # replace with .rst. + return os.path.splitext(as_posix[idx + len(dts_bindings):])[0] + '.rst' def binding_ref_target(binding): # Return the sphinx ':ref:' target name for a binding.