Re: [Fuego] [PATCH 6/8] Replace cmp() function with equivalent expression
"Bird, Tim" <[email protected]> Fri, 13 May 2022 22:35:42 +0000
| Newsgroups | dev.linux.lists.fuego |
|---|---|
| Message-ID | <BYAPR13MB2503430459A1A5BC27757001FDCA9@BYAPR13MB2503.namprd13.prod.outlook.com> |
> -----Original Message----- > From: [email protected] <[email protected]= m>>=20 > From: Shivanand Kunijadar <[email protected]> >=20 > The function cmp() is not supported in python3. Replace cmp() function > with equivalent expression and the expression works well in python2 and 3 >=20 > Signed-off-by: Shivanand Kunijadar <[email protected]> > --- > scripts/parser/common.py | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/scripts/parser/common.py b/scripts/parser/common.py > index d7dcfbd..a04047a 100644 > --- a/scripts/parser/common.py > +++ b/scripts/parser/common.py > @@ -547,7 +547,7 @@ def name_compare(a, b): > b_name =3D b["name"] > except: > b_name =3D b > - return cmp(a_name, b_name) > + return (a_name > b_name) - (a_name < b_name) >=20 > def dump_ordered_data(data, indent=3D""): > if type(data)=3D=3Dtype({}): > -- > 2.20.1 >=20 Looks good. Applied. -- Tim