Re: [PATCH 2/8] docs: kernel_{abi,feat}.py: use doc.current_source

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 05 Feb 2024, Vegard Nossum <vegard.nossum@xxxxxxxxxx> wrote:
> It probably doesn't matter a whole lot what we actually pass here,
> but the .rst being processed seems most appropriate to me.

But it's not the actual .rst file being parsed here. It's something
originating from some oher file and processed in between. The kernel-doc
extension takes care to map the parsing errors in source code comments
to the right source file and line, which is where the problem is, not in
the .rst file.

The line numbers in the error messages will be adjusted according to the
ViewList. So I don't think you'll get messages that actually point at
line where the directive is either.

Please experiment with some errors injected to see what the output will
be.


BR,
Jani.

>
> This presumably gets used by Shpinx to record/report where each line
> of .rst source originates.
>
> Signed-off-by: Vegard Nossum <vegard.nossum@xxxxxxxxxx>
> ---
>  Documentation/sphinx/kernel_abi.py  | 2 +-
>  Documentation/sphinx/kernel_feat.py | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/sphinx/kernel_abi.py b/Documentation/sphinx/kernel_abi.py
> index 5911bd0d7965..288f26097569 100644
> --- a/Documentation/sphinx/kernel_abi.py
> +++ b/Documentation/sphinx/kernel_abi.py
> @@ -88,7 +88,7 @@ class KernelCmd(Directive):
>              args.append('--rst-source')
>  
>          lines = subprocess.check_output(args, cwd=os.path.dirname(doc.current_source)).decode('utf-8')
> -        nodeList = self.nestedParse(lines, self.arguments[0])
> +        nodeList = self.nestedParse(lines, doc.current_source)
>          return nodeList
>  
>      def nestedParse(self, lines, fname):
> diff --git a/Documentation/sphinx/kernel_feat.py b/Documentation/sphinx/kernel_feat.py
> index 03ace5f01b5c..3493621d1a4e 100644
> --- a/Documentation/sphinx/kernel_feat.py
> +++ b/Documentation/sphinx/kernel_feat.py
> @@ -109,7 +109,7 @@ class KernelFeat(Directive):
>              else:
>                  out_lines += line + "\n"
>  
> -        nodeList = self.nestedParse(out_lines, self.arguments[0])
> +        nodeList = self.nestedParse(out_lines, doc.current_source)
>          return nodeList
>  
>      def nestedParse(self, lines, fname):

-- 
Jani Nikula, Intel




[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux