From patchwork Sat Jan 10 23:56:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1485 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=1768089482; bh=P5sRbFGbFCc3Tgh0esTKhb39bxXQAgmbnHnc8CMVX74=; 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=etY3Qyrig2S1zUkrbZalW3Ti3hIuytH8nMvshjvcXoeVARI9inO6Rjo0twNmx1p0E t6SVWlpbo4TGKVkCyYsmYDOCRHR8qEpWiJmTvJH9veKtrPBM02v5q0a2FAubywe+Wn fVLJMmUxY/+4M4oVxq7ZSNMTjOU72bZMm+t6rYzEVXWjPzDaT0xq84mwPcoU16KP8Q ze/Bsri3I1hTLs+ec12z80QKM5EhFn7oTdE30FXjFTBbgODi8w+pG+hiHJBCFwTy39 YijsY1eE2Q/zXxQ7diFXnwFxVa8zCzcaDLk8ZeYe/2M+1hD/Nu4rGXApHUsiN1/LSn 9+m9vVcWgeG4Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 777A569186 for ; Sat, 10 Jan 2026 16:58:02 -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 jsiW2euFF3-M for ; Sat, 10 Jan 2026 16:58:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768089482; bh=P5sRbFGbFCc3Tgh0esTKhb39bxXQAgmbnHnc8CMVX74=; 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=etY3Qyrig2S1zUkrbZalW3Ti3hIuytH8nMvshjvcXoeVARI9inO6Rjo0twNmx1p0E t6SVWlpbo4TGKVkCyYsmYDOCRHR8qEpWiJmTvJH9veKtrPBM02v5q0a2FAubywe+Wn fVLJMmUxY/+4M4oVxq7ZSNMTjOU72bZMm+t6rYzEVXWjPzDaT0xq84mwPcoU16KP8Q ze/Bsri3I1hTLs+ec12z80QKM5EhFn7oTdE30FXjFTBbgODi8w+pG+hiHJBCFwTy39 YijsY1eE2Q/zXxQ7diFXnwFxVa8zCzcaDLk8ZeYe/2M+1hD/Nu4rGXApHUsiN1/LSn 9+m9vVcWgeG4Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 636D2692B0 for ; Sat, 10 Jan 2026 16:58:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768089481; bh=KmkExmRHHdYzBiEKG8yMMCRSSflDXtSyLQduOi+ad5A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PjuzFZHUsY4B8dd5mo013ZYM0AYC9Mt8PUM7EZkFBSbuceU8Vt1qH+x+HHJL8OIXN moj4PKVHa2z66hcdRd7C67NQrGAW+E0Mxw0mfeAy/vbMbRn4+680lurY2VYPnDUhlq oCdPI/ufyVgZpj1D75481AtcfQmKLkApruZ8NZzntfZgsiLPy1qYd5ew5q7HFeGj1L 461pAdDlt14eOKVEMhmpSJLcoWfxDSWTkrI5zdhA8OQk7Cnj1iSS2GPvebGbmUxpis edEZ2yAdMZbLfFQ5+E+7c/GkuJgKnKCSoVy71kCiWtkVxura1d+gssanfClzK8OPvd 2cDIc8xhIV/Ew== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7733569186; Sat, 10 Jan 2026 16:58:01 -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 j2vSXTOorNNy; Sat, 10 Jan 2026 16:58:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768089477; bh=A13NrIjtC2qRIywdEkmZwryLQUutgRmaBbCbRJKWQMg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKSjb3yrkehyu0quokfSBR3cp54CJmUrOe6WJj89pJOSBLjJkqGgIZuhw+B1xpeDP 1LYDxQIZg0WgqiCILTVxnD/H8TnuJ3VNlVL08w1eugDLB/qzS2Mu7BfzRVHy1yH+DS quNFIJ+aGECbl6HyF7e0gvioZoEgQoyuMjdsA16Rpgf23tl5xoO5XM9Mf2LCEz/XGd XllxBaA56324ztjPNBoQ47MCzUJWlqDsnjxb4x/K/ec+oMOxWukj0Zl4NcaZBmbpYi DTNj1wHWP6f1AfFKqMqMijg1ssuvVHxrTNCoPua38gvhRG2NepChkGo5OpnkUHhZ1q pnQLJjPsttFDA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2E59A692AE; Sat, 10 Jan 2026 16:57:57 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 10 Jan 2026 16:56:26 -0700 Message-ID: <20260110235633.1064859-14-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260110235633.1064859-1-sjg@u-boot.org> References: <20260110235633.1064859-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: A6WIWNNXJZSIV3H2ITOT6JQUUP7CUTDH X-Message-ID-Hash: A6WIWNNXJZSIV3H2ITOT6JQUUP7CUTDH 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 13/14] buildman: Refactor _handle_command() to use single return 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 Refactor _handle_command() to assign results to a variable and return at the end instead of having multiple return statements throughout. This improves readability and makes the control flow clearer. Also fix extra whitespace before 'size' and 'cpp' in endswith() calls. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/func_test.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 44ca2499b85..d784210446b 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -463,24 +463,23 @@ Idx Name Size VMA LMA File off Algn sys.exit(1) cmd = pipe_list[0][0] args = pipe_list[0][1:] - result = None if cmd == 'git': result = self._handle_command_git(args) elif cmd == './scripts/show-gnu-make': - return command.CommandResult(return_code=0, stdout='make') + result = command.CommandResult(return_code=0, stdout='make') elif cmd.endswith('nm'): - return self._handle_command_nm(args) + result = self._handle_command_nm(args) elif cmd.endswith('objdump'): - return self._handle_command_objdump(args) + result = self._handle_command_objdump(args) elif cmd.endswith('objcopy'): - return self._handle_command_objcopy(args) - elif cmd.endswith( 'size'): - return self._handle_command_size(args) - elif cmd.endswith( 'cpp'): - return self._handle_command_cpp(args) + result = self._handle_command_objcopy(args) + elif cmd.endswith('size'): + result = self._handle_command_size(args) + elif cmd.endswith('cpp'): + result = self._handle_command_cpp(args) elif cmd == 'gcc' and args[0] == '-E': - return self._handle_command_cpp(args[1:]) - if not result: + result = self._handle_command_cpp(args[1:]) + else: # Not handled, so abort print('unknown command', kwargs) sys.exit(1)