Re: [docs] [PATCH v2 3/4] tools: add gen-doc-links to generate documentation link flags

Quentin Schulz <[email protected]> Fri, 24 Jul 2026 18:27:51 +0200
Newsgroups org.yoctoproject.lists.docs
Message-ID <[email protected]>
Hi Antonin,

On 7/24/26 3:40 PM, Antonin Godard wrote:
> Hi,
> 
> On Mon Jul 20, 2026 at 6:39 PM CEST, Quentin Schulz via lists.yoctoproject.org wrote:
>> Hi Antonin,
>>
>> On 7/16/26 2:18 PM, Antonin Godard via lists.yoctoproject.org wrote:
[...]
>>> +def main():
>>> +    args = parse_arguments()
>>> +
>>> +    yocto_docs_dict = {}
>>> +
>>> +    if not args.yocto_docs_inv.exists():
>>> +        print(f"yocto-docs inventory not found at {args.yocto_docs_inv}, "
>>> +              "use the --yocto-docs-inv option or set YOCTO_DOCS_INV_PATH "
>>> +              "in your environment")
>>> +        sys.exit(0)
>>> +
>>> +    if not args.bitbake_inv.exists():
>>> +        print(f"bitbake inventory not found at {args.yocto_docs_inv}, "
>>> +              "use the --bitbake-inv option or set BITBAKE_INV_PATH "
>>> +              "in your environment")
>>> +        sys.exit(0)
>>
>> Don't you want to sys.exit(1) here (and above) instead to show the user
>> this is an error?
> 
> I did not want to block creating a commit because the docs wasn't built.
> I looked a bit at it and pre-commit does not have a special error code that
> could signify a SKIP.
> 

Mmmmm... Any chance this can be configurable? I'm thinking people may 
want to run this script outside of pre-commit. Maybe via a parameter you 
pass to pre-commit for example, or via an environment variable that is 
set in pre-commit?

In any case, this seems wrong when reading the code and I wouldn't be 
surprised if I ever look into this script in a few years time that I 
won't "fix" this... so add at least add a nice comment just above the 
sys.exit(0) in error paths explaining this is intended and the reason.

[...]

Cheers,
Quentin