tasks/rtloader.py
def generate_doc(ctx):
    """
    Generates the doxygen documentation, puts it in rtloader/doc, and logs doc errors/warnings.
    (rtloader/doc is hardcoded right now in the Doxyfile, as doxygen cannot take the output directory as argument)
    Logs all errors and warnings to <rtloader_path>/doxygen/errors.log and to the standard output.
    Returns 1 if errors were found (by default, doxygen returns 0 even if errors are present).
    """
    rtloader_path = get_rtloader_path()

    # Clean up Doxyfile options that are not supported on the version of Doxygen used
    result = ctx.run(f"doxygen -u '{rtloader_path}/doxygen/Doxyfile'", warn=True)
    if result.exited != 0:
        print("Fatal error encountered while trying to clean up the Doxyfile.")
        raise Exit(code=result.exited)

    # doxygen puts both errors and warnings in stderr
    result = ctx.run(
        "doxygen '{0}/doxygen/Doxyfile' 2>'{0}/doxygen/errors.log'".format(rtloader_path), warn=True  # noqa: FS002
    )

    if result.exited != 0:
        print("Fatal error encountered while trying to generate documentation.")
        print(f"See {rtloader_path}/doxygen/errors.log for details.")
        raise Exit(code=result.exited)

    errors, warnings = [], []

    def flushentry(entry):
        if 'error:' in entry:
            errors.append(entry)
        elif 'warning:' in entry:
            warnings.append(entry)

    # Separate warnings from errors
    with open(f"{rtloader_path}/doxygen/errors.log") as errfile:
        currententry = ""
        for line in errfile.readlines():
            if 'error:' in line or 'warning:' in line:  # We get to a new entry, flush current one
                flushentry(currententry)
                currententry = ""

            currententry += line

        flushentry(currententry)  # Flush last entry

        print("\033[93m{}\033[0m".format("\n".join(warnings)))  # noqa: FS002
        print("\033[91m{}\033[0m".format("\n".join(errors)))  # noqa: FS002
        print(f"Found {len(errors)} error(s) and {len(warnings)} warning(s) while generating documentation.")
        print(f"The full list is available in {rtloader_path}/doxygen/errors.log.")

    # Exit with non-zero code if an error has been found
    if len(errors) > 0:
        raise Exit(code=1)

    Generates the doxygen documentation, puts it in rtloader/doc, and logs doc errors/warnings.
    (rtloader/doc is hardcoded right now in the Doxyfile, as doxygen cannot take the output directory as argument)
    Logs all errors and warnings to <rtloader_path>/doxygen/errors.log and to the standard output.
    Returns 1 if errors were found (by default, doxygen returns 0 even if errors are present).
    
Generates the doxygen documentation, puts it in rtloader/doc, and logs doc errors/warnings.
(rtloader/doc is hardcoded right now in the Doxyfile, as doxygen cannot take the output directory as argument)
Logs all errors and warnings to /doxygen/errors.log and to the standard output.
Returns 1 if errors were found (by default, doxygen returns 0 even if errors are present).
Generates the doxygen documentation puts it in rtloader / doc and logs doc errors / warnings . ( rtloader / doc is hardcoded right now in the Doxyfile as doxygen cannot take the output directory as argument ) Logs all errors and warnings to / doxygen / errors . log and to the standard output . Returns 1 if errors were found ( by default doxygen returns 0 even if errors are present ) .
def generate_doc(ctx):
    rtloader_path = get_rtloader_path()
    result = ctx.run(f"doxygen -u '{rtloader_path}/doxygen/Doxyfile'", warn=True)
    if result.exited != 0:
        print("Fatal error encountered while trying to clean up the Doxyfile.")
        raise Exit(code=result.exited)
    result = ctx.run(
        "doxygen '{0}/doxygen/Doxyfile' 2>'{0}/doxygen/errors.log'".format(rtloader_path), warn=True  
    )
    if result.exited != 0:
        print("Fatal error encountered while trying to generate documentation.")
        print(f"See {rtloader_path}/doxygen/errors.log for details.")
        raise Exit(code=result.exited)
    errors, warnings = [], []
    def flushentry(entry):
        if 'error:' in entry:
            errors.append(entry)
        elif 'warning:' in entry:
            warnings.append(entry)
    with open(f"{rtloader_path}/doxygen/errors.log") as errfile:
        currententry = ""
        for line in errfile.readlines():
            if 'error:' in line or 'warning:' in line:  
                flushentry(currententry)
                currententry = ""
            currententry += line
        flushentry(currententry)  
        print("\033[93m{}\033[0m".format("\n".join(warnings)))  
        print("\033[91m{}\033[0m".format("\n".join(errors)))  
        print(f"Found {len(errors)} error(s) and {len(warnings)} warning(s) while generating documentation.")
        print(f"The full list is available in {rtloader_path}/doxygen/errors.log.")
    if len(errors) > 0:
        raise Exit(code=1)
def generate_doc ( ctx ) : rtloader_path = get_rtloader_path ( ) result = ctx . run ( f"doxygen -u '{rtloader_path}/doxygen/Doxyfile'" , warn = True ) if result . exited != 0 : print ( "Fatal error encountered while trying to clean up the Doxyfile." ) raise Exit ( code = result . exited ) result = ctx . run ( "doxygen '{0}/doxygen/Doxyfile' 2>'{0}/doxygen/errors.log'" . format ( rtloader_path ) , warn = True ) if result . exited != 0 : print ( "Fatal error encountered while trying to generate documentation." ) print ( f"See {rtloader_path}/doxygen/errors.log for details." ) raise Exit ( code = result . exited ) errors , warnings = [ ] , [ ] def flushentry ( entry ) : if 'error:' in entry : errors . append ( entry ) elif 'warning:' in entry : warnings . append ( entry ) with open ( f"{rtloader_path}/doxygen/errors.log" ) as errfile : currententry = "" for line in errfile . readlines ( ) : if 'error:' in line or 'warning:' in line : flushentry ( currententry ) currententry = "" currententry += line flushentry ( currententry ) print ( "\033[93m{}\033[0m" . format ( "\n" . join ( warnings ) ) ) print ( "\033[91m{}\033[0m" . format ( "\n" . join ( errors ) ) ) print ( f"Found {len(errors)} error(s) and {len(warnings)} warning(s) while generating documentation." ) print ( f"The full list is available in {rtloader_path}/doxygen/errors.log." ) if len ( errors ) > 0 : raise Exit ( code = 1 )
Generates the doxygen documentation, puts it in rtloader/doc, and logs doc errors/warnings.
Generates the doxygen documentation puts it in rtloader / doc and logs doc errors / warnings .
"""
    Generates the doxygen documentation, puts it in rtloader/doc, and logs doc errors/warnings.
    (rtloader/doc is hardcoded right now in the Doxyfile, as doxygen cannot take the output directory as argument)
    Logs all errors and warnings to <rtloader_path>/doxygen/errors.log and to the standard output.
    Returns 1 if errors were found (by default, doxygen returns 0 even if errors are present).
    """ # Clean up Doxyfile options that are not supported on the version of Doxygen used # doxygen puts both errors and warnings in stderr # noqa: FS002 # Separate warnings from errors # We get to a new entry, flush current one # Flush last entry # noqa: FS002 # noqa: FS002 # Exit with non-zero code if an error has been found
ctx