From nobody Sun Dec 14 06:00:04 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DFBD21DEFEA; Wed, 29 Jan 2025 16:09:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738167000; cv=none; b=fH6l47qs8qhfeOLTK5QGcpZRjwb4uKDWUWMx2trtinLvx8zlqIOm2WVaT/xOYt3v00HtumI+LsnOWptogxFa4R8+PUyK/DPenRFZwojlzA7xQ92r4dWOGX2G6/+XtQ0x/efKC8sAy1oCjzfEkq0E8QROu4Ai4ue3eoYt++szMEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738167000; c=relaxed/simple; bh=5OUVA+DifT9fiAR1a4XwZcggsOOvHcxKgnNy11VXdK4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=iKervcdhoMx4Ob5l8E1FGNvsCcABgxk0+6acREZyHwEQ7VqSGm+DdRkzBgHaucmJH5XISb2nOTXpv/bJ5EQyBCts0MRlihXIl83FgQ/RS09ZFMcy7StN/tlG9EUzxI45EwqENjxYtTucqseN3c/wyQlnMsZdAvNsmd+Y7WVT1fw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=t/BH31fY; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="t/BH31fY" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7A013C4CEE5; Wed, 29 Jan 2025 16:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1738166999; bh=5OUVA+DifT9fiAR1a4XwZcggsOOvHcxKgnNy11VXdK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=t/BH31fY6T3i68shjEYcsDRGT6Q9RY0aMsPVsDG83pYDdQ57/spyDPw7F26YLrLHk NeJeaMlou4ZJPc0d/EMio/iDvqnM5mkwU7MJVWK14vRM8rOyF7LKS0aK1APQnlNLbu Dg1NZlB081L/mz9kjXYaPZvf94Kx3boS0r5dIh8xaEhxtNA92hd7E5qM1h8R85oE3M 9q3ABVFQQ+939NxrAVoN5EegaOkvIm60jaW44fAe6Hp8E9hGd3w957hXQGfUCY12z8 LO0MDoh7Jw5Z2GWxm8yCM68bISxcKvHrulHHqFUbkffFuZKkeupm+3qWXhvgtyfc0O S5RePaysWQPyQ== Received: from mchehab by mail.kernel.org with local (Exim 4.98) (envelope-from ) id 1tdAdZ-00000004PEK-1eS9; Wed, 29 Jan 2025 17:09:57 +0100 From: Mauro Carvalho Chehab To: Linux Doc Mailing List , "Jonathan Corbet" Cc: Mauro Carvalho Chehab , "Mauro Carvalho Chehab" , linux-kernel@vger.kernel.org, Akira Yokosawa Subject: [RFC 1/6] scripts/get_abi.py: make it backward-compatible with Python 3.6 Date: Wed, 29 Jan 2025 17:09:32 +0100 Message-ID: <6d74360f8cdabeb0bf628a6e870d10e134f396f0.1738166451.git.mchehab+huawei@kernel.org> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: Mauro Carvalho Chehab Content-Type: text/plain; charset="utf-8" Despite being introduced on Python 3.6, the original implementation was too limited: it doesn't accept anything but the argument. Even on python 3.10.12, support was still limited, as more complex operations cause SyntaxError: Exception occurred: File ".../linux/Documentation/sphinx/kernel_abi.py", line 48, in from get_abi import AbiParser File ".../linux/scripts/get_abi.py", line 525 msg +=3D f"{part}\n{"-" * len(part)}\n\n" ^ SyntaxError: f-string: expecting '}' Replace f-strings by normal string concatenation when it doesn't work on Python 3.6. Reported-by: Akira Yokosawa Signed-off-by: Mauro Carvalho Chehab Tested-by: Akira Yokosawa --- scripts/get_abi.py | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/scripts/get_abi.py b/scripts/get_abi.py index 543bed397c8c..e6e94f721fff 100755 --- a/scripts/get_abi.py +++ b/scripts/get_abi.py @@ -522,7 +522,7 @@ class AbiParser: =20 if cur_part and cur_part !=3D part: part =3D cur_part - msg +=3D f"{part}\n{"-" * len(part)}\n\n" + msg +=3D part + "\n"+ "-" * len(part) +"\n\n" =20 msg +=3D f".. _{key}:\n\n" =20 @@ -546,7 +546,7 @@ class AbiParser: msg +=3D f"Defined on file :ref:`{base} <{ref[1]}>`\n\= n" =20 if wtype =3D=3D "File": - msg +=3D f"{names[0]}\n{"-" * len(names[0])}\n\n" + msg +=3D names[0] +"\n" + "-" * len(names[0]) +"\n\n" =20 desc =3D v.get("description") if not desc and wtype !=3D "File": @@ -570,7 +570,8 @@ class AbiParser: =20 users =3D v.get("users") if users and users.strip(" \t\n"): - msg +=3D f"Users:\n\t{users.strip("\n").replace('\n', '\n\= t')}\n\n" + users =3D users.strip("\n").replace('\n', '\n\t') + msg +=3D f"Users:\n\t{users}\n\n" =20 ln =3D v.get("line_no", 1) =20 @@ -596,7 +597,9 @@ class AbiParser: elif len(lines) =3D=3D 1: f.append(f"{fname}:{lines[0]}") else: - f.append(f"{fname} lines {", ".join(str(x) for x in li= nes)}") + m =3D fname + "lines " + m +=3D ", ".join(str(x) for x in lines) + f.append(m) =20 self.log.warning("%s is defined %d times: %s", what, len(f), "= ; ".join(f)) =20 @@ -644,10 +647,11 @@ class AbiParser: if users: print(f"Users:\t\t\t{users}") =20 - print(f"Defined on file{'s'[:len(files) ^ 1]}:\t{", ".= join(files)}") + print("Defined on file(s):\t" + ", ".join(files)) =20 if desc: - print(f"\n{desc.strip("\n")}\n") + desc =3D desc.strip("\n") + print(f"\n{desc}\n") =20 if not found_keys: print(f"Regular expression /{expr}/ not found.") --=20 2.48.1