From patchwork Sat Jan 3 20:32:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1249 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472386; bh=j4/FrPFbxxwxhArDBkE8Ax4grPTCm2tfEYoEFnxR9TM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gSTqVsyMihpdndMsvVcIRQobKqcB0Qrg695oOjrz1Acgdv/4ahkPRNmCaQYZXEixS MQUv2XSVmC08vp9cGih1mtIz3SYlrkGv5tW3vnveplPZ3Xei/BT/0B/cVy9Wwh1Dzq JnnS6mf6fnQQcP4ndPTsy6D+CEp70TSYi++EIkIA5OuteJsB1DSd3eW4ZSOa6LddAB 5uR6NQ7xeZtSIvWpxOn1SphoiyJ36Ly4m1uaNtQU37gvy2v6x0MzOtRgVwLbuPRlmL +xoDxRIWykSLGFwKiTAe0l2qfoC+bDnNqHMk5Q0uwsYXhmSUoUSB5GOFqKfbVe13rr rMpP2GZOXTTuA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A12AC68F71 for ; Sat, 3 Jan 2026 13:33:06 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id gCkUDnksQxtY for ; Sat, 3 Jan 2026 13:33:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472386; bh=j4/FrPFbxxwxhArDBkE8Ax4grPTCm2tfEYoEFnxR9TM=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=gSTqVsyMihpdndMsvVcIRQobKqcB0Qrg695oOjrz1Acgdv/4ahkPRNmCaQYZXEixS MQUv2XSVmC08vp9cGih1mtIz3SYlrkGv5tW3vnveplPZ3Xei/BT/0B/cVy9Wwh1Dzq JnnS6mf6fnQQcP4ndPTsy6D+CEp70TSYi++EIkIA5OuteJsB1DSd3eW4ZSOa6LddAB 5uR6NQ7xeZtSIvWpxOn1SphoiyJ36Ly4m1uaNtQU37gvy2v6x0MzOtRgVwLbuPRlmL +xoDxRIWykSLGFwKiTAe0l2qfoC+bDnNqHMk5Q0uwsYXhmSUoUSB5GOFqKfbVe13rr rMpP2GZOXTTuA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 86D34690BC for ; Sat, 3 Jan 2026 13:33:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472384; bh=2IfbPUPWPyPm0CmkQ9Hd+MVFdVuNX1fskVnA0EEezJI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=URPPfI1oVxVibrf7sK19MGfV8W5MB3awFMfDRYpTYM/NgJS5ZAmVmKT9xSQRBuWeB DkLf0u980WJhcCa77VEwsPGT+pv/49mWiSwBm9+N+b7L/6pBO+YJ7S6ROoRVns7P/+ BQegJhQEpj2NUfwk6yEH7excui0CUxNOhMDVCH29JWrpzbjFb0DmD8hnN+AqWo+dCp eXKHEjq57DCdsYiNuaPZ+JrsYYfEi20ucN0rJLtXqbv/qVVrS0AieSxtd6QbcFwhVy i1EXpZvtaeP7JKorK8dQNBVCOh/QFn7tJpM4Ls+BN6dHfikUapdcEU3uNr3j+RDFZ1 hm2rzvzVYwLWA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A577E68F71; Sat, 3 Jan 2026 13:33:04 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id O0XEXF7tFQK9; Sat, 3 Jan 2026 13:33:04 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767472380; bh=Pfm11IpogP2kF7x5cPqJiz+7w9c6d3T+eukYS0yiaPQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Es0hLavlSg528rbSOc0lpB+D+62VfdMBVVjQoYzaZsZDEzgdarbUN7FexA+/RuAQW TjuVSObwkbfCLy1wzxhe+rNnxUu+QoAhDurZwiWB/HaBfyNbR88m0NhGb1OXFgD2vp j5NI/cEsaz/WJ1t9WOEyTvit1guPFJRuX4Ijp+lkGu5ouR9dIuMUevLueAHU+ZS1sE dA7AV5djtKLJqU/6tK1ux3b/Y/jzZWQDKLqv3zJFcdSIsMLsw4VTaeoD7mG8XogdiG ADV75iHjvP5/xrDjDwrjFcIgzciwkhWC7VEhiDJslf1/avoS9oGJ1+La4BNHToHXBg 7cFfMaJRXkLBQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 250AA68FC8; Sat, 3 Jan 2026 13:33:00 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 3 Jan 2026 13:32:28 -0700 Message-ID: <20260103203243.3727493-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260103203243.3727493-1-sjg@u-boot.org> References: <20260103203243.3727493-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: K3TNLUEVKF5FLTV5VYTK674DFX37IHR7 X-Message-ID-Hash: K3TNLUEVKF5FLTV5VYTK674DFX37IHR7 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/12] buildman: Fix pylint warnings in boards.py List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Fix line-too-long warnings by wrapping long lines, and add missing return-type documentation to various functions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/boards.py | 81 +++++++++++++++++++++++++++++----------- 1 file changed, 59 insertions(+), 22 deletions(-) diff --git a/tools/buildman/boards.py b/tools/buildman/boards.py index 793055550fb..f503d8ef208 100644 --- a/tools/buildman/boards.py +++ b/tools/buildman/boards.py @@ -69,8 +69,8 @@ def output_is_new(output, config_dir, srcdir): srcdir (str): Directory containing Kconfig and MAINTAINERS files Returns: - True if the given output file exists and is newer than any of - *_defconfig, MAINTAINERS and Kconfig*. False otherwise. + bool: True if the given output file exists and is newer than any of + *_defconfig, MAINTAINERS and Kconfig*. False otherwise. Raises: OSError: output file exists but could not be opened @@ -134,8 +134,9 @@ class Expr: Args: props (list of str): List of properties to check + Returns: - True if any of the properties match the regular expression + bool: True if any of the properties match the regular expression """ for prop in props: if self._re.match(prop): @@ -175,8 +176,9 @@ class Term: Args: props (list of str): List of properties to check + Returns: - True if all of the expressions in the Term match, else False + bool: True if all of the expressions in the Term match, else False """ for expr in self._expr_list: if not expr.matches(props): @@ -287,13 +289,15 @@ class KconfigScanner: tname = name[7:].lower() if target: warnings.append( - f'WARNING: {leaf}: Duplicate TARGET_xxx: {target} and {tname}') + f'WARNING: {leaf}: Duplicate TARGET_xxx: ' + f'{target} and {tname}') else: target = tname if not target: cfg_name = expect_target.replace('-', '_').upper() - warnings.append(f'WARNING: {leaf}: No TARGET_{cfg_name} enabled') + warnings.append( + f'WARNING: {leaf}: No TARGET_{cfg_name} enabled') params['target'] = expect_target @@ -502,7 +506,7 @@ class Boards: """Return a list of available boards. Returns: - List of Board objects + list of Board: List of Board objects """ return self._boards @@ -523,7 +527,8 @@ class Boards: """Return a dictionary containing the selected boards Returns: - List of Board objects that are marked selected + OrderedDict: Boards that are marked selected (key=target, + value=Board) """ board_dict = OrderedDict() for brd in self._boards: @@ -535,7 +540,7 @@ class Boards: """Return a list of selected boards Returns: - List of Board objects that are marked selected + list of Board: Board objects that are marked selected """ return [brd for brd in self._boards if brd.build_it] @@ -543,7 +548,7 @@ class Boards: """Return a list of selected boards Returns: - List of board names that are marked selected + list of str: Board names that are marked selected """ return [brd.target for brd in self._boards if brd.build_it] @@ -616,10 +621,10 @@ class Boards: brds (list of Board): List of boards to build, or None/[] for all Returns: - Tuple - Dictionary which holds the list of boards which were selected - due to each argument, arranged by argument. - List of errors found + tuple: + OrderedDict: Boards selected due to each argument, keyed by + argument + list of str: Errors/warnings found """ def _check_board(brd): """Check whether to include or exclude a board @@ -768,8 +773,8 @@ class Boards: params_list = [] warnings = set() - # Data in the queues should be retrieved preriodically. - # Otherwise, the queues would become full and subprocesses would get stuck. + # Data in the queues should be retrieved preriodically. Otherwise, + # the queues would become full and subprocesses would get stuck. while any(p.is_alive() for p in processes): self.read_queues(queues, params_list, warnings) # sleep for a while until the queues are filled @@ -885,7 +890,8 @@ class Boards: output (str): The name of the output file jobs (int): The number of jobs to run simultaneously force (bool): Force to generate the output even if it is new - quiet (bool): True to avoid printing a message if nothing needs doing + quiet (bool): True to avoid printing a message if nothing needs + doing Returns: bool: True if all is well, False if there were warnings @@ -964,7 +970,15 @@ class Boards: self.add_board(newb) def scan_extended(self, dbase, ext): - """Scan for extended boards""" + """Scan for extended boards + + Args: + dbase (tuple): Database of defconfigs + ext (Extended): Extended-board definition + + Returns: + set of str: Set of board names matching the extended definition + """ # First check the fragments frags = [] for frag in ext.fragments: @@ -1026,13 +1040,28 @@ class ExtendedParser: @staticmethod def parse_file(fname): - """Parse a file and return the result""" + """Parse a file and return the result + + Args: + fname (str): Filename to parse + + Returns: + list of Extended: List of extended-board definitions + """ return ExtendedParser.parse_data(fname, tools.read_file(fname, binary=False)) @staticmethod def parse_data(fname, data): - """Parse a file and return the result""" + """Parse a file and return the result + + Args: + fname (str): Filename (for error messages) + data (str): Contents of the file + + Returns: + list of Extended: List of extended-board definitions + """ parser = ExtendedParser() parser.parse(fname, data) return parser.extended @@ -1043,6 +1072,12 @@ class ExtendedParser: Args: fname (str): Filename to parse (used for error messages) data (str): Contents of the file + + Returns: + list of Extended: List of extended-board definitions + + Raises: + ValueError: Invalid syntax in file """ self.start() for seq, line in enumerate(data.splitlines()): @@ -1055,7 +1090,8 @@ class ExtendedParser: if '=' in line: pair = line.split('=') if len(pair) != 2: - raise ValueError(f'{fname}:{linenum}: Invalid CONFIG syntax') + raise ValueError( + f'{fname}:{linenum}: Invalid CONFIG syntax') first, rest = pair cfg = first.strip() value = rest.strip() @@ -1063,7 +1099,8 @@ class ExtendedParser: else: target = line.strip() if ' ' in target: - raise ValueError(f'{fname}:{linenum}: Invalid target regex') + raise ValueError( + f'{fname}:{linenum}: Invalid target regex') self.targets.append(['regex', line.strip()]) else: pair = line.split(':')