Re: [Fuego] [PATCH 3/8] Use file descriptor instead of file.write()

"Bird, Tim" <[email protected]> Fri, 13 May 2022 17:56:11 +0000
Newsgroups dev.linux.lists.fuego
Message-ID <BYAPR13MB2503FDFE70FB6CE74945AB6CFDCA9@BYAPR13MB2503.namprd13.prod.outlook.com>

> -----Original Message-----
> From: [email protected] <[email protected]=
m>
>=20
> From: Shivanand Kunijadar <[email protected]>
>=20
> Use of file descriptor to write a file is compatible with python2 and
> python3.
>=20
> Signed-off-by: Shivanand Kunijadar <[email protected]>
> ---
>  scripts/ovgen.py | 12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
>=20
> diff --git a/scripts/ovgen.py b/scripts/ovgen.py
> index faabc62..a6e0f13 100755
> --- a/scripts/ovgen.py
> +++ b/scripts/ovgen.py
> @@ -375,27 +375,27 @@ def generateProlog(logdir, ofcls, classes, testdir,=
 testspec):
>          name =3D ofc.name
>          debug_print ("\nwriting %s base class" % (name))
>=20
> -        file.write(outfile, "#class: %s\n" % (name))
> +        outfile.write("#class: %s\n" % (name))
>=20
>          for var in ofc.vars:
>              outStr =3D "%s=3D\"%s\"" % (var, ofc.vars[var])
>              outStr =3D outStr.replace('"', '\"')
>              debug_print("%s <- %s" % (outFilePath, outStr))
> -            file.write(outfile, outStr+"\n")
> +            outfile.write(outStr+"\n")
>=20
>          for cap in ofc.cap_list:
>              outStr =3D "CAP_%s=3D\"yes\"" % (cap)
>              debug_print("%s <- %s" % (outFilePath, outStr))
> -            file.write(outfile, outStr+"\n")
> +            outfile.write(outStr+"\n")
>=20
> -        file.write(outfile, "\n")
> +        outfile.write("\n")
>=20
>          for func in ofc.funcs:
>              body =3D ofc.funcs[func]
>              debug_print("%s <- %s()" % (outFilePath, func))
> -            file.write(outfile, body+"\n")
> +            outfile.write(body+"\n")
>=20
> -        file.write(outfile, "\n")
> +        outfile.write("\n")
>=20
>      ts =3D parseSpec(logdir, testdir, testspec)
>      generateSpec(ts, outfile)
> --
> 2.20.1
>=20

Looks good.  Tested (with python2) and applied.

Thanks.
 -- Tim