From patchwork Tue Jan 6 14:28:13 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1289 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=1767709762; bh=Kvd4uxgeoTgisl5lsz5I+ccxUnKIyJmn/OA6+Ryy82w=; 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=L6rgHRoHSFWY/XXwKxD1NnOybitLc12wMUx6zbfh10RBgiTuMRhN36eAJIo3RS0Rq 6q4C4IasP7lYzJ/ZWM9rw80gmCEgYDIj4PmXtorX4S/BDsWpNzEksxusKUGwBoUDaO fT1k6+LdYl6+vSZups9erpnRc+F287pMAIhT6Ci8UJqMtP66aaxFDv64s9BYpDrIc1 3bPZr6jGhO5S6j0KBJAeFkOFXhq0MK68ZG0m49vO/qLI7FncKFKLge49Opr468VBFQ +mlFAJdi/DublAyeVF9MZi+L/5LxNDkFo3YYVoRTuoJ86rlL279VsXYx5zO85Bbegx RHWOUWX10PGfQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9BCF86912C for ; Tue, 6 Jan 2026 07:29:22 -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 Agx16XkGw3iD for ; Tue, 6 Jan 2026 07:29:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709762; bh=Kvd4uxgeoTgisl5lsz5I+ccxUnKIyJmn/OA6+Ryy82w=; 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=L6rgHRoHSFWY/XXwKxD1NnOybitLc12wMUx6zbfh10RBgiTuMRhN36eAJIo3RS0Rq 6q4C4IasP7lYzJ/ZWM9rw80gmCEgYDIj4PmXtorX4S/BDsWpNzEksxusKUGwBoUDaO fT1k6+LdYl6+vSZups9erpnRc+F287pMAIhT6Ci8UJqMtP66aaxFDv64s9BYpDrIc1 3bPZr6jGhO5S6j0KBJAeFkOFXhq0MK68ZG0m49vO/qLI7FncKFKLge49Opr468VBFQ +mlFAJdi/DublAyeVF9MZi+L/5LxNDkFo3YYVoRTuoJ86rlL279VsXYx5zO85Bbegx RHWOUWX10PGfQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 89B5D69121 for ; Tue, 6 Jan 2026 07:29:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709760; bh=qzSeIi7fiLOK0a3OE8Xf71YVC7OpU1TTp+wyJJCiVZE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QbCA75UCyJ8gAYUkBZCHQ8U+S/8frI91v8FqFvXrw2I8RCFsHG49DeX4iePXkeoT6 suWYuabnjnjfz/YEQN76UhjPQyacDG5Hok2p1blZdGItn7b4PBO9O75EbUTYU7WUEW fib6xc4/Alo5eB88T36cTJDsgYZhtp/MmRG43jakcBZRpPNlHsmKmlVA1yOcofeGhl ePvHXaTBTV0r1q9Q+D2mtgY0V8k3MSFVDVfH3I8qtBzX0/oUWYaP15yTw43Tl2uvCU X6rSmc/r7fvr60eeT2LHsJjZAXUh0RmuU7cwq6J3yU3UE10+07QK7FoH2zP5owXOxG UxFR+kYDPQ88w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CE76669054; Tue, 6 Jan 2026 07:29:20 -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 KDN-bYRpvVSl; Tue, 6 Jan 2026 07:29:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767709756; bh=i4dMz/iiny6We6UyZOFZ3t+wjULPIIg12HSz3sDKgBY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UV18yMoloKPWoUAjnNlH6ZEqa48gMDpfPnkj5nXv8gJaS9+cc9gCrOa8K7e4KhiDk piN2V/yRkrw9H+kuiWP9sQnKVwhvv8wDI6mYobF3tWKjfNeC+8W8cSVO63hLTsyGyu wbbzxcnyrGWeQRihMqOgsBreST7WZ/irAs8UOTwqJdZcvUUs34atVeeuaOhT2oNany SBLD9e19w+Hmgq+fSSP91pAH0Fs0fEw5CzeGqfh5VaVbdD0HbRolQMOf6uq+2oZs2J BjYmm82xi4saAG6fVqGP6iZGsLFIc+ujZ1DbSjAxd4/Jp6ZoSisfGTNwlh6MCHn1ck W6e7ig+K1DYjw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AA5F369118; Tue, 6 Jan 2026 07:29:16 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 6 Jan 2026 07:28:13 -0700 Message-ID: <20260106142834.2511220-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260106142834.2511220-1-sjg@u-boot.org> References: <20260106142834.2511220-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: HNYR5JC2CH6ZWTRTMSQCEJMXXWRAV626 X-Message-ID-Hash: HNYR5JC2CH6ZWTRTMSQCEJMXXWRAV626 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/22] buildman: Use tools.write_file() in test.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 Replace open() calls with tools.write_file() for consistency and to fix pylint W1514 (unspecified-encoding) warnings. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/test.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 430e9ee118c..8b015e22090 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -1128,8 +1128,7 @@ class TestBuild(unittest.TestCase): with tempfile.TemporaryDirectory() as tmpdir: # Create a reference file ref_file = os.path.join(tmpdir, 'done') - with open(ref_file, 'w') as f: - f.write('0\n') + tools.write_file(ref_file, b'0\n') # Test with no Kconfig files - should return False self.assertFalse( @@ -1140,8 +1139,7 @@ class TestBuild(unittest.TestCase): # Create a Kconfig file newer than the reference kconfig = os.path.join(tmpdir, 'Kconfig') - with open(kconfig, 'w') as f: - f.write('config TEST\n') + tools.write_file(kconfig, b'config TEST\n') # Should now return True since Kconfig is newer self.assertTrue( @@ -1149,8 +1147,7 @@ class TestBuild(unittest.TestCase): # Create a new reference file (newer than Kconfig) time.sleep(0.1) - with open(ref_file, 'w') as f: - f.write('0\n') + tools.write_file(ref_file, b'0\n') # Should now return False since reference is newer self.assertFalse( @@ -1165,8 +1162,8 @@ class TestBuild(unittest.TestCase): subdir = os.path.join(tmpdir, 'sub') os.makedirs(subdir) time.sleep(0.1) - with open(os.path.join(subdir, 'Kconfig.sub'), 'w') as f: - f.write('config SUBTEST\n') + tools.write_file(os.path.join(subdir, 'Kconfig.sub'), + b'config SUBTEST\n') # Should return True due to newer Kconfig.sub in subdir self.assertTrue( @@ -1174,8 +1171,7 @@ class TestBuild(unittest.TestCase): # Create a new reference file (newer than all Kconfig files) time.sleep(0.1) - with open(ref_file, 'w') as f: - f.write('0\n') + tools.write_file(ref_file, b'0\n') # Should now return False self.assertFalse( @@ -1185,8 +1181,8 @@ class TestBuild(unittest.TestCase): configs_dir = os.path.join(tmpdir, 'configs') os.makedirs(configs_dir) time.sleep(0.1) - with open(os.path.join(configs_dir, 'sandbox_defconfig'), 'w') as f: - f.write('CONFIG_SANDBOX=y\n') + tools.write_file(os.path.join(configs_dir, 'sandbox_defconfig'), + b'CONFIG_SANDBOX=y\n') # Without target, defconfig is not checked self.assertFalse(