From patchwork Sun Jan 4 20:08:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1260 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=1767557342; bh=dOH6ZNx4gTgPBZGV9dJUTzPIR8Z3gQ67bDDTd20yNYY=; 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=Sva/aXVwvYf1TwxiwqtxIulBqHSQ0sgmtz98I2ovnt3SU66/DM+RdXqrwfJU/Lc6R ut65l2zrpXT2ajs45gFNUocm+rrIyaA5g2zm3wEu98vqCd8nAf4akG+qfByH7XC7DR kvkm/p8WY9AoWU9pYReofNIc32OOoqZytEBzSqTM2gQ8bZc7TNRj4h8GGXxuR+iDh8 gmqAt3wMy20oLdYaNJd/65E8ZUezX7KAiJY+IkQMxUWQ0yAau3kjdIdG+HahKZDXxg rz48GUb4r1GcdbVTDRug2bysRLEF4+cdzSo3ZYuoZKMsQDLEtWSvbS7DAahjGwtKYQ Us6SzOvprlUBg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8BFC869003 for ; Sun, 4 Jan 2026 13:09: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 1hfSXtNAPNha for ; Sun, 4 Jan 2026 13:09:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557342; bh=dOH6ZNx4gTgPBZGV9dJUTzPIR8Z3gQ67bDDTd20yNYY=; 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=Sva/aXVwvYf1TwxiwqtxIulBqHSQ0sgmtz98I2ovnt3SU66/DM+RdXqrwfJU/Lc6R ut65l2zrpXT2ajs45gFNUocm+rrIyaA5g2zm3wEu98vqCd8nAf4akG+qfByH7XC7DR kvkm/p8WY9AoWU9pYReofNIc32OOoqZytEBzSqTM2gQ8bZc7TNRj4h8GGXxuR+iDh8 gmqAt3wMy20oLdYaNJd/65E8ZUezX7KAiJY+IkQMxUWQ0yAau3kjdIdG+HahKZDXxg rz48GUb4r1GcdbVTDRug2bysRLEF4+cdzSo3ZYuoZKMsQDLEtWSvbS7DAahjGwtKYQ Us6SzOvprlUBg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7A688690D1 for ; Sun, 4 Jan 2026 13:09:02 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557340; bh=CRk627loQS8K2QWBgJi9Ad8n4SP6Un5p/GVW6nx/J5E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=M06LfxOwoP7C14FPDnrW75LMpGh+1G3REMxuJUh6XBXIhseICQsybi6FuYvmk3net //mOSsaF1NTyJOiN4vc25OTSw+jXzS/qiBuQkwTBNIpQLquycZVHMQ25hO+lGpQKYK yVD8k+NnGXMVaMnnHIdXMjkBhlSkXz02VgsH18t4QFtH3JwjYBLyLzPLR1qyTvoQ0F kcoh/mUc+eGnF7XVcp6pvugsgTU+5QPlNV4CrXj2ktUVAkz760h/PiI2IU95jWRVQ/ 3FjsGnX9zgHJLKT797jow0+5gWReVBvsO5SfS/UsmU13fFqIsBxKVQFATSuQneTA6m xuiTSPaDIYULA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 81939690D2; Sun, 4 Jan 2026 13:09:00 -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 5k2RerkI6XCK; Sun, 4 Jan 2026 13:09:00 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557336; bh=czUwDr+YNfcdBcp/6kPJUWzTbc5iVFhUeu4ZbKkf/ao=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VV0TFvRc072KBL91zsrHcnCqtllk3hgG7HWE6Qf4GBAQiLy1fwAxt3kAF7SF6Q3wW t9nOcJ8uLhWMgn5jB01q2pDVcPDS1gryUmwql92SS/4Xo2JcvbqE5Pkrn6PWhyBsgT b4yaiNeOIwOmhnnt97XJ9wIgFFQY4sN97Th1KE9k7lYNgAhLxv9pTWYCDHSzSMZPiY yFsX0SojaTHqbwTR11HLw8apM6w+QI1ZWSz0BzHmN/bM8TxM/LKC7Dm+s+8eeXOEdE dtZoH7TkfPVbzxHQCoQ2cFuA1bG4pZrKLQR7ja80iniUSDBXu8u21TYIzaprZ2H+5S Yd1wj3HMxqKWw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D07BE69003; Sun, 4 Jan 2026 13:08:55 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:30 -0700 Message-ID: <20260104200844.481633-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: BMGP2PW6BN7JORKVICKX6AAMU3XNWTJI X-Message-ID-Hash: BMGP2PW6BN7JORKVICKX6AAMU3XNWTJI 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 01/11] buildman: Fix pylint warnings in main.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 the remaining pylint warnings: - Remove dead Python 3.6 importlib_resources fallback import - Fix docstring parameter name (verbosity -> verbose) - Remove unnecessary elif/else after return statements - Add missing return statements for consistent function returns Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/main.py | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 22be946b37d..914dfe04988 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -6,11 +6,7 @@ """See README for more information""" -try: - import importlib.resources -except ImportError: - # for Python 3.6 - import importlib_resources +import importlib.resources import os import sys @@ -33,7 +29,7 @@ def run_tests(skip_net_tests, debug, verbose, args): Args: skip_net_tests (bool): True to skip tests which need the network debug (bool): True to run in debugging mode (full traceback) - verbosity (int): Verbosity level to use (0-4) + verbose (int): Verbosity level to use (0-4) args (list of str): List of tests to run, empty to run all """ # These imports are here since tests are not available when buildman is @@ -87,27 +83,27 @@ def run_buildman(): if cmdline.HAS_TESTS and args.test: return run_tests(args.skip_net_tests, args.debug, args.verbose, args) - elif cmdline.HAS_TESTS and args.coverage: + if cmdline.HAS_TESTS and args.coverage: run_test_coverage() + return 0 - elif args.full_help: + if args.full_help: if hasattr(importlib.resources, 'files'): dirpath = importlib.resources.files('buildman') tools.print_full_help(str(dirpath.joinpath('README.rst'))) else: with importlib.resources.path('buildman', 'README.rst') as readme: tools.print_full_help(str(readme)) - + return 0 # Build selected commits for selected boards - else: - try: - tout.init(tout.INFO if args.verbose else tout.WARNING) - bsettings.setup(args.config_file) - ret_code = control.do_buildman(args) - finally: - tout.uninit() - return ret_code + try: + tout.init(tout.INFO if args.verbose else tout.WARNING) + bsettings.setup(args.config_file) + ret_code = control.do_buildman(args) + finally: + tout.uninit() + return ret_code if __name__ == "__main__": From patchwork Sun Jan 4 20:08:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1261 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=1767557346; bh=qaq3d0IXoBAW8m6hU6PfaehU4bg2kDMFsLH8ijXO114=; 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=ZRepWsIRdYlk7USuauP84CYSqRhR1qiWpwLA1ivw3zbE3mp3E13Z17kxKyrns1XNy nOv/AmTWOLjAhCxxcjRhmGNV+ftvoZNdL5EaqUa05jFpqWiK3cENDJm7GX0M78QUhw oUFWVDRWGqlxmH4cevYMEsDSfozWs/3i/lLv1BJ8I5ew/UXuUl7gA0RBdVCbDnpqjP bUJNYOGz/86HZUGiaTJIh0OkfzXqtxXTG4dkS7ENhVIAnFWm4dPZyjxRmrFbwHVh+G NJOOp6s6iCsRaK26aJFkxA1u4KQwVpfSCgkQoQJMoQ6vzcIJUA47C0sYfKrrqj3vMi 6Ual7GWfwYGCg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 57760690DE for ; Sun, 4 Jan 2026 13:09: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 vt1Uz2MAfEd7 for ; Sun, 4 Jan 2026 13:09:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557346; bh=qaq3d0IXoBAW8m6hU6PfaehU4bg2kDMFsLH8ijXO114=; 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=ZRepWsIRdYlk7USuauP84CYSqRhR1qiWpwLA1ivw3zbE3mp3E13Z17kxKyrns1XNy nOv/AmTWOLjAhCxxcjRhmGNV+ftvoZNdL5EaqUa05jFpqWiK3cENDJm7GX0M78QUhw oUFWVDRWGqlxmH4cevYMEsDSfozWs/3i/lLv1BJ8I5ew/UXuUl7gA0RBdVCbDnpqjP bUJNYOGz/86HZUGiaTJIh0OkfzXqtxXTG4dkS7ENhVIAnFWm4dPZyjxRmrFbwHVh+G NJOOp6s6iCsRaK26aJFkxA1u4KQwVpfSCgkQoQJMoQ6vzcIJUA47C0sYfKrrqj3vMi 6Ual7GWfwYGCg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4792A690D1 for ; Sun, 4 Jan 2026 13:09:06 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557345; bh=P7BWBPkK0AkK0oAyQqpPAS6WQnSuGKg7DABZSgXDQDo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wr9/6PfhROlmPmaWuN9fLqAd0ODDHh8kxMTWL6Q/dLiW/jf3pJIRON474Bxf25Ya+ z4a2JxaYLHqOa0qkjdLwGp/oXKLZm4L6btE0s9kerytaZ76WJwv8jrr3gIVrbfyxi9 7ozTgTAUF6Qovljo3Q9n1wnIstokajG7DBdcWQOvjXyIwqKCzKFm5Z3FyzckDZPAX/ WgEqCvmdnSmXGj7HXnXDfwj+9IeFaSI7hkJkasqc9J8inhXyzpwOJw5xKRYCu4qCzD +nvHTyV3bA60h0H67t3YDW3GdoweYeYHY37hUKMQXepztwV64Fpo7zuW6XvjjqmGyF 8Hmy4iZIeoWqw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 32374690D2; Sun, 4 Jan 2026 13:09:05 -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 LuL0bya5YrUp; Sun, 4 Jan 2026 13:09:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557340; bh=8IIXImWG1rLSiv/U+SaDip03y2BAyEfkg4ybP7HO80o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=k9ljbux3ymmNsz5Hw9pgFOQA95/y1CM89BFMGUOXO1elOuBjc1Ho3I9TeCrdT9Ei8 e91H0ZG/kKmBbMrc8BjVFsS4cW4jjrFlW3nzT5YUR081637LtVIIJWrWLuk2pYYuhA ZdRrTisQtx8dWGUd8F10/MVFZCiDM16KoWvOyZmed8szqgHLs/qLgjJo/xRlDkPN6N R3t/Bwbkz0AF6h/SRVwcuh0b/M+5fy9WyIKCUys4bSzWBskqkpHSYnfOUrXcPg4eWK b+c+QUvKAe5+HxC2USW/reF7WEb/7wnH0kX3BtGq6BMRqZQ6sqUF5Ym6xSmD40ckPN DMiSryka2JAMA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 32421690BD; Sun, 4 Jan 2026 13:09:00 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:31 -0700 Message-ID: <20260104200844.481633-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YFJWRVFGDTWKM6QBEBEKOQMETSZIA7TN X-Message-ID-Hash: YFJWRVFGDTWKM6QBEBEKOQMETSZIA7TN 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: Heinrich Schuchardt , Simon Glass X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 02/11] claude: Drop mention of --no-ext-diff 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 This is not needed anymore, so drop it. The .gitconfig file now has this: [diff] tool = meld prompt = true Signed-off-by: Simon Glass --- CLAUDE.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CLAUDE.md b/CLAUDE.md index aaec9cc031d..5923cd7d8dd 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -58,7 +58,6 @@ um py -B sandbox - The `um` tool is the preferred build method for this codebase - Always run `make mrproper` if you encounter build issues - The sandbox build creates a test environment for U-Boot that runs on the host system -- When using `git diff`, add `--no-ext-diff` to avoid external diff tools that may not work in this environment - `um build` shows no output if everything was ok! - Remember not to cd into the build directory; run U-Boot directly in the source dir - Do not run in-tree builds; always use the crosfw script or 'make O=/tmp/...' From patchwork Sun Jan 4 20:08:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1262 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=1767557350; bh=KXIwgXHqDapim5B6qOj3TFjqptT/qv9xBMAmjXeYEq0=; 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=ELgrLcF6DqEEBla3A+GN/07/PkAQSD5PNXSCERMxb9aWsJPH2lY1aj8o4WRuWCVIj ilDP9DzcNtVNBuppWjlwlHMvTq/HATWbFbmml2cYUv8faaUi1qjzkiPnTHdn2meRJC 8FfeIUxFko4Z4o2EVchmDyjK99CZnoqWZC+AFzQ/Pqkz+a+Pz2oFYekwkUF9oOdJsL bTVnaxDYsNY7WHD4GCiN3++rshm63hNfgCtKb4B9gpM9uv8IGph/kgoNYXrNykM4oE jngrKXTOUGeef0ONnBLi4dgVW1b3+03Kb7i5QYSooMz9I8+mGXCMtZo8Wo69xPYxD8 a5FqYyfryIFVQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C632B690D1 for ; Sun, 4 Jan 2026 13:09:10 -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 3jT4zaNl6yxN for ; Sun, 4 Jan 2026 13:09:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557350; bh=KXIwgXHqDapim5B6qOj3TFjqptT/qv9xBMAmjXeYEq0=; 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=ELgrLcF6DqEEBla3A+GN/07/PkAQSD5PNXSCERMxb9aWsJPH2lY1aj8o4WRuWCVIj ilDP9DzcNtVNBuppWjlwlHMvTq/HATWbFbmml2cYUv8faaUi1qjzkiPnTHdn2meRJC 8FfeIUxFko4Z4o2EVchmDyjK99CZnoqWZC+AFzQ/Pqkz+a+Pz2oFYekwkUF9oOdJsL bTVnaxDYsNY7WHD4GCiN3++rshm63hNfgCtKb4B9gpM9uv8IGph/kgoNYXrNykM4oE jngrKXTOUGeef0ONnBLi4dgVW1b3+03Kb7i5QYSooMz9I8+mGXCMtZo8Wo69xPYxD8 a5FqYyfryIFVQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B36DA690BD for ; Sun, 4 Jan 2026 13:09:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557348; bh=pUm3j4UcUxEsfDMbV1EoAV/YZr3ekSx2mbxwFJSawDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=lbvAoLhhSE/Itv6x1ukpxQkvZh457Af20zq0fK2jqHqRQtfqlFyBKqW68ujmMRo6K xCNX7navrClAUd910xWhgqoh+Jm5bHhraYrfT5iABMfMdyD3Vloz727QeAyzgnsY53 xaKkZVSG1zNJBZxVrBNctkmZnf60rRxGxWZVEh2vEoheKLT9rC4QfYpYXNqbznWumI oN7I3VmJCzyrVet6jDKAjK8PsqVcBuW+1yXwdPcQVktDh/B4cGQVFK3+kW+G524mNP jE78uFHUTn36SjltGmP5/0ncIrI38TOhs401JWIzn7t54wU07kgwcR7t0GaAKxgJS6 3v5eYtR2Cx3Sg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC756690BD; Sun, 4 Jan 2026 13:09:08 -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 G5m8TkWfrfzy; Sun, 4 Jan 2026 13:09:08 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557344; bh=Rum0nXWznXEoJ120IyP/lSOvvNqpqf31913KP2e5DLU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cjvaK8LU89nODzCkNSp+PYBq0p7Rodfb9Y/ycBJj+wxs+8lJSb7iH4qyvA1S3GAb9 wvh4W1Rm8y2MjGyqrEaG2fFex8x6CAdVih52RTnqdBHo5ABPqdyUEmz3vHr8T9yegU ZLpP9/QB0RBFYYkg/LmDe3w6riOwzUSr7KMMz9uSFH2Br3gXHZhyagMY1VieK1KSsd 4lPb76Vh8WRo+m9SoqB2xC/SuA4sHkIho6BEyR9CHeo0Vs2UN5MvwJ11TWq/jleuOb TIRhsjNnxYlpzYsFgqeKrIhuFtFtuY6Nz0JIDC9NmCqsVjfygbBH79jT6bexpY2+/U mfeBgTm7CQPgg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 7D39E69003; Sun, 4 Jan 2026 13:09:04 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:32 -0700 Message-ID: <20260104200844.481633-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: V3IZQJCWP6SFBQ4UPNHG6J4H3U4YY6V3 X-Message-ID-Hash: V3IZQJCWP6SFBQ4UPNHG6J4H3U4YY6V3 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 03/11] buildman: Fix pylint warnings in bsettings.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 - Add module docstring and define settings at module level - Fix docstrings: correct param names, add types, remove redundant returns - Add docstrings for add_file() and add_section() - Remove pointless except:raise and unused variable in get_items() - Remove unnecessary global statements in set_item() - Add encoding='utf-8' to open() calls - Rename param to avoid shadowing global config_fname - Use with statement for file handling - Convert % formatting to f-strings - Remove unnecessary semicolon - Add pylint disable comments for intentional global usage Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/bsettings.py | 60 ++++++++++++++++++++----------------- 1 file changed, 32 insertions(+), 28 deletions(-) diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py index a7358cfc08a..1af2bc66101 100644 --- a/tools/buildman/bsettings.py +++ b/tools/buildman/bsettings.py @@ -1,26 +1,30 @@ # SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2012 The Chromium OS Authors. +"""Handles settings for buildman, reading from a config file.""" + import configparser -import os import io +import os +# pylint: disable=C0103 +settings = None config_fname = None def setup(fname=''): """Set up the buildman settings module by reading config files Args: - config_fname: Config filename to read ('' for default) + fname (str): Config filename to read ('' for default) """ - global settings - global config_fname + global settings # pylint: disable=W0603 + global config_fname # pylint: disable=W0603 settings = configparser.ConfigParser() if fname is not None: config_fname = fname if config_fname == '': - config_fname = '%s/.buildman' % os.getenv('HOME') + config_fname = f"{os.getenv('HOME')}/.buildman" if not os.path.exists(config_fname): print('No config file found ~/.buildman\nCreating one...\n') create_buildman_config_file(config_fname) @@ -29,32 +33,40 @@ def setup(fname=''): settings.read(config_fname) def add_file(data): + """Add settings from a string + + Args: + data (str): Config data in INI format + """ settings.read_file(io.StringIO(data)) def add_section(name): + """Add a new section to the settings + + Args: + name (str): Name of section to add + """ settings.add_section(name) def get_items(section): """Get the items from a section of the config. Args: - section: name of section to retrieve + section (str): name of section to retrieve Returns: - List of (name, value) tuples for the section + list of tuple: List of (name, value) tuples for the section """ try: return settings.items(section) - except configparser.NoSectionError as e: + except configparser.NoSectionError: return [] - except: - raise def get_global_item_value(name): """Get an item from the 'global' section of the config. Args: - name: name of item to retrieve + name (str): name of item to retrieve Returns: str: Value of item, or None if not present @@ -63,30 +75,20 @@ def get_global_item_value(name): def set_item(section, tag, value): """Set an item and write it back to the settings file""" - global settings - global config_fname - settings.set(section, tag, value) if config_fname is not None: - with open(config_fname, 'w') as fd: + with open(config_fname, 'w', encoding='utf-8') as fd: settings.write(fd) -def create_buildman_config_file(config_fname): +def create_buildman_config_file(cfgname): """Creates a new config file with no tool chain information. Args: - config_fname: Config filename to create - - Returns: - None + cfgname (str): Config filename to create """ try: - f = open(config_fname, 'w') - except IOError: - print("Couldn't create buildman config file '%s'\n" % config_fname) - raise - - print('''[toolchain] + with open(cfgname, 'w', encoding='utf-8') as out: + print('''[toolchain] # name = path # e.g. x86 = /opt/gcc-4.6.3-nolibc/x86_64-linux other = / @@ -108,5 +110,7 @@ x86 = i386 # snapper-boards=ENABLE_AT91_TEST=1 # snapper9260=${snapper-boards} BUILD_TAG=442 # snapper9g45=${snapper-boards} BUILD_TAG=443 -''', file=f) - f.close(); +''', file=out) + except IOError: + print(f"Couldn't create buildman config file '{cfgname}'\n") + raise From patchwork Sun Jan 4 20:08:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1263 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=1767557355; bh=i5BcgVqSj799QkbLxlGBwjEQ8pXB4+VMWzPHpNzXHg4=; 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=CahAbbNE+z33fwbRYOXzvKjLd5sUdlBqFCgyI6eItPYe4h8kMxX3P5+IZZR8NEFCT b9rpfSIneqGFa8rzZQU9tjUUbQh01nMG8gz7wLME/r7Itbv/hfZxbXIBtB36Yyq3lN XUzIX76d2qVwFyUSrnTs4jTAtuaBhn0nhHH5+eylJ6ma/dWFL1hWgmrD9n/1VHk3B0 IDc8j46O5b/ERktt2yJx1ZL9lULF1fJVLFghsZNc7b6b3XXG+zTjx1mw165Q9YjrjC O+CVY43L6+xS5P/EUSeYJXIegxQEg8wyrqxnfKCPasSJLtWqbvJqoVqVVIi/PCEwQi fMTAOSS4Sun4Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 56B1D690D9 for ; Sun, 4 Jan 2026 13:09:15 -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 JwIbvl4ytK5Z for ; Sun, 4 Jan 2026 13:09:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557355; bh=i5BcgVqSj799QkbLxlGBwjEQ8pXB4+VMWzPHpNzXHg4=; 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=CahAbbNE+z33fwbRYOXzvKjLd5sUdlBqFCgyI6eItPYe4h8kMxX3P5+IZZR8NEFCT b9rpfSIneqGFa8rzZQU9tjUUbQh01nMG8gz7wLME/r7Itbv/hfZxbXIBtB36Yyq3lN XUzIX76d2qVwFyUSrnTs4jTAtuaBhn0nhHH5+eylJ6ma/dWFL1hWgmrD9n/1VHk3B0 IDc8j46O5b/ERktt2yJx1ZL9lULF1fJVLFghsZNc7b6b3XXG+zTjx1mw165Q9YjrjC O+CVY43L6+xS5P/EUSeYJXIegxQEg8wyrqxnfKCPasSJLtWqbvJqoVqVVIi/PCEwQi fMTAOSS4Sun4Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 46476690D1 for ; Sun, 4 Jan 2026 13:09:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557353; bh=cSsd5HXB9UNr1XTR650BeFB9xNF2AOJEL1wGEgiGd6E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uGS5D3ZWtApBMzLVmAQ0RLKCiZ5ZbRUZRSl1Hbg1PL5QBezx2vc4dksyBO4/Zyysu RLUBQe1Jl6xufD+uw6EgfLd9++obJRWvqHoPmFzlSb00BjYw3nVvSuzRN4h0XKXE2J DkfFYZUnxJ/xy+dCRYu6epebMqpqlylmNsDcCUkX0TwzSZNDWJiB80Ll45GopmoADX IAxuxA74LTuCPkYCJnoT5n0ShBslgxT92p/iNG0IzW0TMJ9kR5mw6b62jr48bv2jJY BAfrlC+JyCAXUo2xOSb72fXd2AWFJGdFCzGZfU0z+kDfZus3tQPO++zDk/dha8LHHI va8hWllyCHutg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 41F23690D1; Sun, 4 Jan 2026 13:09:13 -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 U5_0dgb4wv3T; Sun, 4 Jan 2026 13:09:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557349; bh=SynG139dLRrR5duEsrCXWPsn6nK6qQLEGL4XPc30wtQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WgMRZZZOIDqoG9e2af3e17LCuHz0yEENfMe8d86yK0zbvyqW+E8pJMgKmKYNhSD6T CwiqMSqCidAwwWY/43BpdIUhh/N6X2eNmU4b1k4PNTSLStWMtbTn3hrP5FGfokk1Qf tCr1M4LMAlOA05Pk4OXzPfX+un8ojhqBcalKeBWOy3KiyoprRSXlt6Mnd7JqmFG09v 72VpYjtfFUoKyTX3hbX51CF91EOaYHm3HrN60C/LIG5R5IMW5lsk8nxB+90g1mxhm7 UHWKlOQ6cSDj4tgm7Drr7DCA933989+pwh/NyXEWLoXorSFE7yYutOLMX87XsVfFKP 1VrUqvHdQmRgw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 097F469003; Sun, 4 Jan 2026 13:09:08 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:33 -0700 Message-ID: <20260104200844.481633-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QL5FARGLCNPXRFZCXDH2SGLJ2O4I6CJF X-Message-ID-Hash: QL5FARGLCNPXRFZCXDH2SGLJ2O4I6CJF 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/11] buildman: Use tools.read_file/write_file in test_bsettings.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 direct open() calls with tools.read_file() and tools.write_file() for consistency with other U-Boot Python code. Also move shutil import to top level. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/test_bsettings.py | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/tools/buildman/test_bsettings.py b/tools/buildman/test_bsettings.py index 524281f49b0..87cc3c19dd9 100644 --- a/tools/buildman/test_bsettings.py +++ b/tools/buildman/test_bsettings.py @@ -4,11 +4,13 @@ """Tests for bsettings.py""" import os +import shutil import tempfile import unittest from unittest import mock from buildman import bsettings +from u_boot_pylib import tools class TestBsettings(unittest.TestCase): @@ -18,7 +20,6 @@ class TestBsettings(unittest.TestCase): self._tmpdir = tempfile.mkdtemp() def tearDown(self): - import shutil shutil.rmtree(self._tmpdir) def test_setup_no_file(self): @@ -44,8 +45,8 @@ class TestBsettings(unittest.TestCase): def test_setup_existing_file(self): """Test setup() reads existing config file""" config_file = os.path.join(self._tmpdir, 'test.buildman') - with open(config_file, 'w') as f: - f.write('[toolchain]\narm = /opt/arm\n') + tools.write_file(config_file, '[toolchain]\narm = /opt/arm\n', + binary=False) bsettings.setup(config_file) items = bsettings.get_items('toolchain') @@ -88,8 +89,7 @@ class TestBsettings(unittest.TestCase): def test_set_item(self): """Test set_item() sets value and writes to file""" config_file = os.path.join(self._tmpdir, 'test_set.buildman') - with open(config_file, 'w') as f: - f.write('[toolchain]\n') + tools.write_file(config_file, '[toolchain]\n', binary=False) bsettings.setup(config_file) bsettings.set_item('toolchain', 'newkey', 'newvalue') @@ -99,8 +99,7 @@ class TestBsettings(unittest.TestCase): self.assertEqual('newvalue', items['newkey']) # Value should be written to file - with open(config_file) as f: - content = f.read() + content = tools.read_file(config_file, binary=False) self.assertIn('newkey', content) self.assertIn('newvalue', content) @@ -122,8 +121,7 @@ class TestBsettings(unittest.TestCase): bsettings.create_buildman_config_file(config_file) self.assertTrue(os.path.exists(config_file)) - with open(config_file) as f: - content = f.read() + content = tools.read_file(config_file, binary=False) self.assertIn('[toolchain]', content) self.assertIn('[toolchain-prefix]', content) self.assertIn('[toolchain-alias]', content) From patchwork Sun Jan 4 20:08:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1264 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=1767557359; bh=aGn7RpaEU4kv82ICnEa4SdDS7cdoavsy1I2j3cmr2mA=; 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=bjlNIEHYjhWbwu1lGBJf0+tqvm7CfFg4dw22kxOmkxlo4AaYe8WLLIkutYU/GJPaK B2qU3oYf3cTeMLHqkyc2rK8gRgJVpU5hIdgcr6xB6+aUkZRXGzu2nUfTVTR8d3hvzF gHkAUbKr4I1ad7Ivdh34/W4PVyqojfDcLtik7k2X7w6PVHj2VW6qP7DAJ0tSZmiK60 xDOm/xh2sRFhdJy+ZUhqGRi1gT/g85MeVH9e9MR570tgbdsaTcIKuH9kR4BD/icgJd BmkM0P9MRIf2Bflwejix7/SN8r1TcHzS3qQ5fb1XlwqQmNF74V1IuVAZhfirxP/Zn9 skImC+1y3lNAA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BBE27690D1 for ; Sun, 4 Jan 2026 13:09:19 -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 IUTXj_YjcYmH for ; Sun, 4 Jan 2026 13:09:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557359; bh=aGn7RpaEU4kv82ICnEa4SdDS7cdoavsy1I2j3cmr2mA=; 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=bjlNIEHYjhWbwu1lGBJf0+tqvm7CfFg4dw22kxOmkxlo4AaYe8WLLIkutYU/GJPaK B2qU3oYf3cTeMLHqkyc2rK8gRgJVpU5hIdgcr6xB6+aUkZRXGzu2nUfTVTR8d3hvzF gHkAUbKr4I1ad7Ivdh34/W4PVyqojfDcLtik7k2X7w6PVHj2VW6qP7DAJ0tSZmiK60 xDOm/xh2sRFhdJy+ZUhqGRi1gT/g85MeVH9e9MR570tgbdsaTcIKuH9kR4BD/icgJd BmkM0P9MRIf2Bflwejix7/SN8r1TcHzS3qQ5fb1XlwqQmNF74V1IuVAZhfirxP/Zn9 skImC+1y3lNAA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AAED8690D2 for ; Sun, 4 Jan 2026 13:09:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557358; bh=b7sIl1Ap8VvWfoIFXWEpx4qC90ZYgZ6Kll84IaoVnsw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c6+rGVkkqUtAmHWN/oui+lfooGnaG1BokohRir/odw61k/ThmhHB//kKSwbOLZ0UJ ShHW06Qs5/1Gg/6hCqrjXBPIuOyZpNq62zmrOkc7OYwWGTUyZxtFSwDTxK/2GNPGAW hzSDCk4OxXb/d48KiGrzMD/FUO5/drmQBOeVtHpjhHrCgVz57Qhyigwj/PeHg2N8FJ 1wNGzYcU75iSVBoVKj34b6tRYMHAWE8OGCU7XWp6s5tvDTwINE45LBiSUvX92PcSJ7 HhGNVieOO9CmkPwIq0OZmT94glF1+Nn/+tmAlgn+hsuySp0kbmXPMW6wCzSz2Cos4B Kq58x5LTfeP7A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 43CFE690BD; Sun, 4 Jan 2026 13:09:18 -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 d9bek_TAd6FT; Sun, 4 Jan 2026 13:09:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557353; bh=ObulXnmx4xRGmtrVQrW3dMkgUuxNyudBDzhxAS95QM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Dhgt10AjzthR7wMA9n423b/RkKRa1/A6MAntqUnpx55aP6/Tzk5GAw/H5CHzrD2Pr 1LOhNNPHDNqwKoi5V1dDS6YTzXJJ/ngy07cSpRI/O4UeT1tyHOiFYkuteb1XMS5Vrv 3aFZ4yfbbyRAiYi/p1YjrVwi4ZUq258o7pEiP99vnlWn6fLgbIeq8zK7k8Y/DHhqv1 8/JUvT8qTLc76bMOqRP/gL4nSvg8fWImXcrUs0IssnyrZ0wnw2oRpYVl7EBrga9lOv k9ckwbwsA/geWbMZJPVsGIoYpwNvQDkqitaEAQ7iqRo5UQY51bjLjwyyT1jaF7x1tE MWOGgRCWYeTJQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 83D2769003; Sun, 4 Jan 2026 13:09:13 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:34 -0700 Message-ID: <20260104200844.481633-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 6BX7O65NNLEEU5YW7HVLRXV7BKM52KZG X-Message-ID-Hash: 6BX7O65NNLEEU5YW7HVLRXV7BKM52KZG 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 05/11] buildman: Rename toolchain methods to snake_case 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 Rename all CamelCase methods in toolchain.py to snake_case to follow Python naming conventions and fix pylint warnings. Toolchain class: - GetPriority() -> get_priority() - GetWrapper() -> get_wrapper() - GetEnvArgs() -> get_env_args() - MakeEnvironment() -> make_environment() - MakeArgs() -> make_args() Toolchains class: - GetPathList() -> get_path_list() - GetSettings() -> get_settings() - Add() -> add() - ScanPath() -> scan_path() - ScanPathEnv() -> scan_path_env() - Scan() -> scan() - List() -> list() - Select() -> select() - ResolveReferences() -> resolve_references() - GetMakeArguments() -> get_make_arguments() - LocateArchUrl() -> locate_arch_url() - Unpack() -> unpack() - TestSettingsHasPath() -> test_settings_has_path() - ListArchs() -> list_archs() - FetchAndInstall() -> fetch_and_install() Update all callers in buildman and qconfig.py. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/builder.py | 2 +- tools/buildman/builderthread.py | 6 +-- tools/buildman/control.py | 16 +++--- tools/buildman/func_test.py | 6 +-- tools/buildman/test.py | 90 ++++++++++++++++----------------- tools/buildman/toolchain.py | 84 +++++++++++++++--------------- tools/qconfig.py | 8 +-- 7 files changed, 106 insertions(+), 106 deletions(-) diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index e218aa4184a..28943a5a9b8 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -435,7 +435,7 @@ class Builder: key (str): Variable name value (str): Variable value """ - env = toolchain.MakeEnvironment(self.full_path) + env = toolchain.make_environment(self.full_path) if self.dtc: env[b'DTC'] = tools.to_bytes(self.dtc) return env diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 3d1b656531d..0fd589934fe 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -274,8 +274,8 @@ class BuilderThread(threading.Thread): args.append('NO_LTO=1') if self.builder.reproducible_builds: args.append('SOURCE_DATE_EPOCH=0') - args.extend(self.builder.toolchains.GetMakeArguments(brd)) - args.extend(self.toolchain.MakeArgs()) + args.extend(self.builder.toolchains.get_make_arguments(brd)) + args.extend(self.toolchain.make_args()) return args, cwd, src_dir def _reconfigure(self, commit, brd, cwd, args, env, config_args, config_out, @@ -549,7 +549,7 @@ class BuilderThread(threading.Thread): # We are going to have to build it. First, get a toolchain if not self.toolchain: try: - self.toolchain = self.builder.toolchains.Select(brd.arch) + self.toolchain = self.builder.toolchains.select(brd.arch) except ValueError as err: result.return_code = 10 result.stdout = '' diff --git a/tools/buildman/control.py b/tools/buildman/control.py index f43d8fcf715..88e8338c599 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -152,11 +152,11 @@ def show_toolchain_prefix(brds, toolchains): board_selected = brds.get_selected_dict() tc_set = set() for brd in board_selected.values(): - tc_set.add(toolchains.Select(brd.arch)) + tc_set.add(toolchains.select(brd.arch)) if len(tc_set) != 1: sys.exit('Supplied boards must share one toolchain') tchain = tc_set.pop() - print(tchain.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + print(tchain.get_env_args(toolchain.VAR_CROSS_COMPILE)) def show_arch(brds): """Show information about a the architecture used by one or more boards @@ -330,19 +330,19 @@ def do_fetch_arch(toolchains, col, fetch_arch): int: Return code for buildman """ if fetch_arch == 'list': - sorted_list = toolchains.ListArchs() + sorted_list = toolchains.list_archs() print(col.build( col.BLUE, f"Available architectures: {' '.join(sorted_list)}\n")) return 0 if fetch_arch == 'all': - fetch_arch = ','.join(toolchains.ListArchs()) + fetch_arch = ','.join(toolchains.list_archs()) print(col.build(col.CYAN, f'\nDownloading toolchains: {fetch_arch}')) for arch in fetch_arch.split(','): print() - ret = toolchains.FetchAndInstall(arch) + ret = toolchains.fetch_and_install(arch) if ret: return ret return 0 @@ -374,10 +374,10 @@ def get_toolchains(toolchains, col, override_toolchain, fetch_arch, return do_fetch_arch(toolchains, col, fetch_arch) if no_toolchains: - toolchains.GetSettings() - toolchains.Scan(list_tool_chains and verbose) + toolchains.get_settings() + toolchains.scan(list_tool_chains and verbose) if list_tool_chains: - toolchains.List() + toolchains.list() print() return 0 return toolchains diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 6167ea525e7..3ecbd22613f 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -194,8 +194,8 @@ class TestFunctional(unittest.TestCase): bsettings.setup(None) bsettings.add_file(settings_data) self.setupToolchains() - self._toolchains.Add('arm-gcc', test=False) - self._toolchains.Add('powerpc-gcc', test=False) + self._toolchains.add('arm-gcc', test=False) + self._toolchains.add('powerpc-gcc', test=False) self._boards = boards.Boards() for brd in BOARDS: self._boards.add_board(board.Board(*brd)) @@ -232,7 +232,7 @@ class TestFunctional(unittest.TestCase): def setupToolchains(self): self._toolchains = toolchain.Toolchains() - self._toolchains.Add('gcc', test=False) + self._toolchains.add('gcc', test=False) def _RunBuildman(self, *args): all_args = [self._buildman_pathname] + list(args) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 8269dfec2ba..3d153619d5d 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -166,11 +166,11 @@ class TestBuild(unittest.TestCase): # Set up the toolchains self.toolchains = toolchain.Toolchains() - self.toolchains.Add('arm-linux-gcc', test=False) - self.toolchains.Add('sparc-linux-gcc', test=False) - self.toolchains.Add('powerpc-linux-gcc', test=False) - self.toolchains.Add('/path/to/aarch64-linux-gcc', test=False) - self.toolchains.Add('gcc', test=False) + self.toolchains.add('arm-linux-gcc', test=False) + self.toolchains.add('sparc-linux-gcc', test=False) + self.toolchains.add('powerpc-linux-gcc', test=False) + self.toolchains.add('/path/to/aarch64-linux-gcc', test=False) + self.toolchains.add('gcc', test=False) # Avoid sending any output terminal.set_print_test_mode() @@ -594,82 +594,82 @@ class TestBuild(unittest.TestCase): self.CheckDirs(build, '') def testToolchainAliases(self): - self.assertTrue(self.toolchains.Select('arm') != None) + self.assertTrue(self.toolchains.select('arm') != None) with self.assertRaises(ValueError): - self.toolchains.Select('no-arch') + self.toolchains.select('no-arch') with self.assertRaises(ValueError): - self.toolchains.Select('x86') + self.toolchains.select('x86') self.toolchains = toolchain.Toolchains() - self.toolchains.Add('x86_64-linux-gcc', test=False) - self.assertTrue(self.toolchains.Select('x86') != None) + self.toolchains.add('x86_64-linux-gcc', test=False) + self.assertTrue(self.toolchains.select('x86') != None) self.toolchains = toolchain.Toolchains() - self.toolchains.Add('i386-linux-gcc', test=False) - self.assertTrue(self.toolchains.Select('x86') != None) + self.toolchains.add('i386-linux-gcc', test=False) + self.assertTrue(self.toolchains.select('x86') != None) def testToolchainDownload(self): """Test that we can download toolchains""" if use_network: with terminal.capture() as (stdout, stderr): - url = self.toolchains.LocateArchUrl('arm') + url = self.toolchains.locate_arch_url('arm') self.assertRegex(url, 'https://www.kernel.org/pub/tools/' 'crosstool/files/bin/x86_64/.*/' 'x86_64-gcc-.*-nolibc[-_]arm-.*linux-gnueabi.tar.xz') def testGetEnvArgs(self): """Test the GetEnvArgs() function""" - tc = self.toolchains.Select('arm') + tc = self.toolchains.select('arm') self.assertEqual('arm-linux-', - tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) - self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_PATH)) + tc.get_env_args(toolchain.VAR_CROSS_COMPILE)) + self.assertEqual('', tc.get_env_args(toolchain.VAR_PATH)) self.assertEqual('arm', - tc.GetEnvArgs(toolchain.VAR_ARCH)) - self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS)) + tc.get_env_args(toolchain.VAR_ARCH)) + self.assertEqual('', tc.get_env_args(toolchain.VAR_MAKE_ARGS)) - tc = self.toolchains.Select('sandbox') - self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + tc = self.toolchains.select('sandbox') + self.assertEqual('', tc.get_env_args(toolchain.VAR_CROSS_COMPILE)) - self.toolchains.Add('/path/to/x86_64-linux-gcc', test=False) - tc = self.toolchains.Select('x86') + self.toolchains.add('/path/to/x86_64-linux-gcc', test=False) + tc = self.toolchains.select('x86') self.assertEqual('/path/to', - tc.GetEnvArgs(toolchain.VAR_PATH)) + tc.get_env_args(toolchain.VAR_PATH)) tc.override_toolchain = 'clang' self.assertEqual('HOSTCC=clang CC=clang', - tc.GetEnvArgs(toolchain.VAR_MAKE_ARGS)) + tc.get_env_args(toolchain.VAR_MAKE_ARGS)) # Test config with ccache wrapper bsettings.setup(None) bsettings.add_file(settings_data_wrapper) - tc = self.toolchains.Select('arm') + tc = self.toolchains.select('arm') self.assertEqual('ccache arm-linux-', - tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + tc.get_env_args(toolchain.VAR_CROSS_COMPILE)) - tc = self.toolchains.Select('sandbox') - self.assertEqual('', tc.GetEnvArgs(toolchain.VAR_CROSS_COMPILE)) + tc = self.toolchains.select('sandbox') + self.assertEqual('', tc.get_env_args(toolchain.VAR_CROSS_COMPILE)) def testMakeEnvironment(self): - """Test the MakeEnvironment function""" + """Test the make_environment function""" os.environ.pop('CROSS_COMPILE', None) - tc = self.toolchains.Select('arm') - env = tc.MakeEnvironment(False) + tc = self.toolchains.select('arm') + env = tc.make_environment(False) self.assertEqual(env[b'CROSS_COMPILE'], b'arm-linux-') - tc = self.toolchains.Select('sandbox') - env = tc.MakeEnvironment(False) + tc = self.toolchains.select('sandbox') + env = tc.make_environment(False) self.assertTrue(b'CROSS_COMPILE' not in env) # Test config with ccache wrapper bsettings.setup(None) bsettings.add_file(settings_data_wrapper) - tc = self.toolchains.Select('arm') - env = tc.MakeEnvironment(False) + tc = self.toolchains.select('arm') + env = tc.make_environment(False) self.assertEqual(env[b'CROSS_COMPILE'], b'ccache arm-linux-') - tc = self.toolchains.Select('sandbox') - env = tc.MakeEnvironment(False) + tc = self.toolchains.select('sandbox') + env = tc.make_environment(False) self.assertTrue(b'CROSS_COMPILE' not in env) def testPrepareOutputSpace(self): @@ -942,7 +942,7 @@ class TestBuild(unittest.TestCase): self.assertEqual(self.finish_time, self.cur_time) def call_make_environment(self, tchn, full_path, in_env=None): - """Call Toolchain.MakeEnvironment() and process the result + """Call Toolchain.make_environment() and process the result Args: tchn (Toolchain): Toolchain to use @@ -958,7 +958,7 @@ class TestBuild(unittest.TestCase): which were added) str: Full value of the new PATH variable """ - env = tchn.MakeEnvironment(full_path, env=in_env) + env = tchn.make_environment(full_path, env=in_env) # Get the original environment orig_env = dict(os.environb if in_env is None else in_env) @@ -983,7 +983,7 @@ class TestBuild(unittest.TestCase): def test_toolchain_env(self): """Test PATH and other environment settings for toolchains""" # Use a toolchain which has a path, so that full_path makes a difference - tchn = self.toolchains.Select('aarch64') + tchn = self.toolchains.select('aarch64') # Normal cases diff = self.call_make_environment(tchn, full_path=False)[0] @@ -1044,13 +1044,13 @@ class TestBuild(unittest.TestCase): build = builder.Builder(self.toolchains, self.base_dir, None, 0, 2, dtc_skip=True) - tch = self.toolchains.Select('arm') + tch = self.toolchains.select('arm') env = build.make_environment(tch) self.assertIn(b'DTC', env) # Try the normal case, i.e. not skipping the dtc build build = builder.Builder(self.toolchains, self.base_dir, None, 0, 2) - tch = self.toolchains.Select('arm') + tch = self.toolchains.select('arm') env = build.make_environment(tch) self.assertNotIn(b'DTC', env) finally: @@ -1065,12 +1065,12 @@ class TestBuild(unittest.TestCase): # Set up the toolchains home = os.path.expanduser('~') toolchains = toolchain.Toolchains() - toolchains.GetSettings() + toolchains.get_settings() self.assertEqual([f'{home}/mypath'], toolchains.paths) # Check scanning with terminal.capture() as (stdout, _): - toolchains.Scan(verbose=True, raise_on_error=False) + toolchains.scan(verbose=True, raise_on_error=False) lines = iter(stdout.getvalue().splitlines() + ['##done']) self.assertEqual('Scanning for tool chains', next(lines)) self.assertEqual(f" - scanning prefix '{home}/mypath-x86-'", @@ -1087,7 +1087,7 @@ class TestBuild(unittest.TestCase): # Check adding a toolchain with terminal.capture() as (stdout, _): - toolchains.Add('~/aarch64-linux-gcc', test=True, verbose=True) + toolchains.add('~/aarch64-linux-gcc', test=True, verbose=True) lines = iter(stdout.getvalue().splitlines() + ['##done']) self.assertEqual('Tool chain test: BAD', next(lines)) self.assertEqual(f'Command: {home}/aarch64-linux-gcc --version', diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 5e5bb4b0aed..346bb349dfe 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -91,12 +91,12 @@ class Toolchain: if self.arch == 'sandbox' and override_toolchain: self.gcc = override_toolchain - env = self.MakeEnvironment(False) + env = self.make_environment(False) # As a basic sanity check, run the C compiler with --version cmd = [fname, '--version'] if priority == PRIORITY_CALC: - self.priority = self.GetPriority(fname) + self.priority = self.get_priority(fname) else: self.priority = priority if test: @@ -116,7 +116,7 @@ class Toolchain: else: self.ok = True - def GetPriority(self, fname): + def get_priority(self, fname): """Return the priority of the toolchain. Toolchains are ranked according to their suitability by their @@ -136,7 +136,7 @@ class Toolchain: return PRIORITY_CALC + prio return PRIORITY_CALC + prio - def GetWrapper(self, show_warning=True): + def get_wrapper(self, show_warning=True): """Get toolchain wrapper from the setting file. """ value = '' @@ -148,7 +148,7 @@ class Toolchain: return value - def GetEnvArgs(self, which): + def get_env_args(self, which): """Get an environment variable/args value based on the the toolchain Args: @@ -158,7 +158,7 @@ class Toolchain: Value of that environment variable or arguments """ if which == VAR_CROSS_COMPILE: - wrapper = self.GetWrapper() + wrapper = self.get_wrapper() base = '' if self.arch == 'sandbox' else self.path if (base == '' and self.cross == ''): return '' @@ -168,14 +168,14 @@ class Toolchain: elif which == VAR_ARCH: return self.arch elif which == VAR_MAKE_ARGS: - args = self.MakeArgs() + args = self.make_args() if args: return ' '.join(args) return '' else: raise ValueError('Unknown arg to GetEnvArgs (%d)' % which) - def MakeEnvironment(self, full_path, env=None): + def make_environment(self, full_path, env=None): """Returns an environment for using the toolchain. This takes the current environment and adds CROSS_COMPILE so that @@ -206,7 +206,7 @@ class Toolchain: """ env = dict(env or os.environb) - wrapper = self.GetWrapper() + wrapper = self.get_wrapper() if self.override_toolchain: # We'll use MakeArgs() to provide this @@ -238,7 +238,7 @@ class Toolchain: return env - def MakeArgs(self): + def make_args(self): """Create the 'make' arguments for a toolchain This is only used when the toolchain is being overridden. Since the @@ -277,7 +277,7 @@ class Toolchains: self.override_toolchain = override_toolchain self._make_flags = dict(bsettings.get_items('make-flags')) - def GetPathList(self, show_warning=True): + def get_path_list(self, show_warning=True): """Get a list of available toolchain paths Args: @@ -304,16 +304,16 @@ class Toolchains: paths.append(fname) return paths - def GetSettings(self, show_warning=True): + def get_settings(self, show_warning=True): """Get toolchain settings from the settings file. Args: show_warning: True to show a warning if there are no tool chains. """ self.prefixes = bsettings.get_items('toolchain-prefix') - self.paths += self.GetPathList(show_warning) + self.paths += self.get_path_list(show_warning) - def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, + def add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, arch=None): """Add a toolchain to our list @@ -341,7 +341,7 @@ class Toolchains: (toolchain.gcc, toolchain.priority, toolchain.arch, self.toolchains[toolchain.arch].priority))) - def ScanPath(self, path, verbose): + def scan_path(self, path, verbose): """Scan a path for a valid toolchain Args: @@ -359,7 +359,7 @@ class Toolchains: fnames.append(fname) return fnames - def ScanPathEnv(self, fname): + def scan_path_env(self, fname): """Scan the PATH environment variable for a given filename. Args: @@ -375,7 +375,7 @@ class Toolchains: pathname_list.append(pathname) return pathname_list - def Scan(self, verbose, raise_on_error=True): + def scan(self, verbose, raise_on_error=True): """Scan for available toolchains and select the best for each arch. We look for all the toolchains we can file, figure out the @@ -390,15 +390,15 @@ class Toolchains: fname = os.path.expanduser(value) if verbose: print(" - scanning prefix '%s'" % fname) if os.path.exists(fname): - self.Add(fname, True, verbose, PRIORITY_FULL_PREFIX, name) + self.add(fname, True, verbose, PRIORITY_FULL_PREFIX, name) continue fname += 'gcc' if os.path.exists(fname): - self.Add(fname, True, verbose, PRIORITY_PREFIX_GCC, name) + self.add(fname, True, verbose, PRIORITY_PREFIX_GCC, name) continue - fname_list = self.ScanPathEnv(fname) + fname_list = self.scan_path_env(fname) for f in fname_list: - self.Add(f, True, verbose, PRIORITY_PREFIX_GCC_PATH, name) + self.add(f, True, verbose, PRIORITY_PREFIX_GCC_PATH, name) if not fname_list: msg = f"No tool chain found for prefix '{fname}'" if raise_on_error: @@ -407,11 +407,11 @@ class Toolchains: print(f'Error: {msg}') for path in self.paths: if verbose: print(" - scanning path '%s'" % path) - fnames = self.ScanPath(path, verbose) + fnames = self.scan_path(path, verbose) for fname in fnames: - self.Add(fname, True, verbose) + self.add(fname, True, verbose) - def List(self): + def list(self): """List out the selected toolchains for each architecture""" col = terminal.Color() print(col.build(col.BLUE, 'List of available toolchains (%d):' % @@ -422,7 +422,7 @@ class Toolchains: else: print('None') - def Select(self, arch): + def select(self, arch): """Returns the toolchain for a given architecture Args: @@ -441,7 +441,7 @@ class Toolchains: raise ValueError("No tool chain found for arch '%s'" % arch) return self.toolchains[arch] - def ResolveReferences(self, var_dict, args): + def resolve_references(self, var_dict, args): """Resolve variable references in a string This converts ${blah} within the string to the value of blah. @@ -455,12 +455,12 @@ class Toolchains: Returns: >>> bsettings.setup(None) >>> tcs = Toolchains() - >>> tcs.Add('fred', False) + >>> tcs.add('fred', False) >>> var_dict = {'oblique' : 'OBLIQUE', 'first' : 'fi${second}rst', \ 'second' : '2nd'} - >>> tcs.ResolveReferences(var_dict, 'this=${oblique}_set') + >>> tcs.resolve_references(var_dict, 'this=${oblique}_set') 'this=OBLIQUE_set' - >>> tcs.ResolveReferences(var_dict, 'this=${oblique}_set${first}nd') + >>> tcs.resolve_references(var_dict, 'this=${oblique}_set${first}nd') 'this=OBLIQUE_setfi2ndrstnd' """ re_var = re.compile(r'(\$\{[-_a-z0-9A-Z]{1,}\})') @@ -474,7 +474,7 @@ class Toolchains: args = args[:m.start(0)] + value + args[m.end(0):] return args - def GetMakeArguments(self, brd): + def get_make_arguments(self, brd): """Returns 'make' arguments for a given board The flags are in a section called 'make-flags'. Flags are named @@ -500,7 +500,7 @@ class Toolchains: 'make' flags for that board, or '' if none """ self._make_flags['target'] = brd.target - arg_str = self.ResolveReferences(self._make_flags, + arg_str = self.resolve_references(self._make_flags, self._make_flags.get(brd.target, '')) args = re.findall(r"(?:\".*?\"|\S)+", arg_str) i = 0 @@ -512,7 +512,7 @@ class Toolchains: i += 1 return args - def LocateArchUrl(self, fetch_arch): + def locate_arch_url(self, fetch_arch): """Find a toolchain available online Look in standard places for available toolchains. At present the @@ -548,7 +548,7 @@ class Toolchains: return arch, links return None - def Unpack(self, fname, dest): + def unpack(self, fname, dest): """Unpack a tar file Args: @@ -562,18 +562,18 @@ class Toolchains: dirs = stdout.splitlines()[1].split('/')[:2] return '/'.join(dirs) - def TestSettingsHasPath(self, path): + def test_settings_has_path(self, path): """Check if buildman will find this toolchain Returns: True if the path is in settings, False if not """ - paths = self.GetPathList(False) + paths = self.get_path_list(False) return path in paths - def ListArchs(self): + def list_archs(self): """List architectures with available toolchains to download""" - host_arch, archives = self.LocateArchUrl('list') + host_arch, archives = self.locate_arch_url('list') re_arch = re.compile('[-a-z0-9.]*[-_]([^-]*)-.*') arch_set = set() for archive in archives: @@ -584,7 +584,7 @@ class Toolchains: arch_set.add(arch.group(1)) return sorted(arch_set) - def FetchAndInstall(self, arch): + def fetch_and_install(self, arch): """Fetch and install a new toolchain arch: @@ -593,7 +593,7 @@ class Toolchains: # Fist get the URL for this architecture col = terminal.Color() print(col.build(col.BLUE, "Downloading toolchain for arch '%s'" % arch)) - url = self.LocateArchUrl(arch) + url = self.locate_arch_url(arch) if not url: print(("Cannot find toolchain for arch '%s' - use 'list' to list" % arch)) @@ -609,7 +609,7 @@ class Toolchains: return 1 print(col.build(col.GREEN, 'Unpacking to: %s' % dest), end=' ') sys.stdout.flush() - path = self.Unpack(tarfile, dest) + path = self.unpack(tarfile, dest) os.remove(tarfile) os.rmdir(tmpdir) print() @@ -617,7 +617,7 @@ class Toolchains: # Check that the toolchain works print(col.build(col.GREEN, 'Testing')) dirpath = os.path.join(dest, path) - compiler_fname_list = self.ScanPath(dirpath, True) + compiler_fname_list = self.scan_path(dirpath, True) if not compiler_fname_list: print('Could not locate C compiler - fetch failed.') return 1 @@ -627,7 +627,7 @@ class Toolchains: toolchain = Toolchain(compiler_fname_list[0], True, True) # Make sure that it will be found by buildman - if not self.TestSettingsHasPath(dirpath): + if not self.test_settings_has_path(dirpath): print(("Adding 'download' to config file '%s'" % bsettings.config_fname)) bsettings.set_item('toolchain', 'download', '%s/*/*' % dest) diff --git a/tools/qconfig.py b/tools/qconfig.py index eca6f5b1e1c..70d53b5f8d9 100755 --- a/tools/qconfig.py +++ b/tools/qconfig.py @@ -506,14 +506,14 @@ class Slot: arch = self.parser.get_arch() try: - tchain = self.toolchains.Select(arch) + tchain = self.toolchains.select(arch) except ValueError: self.log.append(self.col.build( self.col.YELLOW, f"Tool chain for '{arch}' is missing: do nothing")) self.finish(False) return - env = tchain.MakeEnvironment(False) + env = tchain.make_environment(False) cmd = list(self.make_cmd) cmd.append('KCONFIG_IGNORE_DUPLICATES=1') @@ -745,8 +745,8 @@ def move_config(args): # Get toolchains to use toolchains = toolchain.Toolchains() - toolchains.GetSettings() - toolchains.Scan(verbose=False) + toolchains.get_settings() + toolchains.scan(verbose=False) if args.git_ref: reference_src = ReferenceSource(args.git_ref) From patchwork Sun Jan 4 20:08:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1265 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=1767557365; bh=bzbpBl5LXWwLaQSoTzV4yDnCmWUOt+AiYqytUSoCz3Q=; 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=nlwch77Lvb3M+XOcFjsK8oSY87FjfTLTZOiDT4kSFMd7Qx1K5xEJ72uBTUhe2fuGM lXP5g6J5HSg4n5zfoOvjN1s5oAufqkhWQQ6uDXphKrXFB7yZTRTNReMH1uFwryDGAU Q1p3wxphJhtQSFB4gPNdUUVhCrn5/8lHuQo8AaNXGiIov3JC3zrq38SU1sko52cyIj 9g8elZ/PVDogDIDbkKCVv3Cw4tgBmFZNtEMCXVyZM0hm/dcbLsFfu2+GhphY7++mN4 HOqwCmsuH64fLzydcLtk7mtWgeYYUJRb70IJSi5kc4Ac2gpqELug6w+z0eKI6TlLNc TuaLRSZDkfKrQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7DBFF690DE for ; Sun, 4 Jan 2026 13:09:25 -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 3_m-ZARv56ac for ; Sun, 4 Jan 2026 13:09:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557365; bh=bzbpBl5LXWwLaQSoTzV4yDnCmWUOt+AiYqytUSoCz3Q=; 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=nlwch77Lvb3M+XOcFjsK8oSY87FjfTLTZOiDT4kSFMd7Qx1K5xEJ72uBTUhe2fuGM lXP5g6J5HSg4n5zfoOvjN1s5oAufqkhWQQ6uDXphKrXFB7yZTRTNReMH1uFwryDGAU Q1p3wxphJhtQSFB4gPNdUUVhCrn5/8lHuQo8AaNXGiIov3JC3zrq38SU1sko52cyIj 9g8elZ/PVDogDIDbkKCVv3Cw4tgBmFZNtEMCXVyZM0hm/dcbLsFfu2+GhphY7++mN4 HOqwCmsuH64fLzydcLtk7mtWgeYYUJRb70IJSi5kc4Ac2gpqELug6w+z0eKI6TlLNc TuaLRSZDkfKrQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6B4D0690D1 for ; Sun, 4 Jan 2026 13:09:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557362; bh=8ghuEs+nds+Q7mj7640cK1nvjOC8WsZC82hbTujxdLg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ptnabh5QKsZ694mq7UgBYztZeQLtwNWhnpW8Z+djl5s2OVwopctUKrdt5kPt1rUk0 rE+WqF497BqsTyHDcCwPJOulg7OCl07neR74wNII8dUFZfb1qpUvObxmmTuxOeWQdP Oi3lDiqtnM5sXtl169y192+M5mqNzMgipVtWpkRyCgibHmlgldGNYQxcJUn5r4OD2S SxV5wpQNvZ7pD5O6n+7sMbtRmmtCeMl3uVQlb/v1CHaqY6b/lrFdPXJgZlkZRau7CT au7KoovjJj85DRSXigmkWSRF7HQsquNBYOq2N/+EQTkwhB197sXNYLEEWwPPsGcvh9 Qfc7avKIXpaNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AEC5F690BD; Sun, 4 Jan 2026 13:09: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 10026) with ESMTP id DYRhwV21ByTJ; Sun, 4 Jan 2026 13:09:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557358; bh=709ChhrHv3ZoxTH58lg4GcJmMbXKqkfYMHA5gwlaMDE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A0ZSjCtSpUv16sehaPoeE72usoQPfu+2lTQ0Obt8HKCFhqt9a46lw0NVn3WK2m/Xn 4lU6pEwglqASMuSGHTrhq9iUJKrnKTEjALPAB6Zt4XW3aq05wjFGdzKrhaPf0hOTx2 5uPmrBKJgSNPFdeXYDzV+gNSmGdohfOITw7uxw/Jif1pvTZkX6NtWbiI7aO3F/9nH4 RIt+tsBQhr20DExmVfaEX5gLvCRDhNDNw+rqFTp6qPdVyBKyf8uJdorHYGN3kopltP 0YFU4BE2PTD+5jCXwDE/WbsXvXtn0SB2mNpTFoKFUBnMeRNwXgyeQ//9ke+YM+/n+9 6OQGalgT1TViQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 84E3669003; Sun, 4 Jan 2026 13:09:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:35 -0700 Message-ID: <20260104200844.481633-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DD4XRL4PRZJE43YVCEMM4SQYDFBC6ANU X-Message-ID-Hash: DD4XRL4PRZJE43YVCEMM4SQYDFBC6ANU 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 06/11] buildman: Fix docstrings in toolchain.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 Add module docstring and class docstring for MyHTMLParser. Add type documentation to all function parameters and return values. Fix incorrect parameter names in docstrings (arch -> fetch_arch, args -> arch). Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/toolchain.py | 104 ++++++++++++++++++++---------------- 1 file changed, 59 insertions(+), 45 deletions(-) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 346bb349dfe..07adadffaaa 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ # Copyright (c) 2012 The Chromium OS Authors. -# + +"""Handles finding and using toolchains for building U-Boot.""" import re import glob @@ -20,8 +21,9 @@ from u_boot_pylib import tools (VAR_CROSS_COMPILE, VAR_PATH, VAR_ARCH, VAR_MAKE_ARGS) = range(4) -# Simple class to collect links from a page class MyHTMLParser(HTMLParser): + """Simple class to collect links from a page""" + def __init__(self, arch): """Create a new parser @@ -30,7 +32,7 @@ class MyHTMLParser(HTMLParser): the one for the given architecture (or None if not found). Args: - arch: Architecture to search for + arch (str): Architecture to search for """ HTMLParser.__init__(self) self.arch_link = None @@ -38,6 +40,7 @@ class MyHTMLParser(HTMLParser): self.re_arch = re.compile('[-_]%s-' % arch) def handle_starttag(self, tag, attrs): + """Handle a start tag in the HTML being parsed""" if tag == 'a': for tag, value in attrs: if tag == 'href': @@ -123,9 +126,10 @@ class Toolchain: filename prefix. Args: - fname: Filename of toolchain + fname (str): Filename of toolchain + Returns: - Priority of toolchain, PRIORITY_CALC=highest, 20=lowest. + int: Priority of toolchain, PRIORITY_CALC=highest, 20=lowest. """ priority_list = ['-elf', '-unknown-linux-gnu', '-linux', '-none-linux-gnueabi', '-none-linux-gnueabihf', '-uclinux', @@ -152,10 +156,10 @@ class Toolchain: """Get an environment variable/args value based on the the toolchain Args: - which: VAR_... value to get + which (int): VAR_... value to get Returns: - Value of that environment variable or arguments + str: Value of that environment variable or arguments """ if which == VAR_CROSS_COMPILE: wrapper = self.get_wrapper() @@ -196,13 +200,14 @@ class Toolchain: buildman will still respect the venv. Args: - full_path: Return the full path in CROSS_COMPILE and don't set - PATH + full_path (bool): Return the full path in CROSS_COMPILE and don't + set PATH env (dict of bytes): Original environment, used for testing + Returns: - Dict containing the (bytes) environment to use. This is based on the - current environment, with changes as needed to CROSS_COMPILE, PATH - and LC_ALL. + dict of bytes: Environment to use. This is based on the current + environment, with changes as needed to CROSS_COMPILE, PATH + and LC_ALL. """ env = dict(env or os.environb) @@ -281,11 +286,12 @@ class Toolchains: """Get a list of available toolchain paths Args: - show_warning: True to show a warning if there are no tool chains. + show_warning (bool): True to show a warning if there are no tool + chains. Returns: - List of strings, each a path to a toolchain mentioned in the - [toolchain] section of the settings file. + list of str: List of paths to toolchains mentioned in the + [toolchain] section of the settings file. """ toolchains = bsettings.get_items('toolchain') if show_warning and not toolchains: @@ -308,7 +314,8 @@ class Toolchains: """Get toolchain settings from the settings file. Args: - show_warning: True to show a warning if there are no tool chains. + show_warning (bool): True to show a warning if there are no tool + chains. """ self.prefixes = bsettings.get_items('toolchain-prefix') self.paths += self.get_path_list(show_warning) @@ -321,10 +328,11 @@ class Toolchains: architecture if it is a higher priority than the others. Args: - fname: Filename of toolchain's gcc driver - test: True to run the toolchain to test it - priority: Priority to use for this toolchain - arch: Toolchain architecture, or None if not known + fname (str): Filename of toolchain's gcc driver + test (bool): True to run the toolchain to test it + verbose (bool): True to print out progress information + priority (int): Priority to use for this toolchain + arch (str): Toolchain architecture, or None if not known """ toolchain = Toolchain(fname, test, verbose, priority, arch, self.override_toolchain) @@ -345,10 +353,11 @@ class Toolchains: """Scan a path for a valid toolchain Args: - path: Path to scan - verbose: True to print out progress information + path (str): Path to scan + verbose (bool): True to print out progress information + Returns: - Filename of C compiler if found, else None + list of str: Filenames of C compilers found """ fnames = [] for subdir in ['.', 'bin', 'usr/bin']: @@ -363,9 +372,10 @@ class Toolchains: """Scan the PATH environment variable for a given filename. Args: - fname: Filename to scan for + fname (str): Filename to scan for + Returns: - List of matching pathanames, or [] if none + list of str: List of matching pathnames, or [] if none """ pathname_list = [] for path in os.environ["PATH"].split(os.pathsep): @@ -383,7 +393,9 @@ class Toolchains: highest priority toolchain for each arch. Args: - verbose: True to print out progress information + verbose (bool): True to print out progress information + raise_on_error (bool): True to raise an error if a toolchain is + not found """ if verbose: print('Scanning for tool chains') for name, value in self.prefixes: @@ -426,10 +438,10 @@ class Toolchains: """Returns the toolchain for a given architecture Args: - args: Name of architecture (e.g. 'arm', 'ppc_8xx') + arch (str): Name of architecture (e.g. 'arm', 'ppc_8xx') - returns: - toolchain object, or None if none found + Returns: + Toolchain: toolchain object, or None if none found """ for tag, value in bsettings.get_items('toolchain-alias'): if arch == tag: @@ -447,12 +459,13 @@ class Toolchains: This converts ${blah} within the string to the value of blah. This function works recursively. - Resolved string - Args: - var_dict: Dictionary containing variables and their values - args: String containing make arguments + var_dict (dict): Dictionary containing variables and their values + args (str): String containing make arguments + Returns: + str: Resolved string + >>> bsettings.setup(None) >>> tcs = Toolchains() >>> tcs.add('fred', False) @@ -495,9 +508,10 @@ class Toolchains: A special 'target' variable is set to the board target. Args: - brd: Board object for the board to check. + brd (Board): Board object for the board to check. + Returns: - 'make' flags for that board, or '' if none + list of str: 'make' flags for that board, or [] if none """ self._make_flags['target'] = brd.target arg_str = self.resolve_references(self._make_flags, @@ -519,13 +533,12 @@ class Toolchains: only standard place is at kernel.org. Args: - arch: Architecture to look for, or 'list' for all + fetch_arch (str): Architecture to look for, or 'list' for all + Returns: - If fetch_arch is 'list', a tuple: - Machine architecture (e.g. x86_64) - List of toolchains - else - URL containing this toolchain, if avaialble, else None + tuple or str or None: If fetch_arch is 'list', a tuple of + (machine architecture, list of toolchains). Otherwise the + URL containing this toolchain, if available, else None. """ arch = command.output_one_line('uname', '-m') if arch == 'aarch64': @@ -552,11 +565,12 @@ class Toolchains: """Unpack a tar file Args: - fname: Filename to unpack - dest: Destination directory + fname (str): Filename to unpack + dest (str): Destination directory + Returns: - Directory name of the first entry in the archive, without the - trailing / + str: Directory name of the first entry in the archive, without + the trailing / """ stdout = command.output('tar', 'xvfJ', fname, '-C', dest) dirs = stdout.splitlines()[1].split('/')[:2] From patchwork Sun Jan 4 20:08:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1266 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=1767557369; bh=fqtPAclD8yfGnzp09zq73l7vfXHdOyQrRtBvJPkreUQ=; 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=EU0ZAUDoi0nKi2DrnijkGXFEMFwovSfx6pljY13r7MmeDsipEQIIH0eFuPVr+fAhF EzlJ6KDatE5q2BjLwNlTPnIFM/7Iynwoqj+3VfGF5OkF4y5D7w4QJNRfNzwiyVXWIc Tc9WJY/YOZb3juQck18QyIb1a4ogtx54DTKks9GW0IIZ9taWCsEnfHH95fCZOje8ZH uBp9z3m644QldvvX8DovzfIRHBNds+NfI/HwyKRT0N2xUGWYkND/89wmUWCnlJtjSp ADrvMkziXSfl9rwlzaTFC00hgJr0TB6m5TrgTG/dgiMyJ/+QeSx2IEztGhlFKV6CSo 16gNkb6nqapHA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 40E68690DE for ; Sun, 4 Jan 2026 13:09:29 -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 kPgO7Z8qNQVI for ; Sun, 4 Jan 2026 13:09:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557369; bh=fqtPAclD8yfGnzp09zq73l7vfXHdOyQrRtBvJPkreUQ=; 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=EU0ZAUDoi0nKi2DrnijkGXFEMFwovSfx6pljY13r7MmeDsipEQIIH0eFuPVr+fAhF EzlJ6KDatE5q2BjLwNlTPnIFM/7Iynwoqj+3VfGF5OkF4y5D7w4QJNRfNzwiyVXWIc Tc9WJY/YOZb3juQck18QyIb1a4ogtx54DTKks9GW0IIZ9taWCsEnfHH95fCZOje8ZH uBp9z3m644QldvvX8DovzfIRHBNds+NfI/HwyKRT0N2xUGWYkND/89wmUWCnlJtjSp ADrvMkziXSfl9rwlzaTFC00hgJr0TB6m5TrgTG/dgiMyJ/+QeSx2IEztGhlFKV6CSo 16gNkb6nqapHA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 31457690BD for ; Sun, 4 Jan 2026 13:09:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557367; bh=1u0utH2aLwGsQv5ytVnr29n6Q4BFlrxmPW92Y3qHp+M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=phKD9xaJyfLuge2Z4xav5KwN0cQzpKXJ4DeuvnjyLpoQlqPzPFfYmhUgMBRdcT8i6 cBnT1YPcTjVdwexs8LeVUC1VL5GJontayg2Z5LGoZpdvP1XZ9yb3qI5wHJRMavqlPP rP1vAj+I/AFHSKLQHBo+NUMzaVwtsQfLS5SBu0I7XCHF/d3tKfLP+E3sbu8Bd/hq8G 8kPqzSO2gos6MkJoL6ge2qUJl6lucggNRQkup1v2oLunTySEStGs4JbtB9tHDqCoyS 44lH2W/DATe3FnC2ENSQXdGJKTS6357H5hwovCTHohdhiY5+vlVHhTuH+MNPQuhpMJ qR/MIBbGayMAw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2FDC4690D9; Sun, 4 Jan 2026 13:09:27 -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 huSdBF4pYv5C; Sun, 4 Jan 2026 13:09:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557363; bh=/B6Hm+5sk54sRzwE/IyQVMf+CVtl+qMM7+hD9CxCz40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WKottM44WiBX6WM22WkTHxYisxieXk9LCrbOdXfDQHkTO8DdO/4/QRxCozdd691sF 3al62I7/NlQzWKy3Lud/wnaNjqOg0V0a18okDLM5R7/ZDzQhyIqdJ758SQdLhXmNCV bGZn5x/0dt+Msvm+YvhRGBj4run4hypgfsF9JFlPIvz/W2P7i+QDK4U/80pE2s1SON i/BP60ibrMhcY8I4b/qqzNYss+0ij3ikee1HJ2hZDH70Zn6HNUj2AzPuyBezmleEnJ cYdM/gQzMD6l5D0GdLXBGuLj7BzWZYo+3GAjbLaxnlDwP+frir17mWwh9OoJKFhe8c F0qS1jEbrmNRA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EEB5569003; Sun, 4 Jan 2026 13:09:22 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:36 -0700 Message-ID: <20260104200844.481633-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: SQA3U7GWK2K7TTLSUEX5WFGA7APYHEVF X-Message-ID-Hash: SQA3U7GWK2K7TTLSUEX5WFGA7APYHEVF 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 07/11] buildman: Make MyHTMLParser.re_arch private 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 The re_arch member is only used internally by handle_starttag(), so rename it to _re_arch to indicate it's private. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/toolchain.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 07adadffaaa..68fea72bf6c 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -22,7 +22,13 @@ from u_boot_pylib import tools (VAR_CROSS_COMPILE, VAR_PATH, VAR_ARCH, VAR_MAKE_ARGS) = range(4) class MyHTMLParser(HTMLParser): - """Simple class to collect links from a page""" + """Simple class to collect links from a page + + Public members: + arch_link (str): URL of the toolchain for the desired architecture, + or None if not found + links (list of str): List of URLs for all .xz archives found + """ def __init__(self, arch): """Create a new parser @@ -37,7 +43,7 @@ class MyHTMLParser(HTMLParser): HTMLParser.__init__(self) self.arch_link = None self.links = [] - self.re_arch = re.compile('[-_]%s-' % arch) + self._re_arch = re.compile('[-_]%s-' % arch) def handle_starttag(self, tag, attrs): """Handle a start tag in the HTML being parsed""" @@ -46,7 +52,7 @@ class MyHTMLParser(HTMLParser): if tag == 'href': if value and value.endswith('.xz'): self.links.append(value) - if self.re_arch.search(value): + if self._re_arch.search(value): self.arch_link = value From patchwork Sun Jan 4 20:08:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1267 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=1767557374; bh=qi0zOnptSXICefpzuAeWWE6zrdeylt8dzIrTmWHxjdo=; 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=tuPQ49ddoFPQ23j7zlWb8c8O9+XB2vXU7sekThmEEimYsokDLne9Dpz/aVrjxcYiO XX7KI3mcPhUrkBU83QUCIARMKHIx+JT26fBD1Xjb6e22pjW91iN1xBRRlYxIJzbfAq nddiDNFNb/8vA/KEzTiz179gXY0EBdXq0rn+zTHCZ7egIn1N2k06WRs5jhHuFGPMSW EByysMg4r+BighHWjbViX33qd9IYaIqPx1DjZcEEFnhVZCOZITHGErY6ADmHoAFaNb 4+clpPR6WVDHMODsZ8g1WJzI+UUwT7/h1CtP3JKDP7se97EuLPhOpBgV/0fNhkwvKW BxlyJfwTgcrGw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 11402690DE for ; Sun, 4 Jan 2026 13:09:34 -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 z4TLFCwYIQ9K for ; Sun, 4 Jan 2026 13:09:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557373; bh=qi0zOnptSXICefpzuAeWWE6zrdeylt8dzIrTmWHxjdo=; 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=L5BjfoO6NTt4F508l9fLz2yrgF/nYa3hqRZS0f6ul4Af7iqnLjaux14D1/JZkAjWW xHtZs91oaxmylroNwClY59GoJl0VTtZs6VM26XVU27kHgrX3vYC1wwD4CscrAsxiEl /wz/WRxPyKP2zbGWu7uHkpDOBaDZaVmeJ88UGzPjZwZOMEiZAkR35XnuAcL9ce91Tv 3pgCI7Q0O0D2rraiSSU8gOpqW4Ra5IhP493s/0X23NhYsJx3fICzDLiuWp+EYC0vEK kPTuhiRESHotPui8U5ZNMLg+YOPSgWgZ6HTcdNXe5vUDnQiZexDcStgyi97dKG1lzZ aak+stgIrZQKg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F245E690BD for ; Sun, 4 Jan 2026 13:09:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557371; bh=Sud0OQ6qM3eKja7jZ20vFxMyGDGOfnaB2bee9aWDEx0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtaXolJ6bqW/vFk36dugJgZkXUu1nWG8Gqn8uq/zV+wJezhXhCsXVvGkhcLPeJ4dh 3sgniLjSvo02lndd/LLydid5DSnjDQKzZuGcSyyfUbrLbVt9X0tYyQR78ridnF05i5 r3/LiEYhkH65fExSPesKph6OAOzioPf0hbTGOH30s1yf0yDGDvMRuavIaNYqMaXcxX g8x7cq5G8SbiiDE8EAXzjAToT+rZVLp56LwqZE4O55lI3p8J6eIyiwjkxpCl9KdiPm n/2BGiMYVwEwfdt39TllUHu/mDNY0P35FTFB77s5Me8YMDN/43JQiXU+IHU4opzCNX NxzrD8vst8xHg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A88B0690BD; Sun, 4 Jan 2026 13:09:31 -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 S1ZIBSdP6KPV; Sun, 4 Jan 2026 13:09:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557367; bh=yTb7PCjtaimlUY7tDh47nNqxS5L+cSugZaJv2F7ZoOI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RA3UOxMiz4E0YKYVV59YVwEaZ3x61Xx/4nrlKpGcSaqKMNphLYuaQ35EOed3ii3Se twzTXvuaav7wpD1KcpJCUNM1j4dxfiTIBCdvTTsiy99LGEJYAlq4oOP0JhGlkLeg0k ZCkFd0qO/qeNHk+4hzhSNkKCfbMi5LybU4iGnN3zYDrDnqnwfLlnNBT3Cv1gHDJALa m7jZsJGe5L2sY90KoskUdKhXzrCyfPgDzhuTf5zAb2PESfilWEgOe8fV/c5z8WzZJJ GG2nxVbCSSqjgcw01e8BU+Ig7yr93KrJcQMUNBVCNsj5e66WgT83M8yU7OkQ4iPZYL cp4GZYsJVF2wQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 74D2268FD8; Sun, 4 Jan 2026 13:09:27 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:37 -0700 Message-ID: <20260104200844.481633-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: YXKANKRLYNUMUPVAMP3RVX3M67UJHLIJ X-Message-ID-Hash: YXKANKRLYNUMUPVAMP3RVX3M67UJHLIJ 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: Heinrich Schuchardt , Simon Glass , Claude X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 08/11] buildman: Document all Toolchain public members 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 Add missing 'ok' member to the class docstring and add type annotations to all documented members. Co-developed-by: Claude Signed-off-by: Simon Glass --- tools/buildman/toolchain.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 68fea72bf6c..7ccb56a74aa 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -60,25 +60,30 @@ class Toolchain: """A single toolchain Public members: - gcc: Full path to C compiler - path: Directory path containing C compiler - cross: Cross compile string, e.g. 'arm-linux-' - arch: Architecture of toolchain as determined from the first - component of the filename. E.g. arm-linux-gcc becomes arm - priority: Toolchain priority (0=highest, 20=lowest) - override_toolchain: Toolchain to use for sandbox, overriding the normal - one + gcc (str): Full path to C compiler + path (str): Directory path containing C compiler + cross (str): Cross compile string, e.g. 'arm-linux-' + arch (str): Architecture of toolchain as determined from the first + component of the filename. E.g. arm-linux-gcc becomes arm + priority (int): Toolchain priority (0=highest, 20=lowest) + override_toolchain (str): Toolchain to use for sandbox, overriding the + normal one + ok (bool): True if the toolchain works, False otherwise """ def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC, arch=None, override_toolchain=None): """Create a new toolchain object. Args: - fname: Filename of the gcc component, possibly with ~ or $HOME in it - test: True to run the toolchain to test it - verbose: True to print out the information - priority: Priority to use for this toolchain, or PRIORITY_CALC to - calculate it + fname (str): Filename of the gcc component, possibly with ~ or + $HOME in it + test (bool): True to run the toolchain to test it + verbose (bool): True to print out the information + priority (int): Priority to use for this toolchain, or + PRIORITY_CALC to calculate it + arch (str): Architecture of toolchain, or None to detect from + filename + override_toolchain (str): Toolchain to use for sandbox, or None """ fname = os.path.expanduser(fname) self.gcc = fname From patchwork Sun Jan 4 20:08:38 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1268 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=1767557378; bh=Jnx+PYSutxe5TLv21xq8gT36yzTvv32ZBjri3IPgLTs=; 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=R94C76LtnrMfbg8Sv3PJ9lklfVbCQ/spONehqjdn5nUjzkBkXxmCTymp1dRWqhRdc rd4SrOelKs4rmArKNnBDe9WnkwMnzkLA4EagCIx0X3WPtMKNVynbdBsgKcmo6Ak2ii w8pPx83xiy8kbx0UqOwU+jhMqNK4wpvDhv/AVXyjDPjgqgSdZriTz+aOZdIRbbysri tA0QqWxAPTdJWd4nTAZg7Y313fAorAcFf2To2fymFCmnX6I8ykTBYCV5UEkRVO0aGx TBSdYFdZajliLBRaoJ+iC/ssCfZil574UzPAnXTKfMWiaut9seOvM7jMJSHX+xQ6ya gqWWpHWPgOgeA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8726669003 for ; Sun, 4 Jan 2026 13:09:38 -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 6jenHkQ9T1Pp for ; Sun, 4 Jan 2026 13:09:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557378; bh=Jnx+PYSutxe5TLv21xq8gT36yzTvv32ZBjri3IPgLTs=; 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=R94C76LtnrMfbg8Sv3PJ9lklfVbCQ/spONehqjdn5nUjzkBkXxmCTymp1dRWqhRdc rd4SrOelKs4rmArKNnBDe9WnkwMnzkLA4EagCIx0X3WPtMKNVynbdBsgKcmo6Ak2ii w8pPx83xiy8kbx0UqOwU+jhMqNK4wpvDhv/AVXyjDPjgqgSdZriTz+aOZdIRbbysri tA0QqWxAPTdJWd4nTAZg7Y313fAorAcFf2To2fymFCmnX6I8ykTBYCV5UEkRVO0aGx TBSdYFdZajliLBRaoJ+iC/ssCfZil574UzPAnXTKfMWiaut9seOvM7jMJSHX+xQ6ya gqWWpHWPgOgeA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7490B690BD for ; Sun, 4 Jan 2026 13:09:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557376; bh=DjBZaNlL5x4d7R5lRkqip93P1zWNkFmZgNITh5mzyHc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3HCtENiyyHxdxkJdJxzTXGgMZ4/SGJ62a+WAUKI0BXzOAKHELSpivHZ02lTGosYz ZW0nsllS4kJaYRDNldKlvfCFsKPRZx9EP1TjlxNvPqEuD5VdL1e/pEaik/ERv4MnCZ n2kPHw5Hk/X1pJfHx6kU2jVJpPenkl521hOsWEt+z1FwBVPBHpccua1gjkWqDBOUwf 2LiYYv88azJvGXdwIUPlfezJINUk9kLl/fLE2z6Tet2bxWjo+i7f21D4i8M2FNliuN j3uaJ3jVCFEUXutr8vqM7fXU7czm2oeMcwK8MuTPzAinDtVAyJvwEVqqr82s7itqT0 /oSVmfJEfRJKA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7366B69003; Sun, 4 Jan 2026 13:09:36 -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 O_JEU1TZQDdG; Sun, 4 Jan 2026 13:09:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557372; bh=4ufJ7mWgvDr2TqwGHtp8C52cyYIv53SFIb373uYIO7Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Da8D98lAP1IaTurBLpHtGi4rLx/qMm8mmeIZ2A4CcmXhJI96Buft4uOYpNP4m0l43 7wERWxqr3CZZEbFIHYK9tIBTVUtpcmWG5HJ1pmoAQQanl7uGGBv0H7dkbUcTr1/ev0 N6Xkm0fYGLVkpYOpVArky7k3cAHP2+k6GFZOKpjgAphiLjTHds9jBiQ7bkoJj9v1bX X/uvyeDFcQPeY4egr2NPxpHz8+mn3bD9w+X6rERZe3c9cEClaxlQjQEoc98uRUJiRw rI90zZW5fntoWLso2RwpVWJ2rh7dArfzrWvIWloE/xFHymLSHjca8YcwkZ1LiVtEV1 W59gBzun4UHAA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id EA59A68FD8; Sun, 4 Jan 2026 13:09:31 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:38 -0700 Message-ID: <20260104200844.481633-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: AJHB3BQ62CLTVDYKUKXPVS5DL5BGRV6X X-Message-ID-Hash: AJHB3BQ62CLTVDYKUKXPVS5DL5BGRV6X 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 09/11] buildman: Use f-strings in toolchain.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 all string formatting with f-strings for better readability and consistency with modern Python style. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/toolchain.py | 69 +++++++++++++++++++------------------ 1 file changed, 35 insertions(+), 34 deletions(-) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 7ccb56a74aa..90f56813300 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -43,7 +43,7 @@ class MyHTMLParser(HTMLParser): HTMLParser.__init__(self) self.arch_link = None self.links = [] - self._re_arch = re.compile('[-_]%s-' % arch) + self._re_arch = re.compile(f'[-_]{arch}-') def handle_starttag(self, tag, attrs): """Handle a start tag in the HTML being parsed""" @@ -120,8 +120,7 @@ class Toolchain: if verbose: print('Tool chain test: ', end=' ') if self.ok: - print("OK, arch='%s', priority %d" % (self.arch, - self.priority)) + print(f"OK, arch='{self.arch}', priority {self.priority}") else: print('BAD') print(f"Command: {' '.join(cmd)}") @@ -188,7 +187,7 @@ class Toolchain: return ' '.join(args) return '' else: - raise ValueError('Unknown arg to GetEnvArgs (%d)' % which) + raise ValueError(f'Unknown arg to GetEnvArgs ({which})') def make_environment(self, full_path, env=None): """Returns an environment for using the toolchain. @@ -266,8 +265,8 @@ class Toolchain: List of arguments to pass to 'make' """ if self.override_toolchain: - return ['HOSTCC=%s' % self.override_toolchain, - 'CC=%s' % self.override_toolchain] + return [f'HOSTCC={self.override_toolchain}', + f'CC={self.override_toolchain}'] return [] @@ -306,11 +305,10 @@ class Toolchains: """ toolchains = bsettings.get_items('toolchain') if show_warning and not toolchains: - print(("Warning: No tool chains. Please run 'buildman " - "--fetch-arch all' to download all available toolchains, or " - "add a [toolchain] section to your buildman config file " - "%s. See buildman.rst for details" % - bsettings.config_fname)) + print(f"Warning: No tool chains. Please run 'buildman " + f"--fetch-arch all' to download all available toolchains, or " + f"add a [toolchain] section to your buildman config file " + f"{bsettings.config_fname}. See buildman.rst for details") paths = [] for name, value in toolchains: @@ -355,10 +353,10 @@ class Toolchains: if add_it: self.toolchains[toolchain.arch] = toolchain elif verbose: - print(("Toolchain '%s' at priority %d will be ignored because " - "another toolchain for arch '%s' has priority %d" % - (toolchain.gcc, toolchain.priority, toolchain.arch, - self.toolchains[toolchain.arch].priority))) + print(f"Toolchain '{toolchain.gcc}' at priority " + f"{toolchain.priority} will be ignored because another " + f"toolchain for arch '{toolchain.arch}' has priority " + f"{self.toolchains[toolchain.arch].priority}") def scan_path(self, path, verbose): """Scan a path for a valid toolchain @@ -373,9 +371,9 @@ class Toolchains: fnames = [] for subdir in ['.', 'bin', 'usr/bin']: dirname = os.path.join(path, subdir) - if verbose: print(" - looking in '%s'" % dirname) + if verbose: print(f" - looking in '{dirname}'") for fname in glob.glob(dirname + '/*gcc'): - if verbose: print(" - found '%s'" % fname) + if verbose: print(f" - found '{fname}'") fnames.append(fname) return fnames @@ -411,7 +409,8 @@ class Toolchains: if verbose: print('Scanning for tool chains') for name, value in self.prefixes: fname = os.path.expanduser(value) - if verbose: print(" - scanning prefix '%s'" % fname) + if verbose: + print(f" - scanning prefix '{fname}'") if os.path.exists(fname): self.add(fname, True, verbose, PRIORITY_FULL_PREFIX, name) continue @@ -429,7 +428,7 @@ class Toolchains: else: print(f'Error: {msg}') for path in self.paths: - if verbose: print(" - scanning path '%s'" % path) + if verbose: print(f" - scanning path '{path}'") fnames = self.scan_path(path, verbose) for fname in fnames: self.add(fname, True, verbose) @@ -437,11 +436,12 @@ class Toolchains: def list(self): """List out the selected toolchains for each architecture""" col = terminal.Color() - print(col.build(col.BLUE, 'List of available toolchains (%d):' % - len(self.toolchains))) + print(col.build( + col.BLUE, + f'List of available toolchains ({len(self.toolchains)}):')) if len(self.toolchains): for key, value in sorted(self.toolchains.items()): - print('%-10s: %s' % (key, value.gcc)) + print(f'{key:10}: {value.gcc}') else: print('None') @@ -461,7 +461,7 @@ class Toolchains: return self.toolchains[alias] if not arch in self.toolchains: - raise ValueError("No tool chain found for arch '%s'" % arch) + raise ValueError(f"No tool chain found for arch '{arch}'") return self.toolchains[arch] def resolve_references(self, var_dict, args): @@ -558,8 +558,8 @@ class Toolchains: versions = ['14.2.0', '13.2.0'] links = [] for version in versions: - url = '%s/%s/%s/' % (base, arch, version) - print('Checking: %s' % url) + url = f'{base}/{arch}/{version}/' + print(f'Checking: {url}') response = urllib.request.urlopen(url) html = tools.to_string(response.read()) parser = MyHTMLParser(fetch_arch) @@ -617,11 +617,11 @@ class Toolchains: """ # Fist get the URL for this architecture col = terminal.Color() - print(col.build(col.BLUE, "Downloading toolchain for arch '%s'" % arch)) + print(col.build(col.BLUE, f"Downloading toolchain for arch '{arch}'")) url = self.locate_arch_url(arch) if not url: - print(("Cannot find toolchain for arch '%s' - use 'list' to list" % - arch)) + print(f"Cannot find toolchain for arch '{arch}' - " + "use 'list' to list") return 2 home = os.environ['HOME'] dest = os.path.join(home, '.buildman-toolchains') @@ -632,7 +632,7 @@ class Toolchains: tarfile, tmpdir = tools.download(url, '.buildman') if not tarfile: return 1 - print(col.build(col.GREEN, 'Unpacking to: %s' % dest), end=' ') + print(col.build(col.GREEN, f'Unpacking to: {dest}'), end=' ') sys.stdout.flush() path = self.unpack(tarfile, dest) os.remove(tarfile) @@ -647,13 +647,14 @@ class Toolchains: print('Could not locate C compiler - fetch failed.') return 1 if len(compiler_fname_list) != 1: - print(col.build(col.RED, 'Warning, ambiguous toolchains: %s' % - ', '.join(compiler_fname_list))) + print(col.build(col.RED, + f"Warning, ambiguous toolchains: " + f"{', '.join(compiler_fname_list)}")) toolchain = Toolchain(compiler_fname_list[0], True, True) # Make sure that it will be found by buildman if not self.test_settings_has_path(dirpath): - print(("Adding 'download' to config file '%s'" % - bsettings.config_fname)) - bsettings.set_item('toolchain', 'download', '%s/*/*' % dest) + print(f"Adding 'download' to config file " + f"'{bsettings.config_fname}'") + bsettings.set_item('toolchain', 'download', f'{dest}/*/*') return 0 From patchwork Sun Jan 4 20:08:39 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1269 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=1767557382; bh=0u8Bx3d2J8baQjZ2ydiRXeOfDXAvYYsltzCAY3uCQOs=; 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=B7us5ubZ9O57s+Wq6pCmQZSBuuWxnwOA7re0V/Aso46MGhNSRFmCBuyvNYePnK0NK k4gQHNeNtrLPJGbkk3lYFw0B2Fp9zlhKg1Q5SEwwX5dY2v/xYqKtgR0XXN0R36oM3F HZKqnMzA1MwMg/JALEuHL/ue+O1FOPJnj9GGt9f76nhr0NPlisDFSGAGHasC/TyFwo 6+68QGIIeBfELlruJqOcgPRXkyA5uCfM3oMVdBHxoc81Ak1aPnkqD1c3+iuxeNUoGl VZXl9OVZ+20DMQSugZYamhnAzMV6tZGGwmyl7kGDNLP+dIAw0iKxTKYzx0zkwftvl0 AtorUOOvZThwA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 07C1E690EB for ; Sun, 4 Jan 2026 13:09:42 -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 POET3dqazzUa for ; Sun, 4 Jan 2026 13:09:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557381; bh=0u8Bx3d2J8baQjZ2ydiRXeOfDXAvYYsltzCAY3uCQOs=; 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=sS5xgNPeILWl/rnlA6LLlqThv4eo0myzdy+4eIApxiSL8lS+T7YVwetS7pAgE9XLM 8pP9c5Gu75rgHbNd6w24Z0lW9Srdhr9YJAoJkBRGYGXm5+Nm3i/Fw8hymNBWqhaLT3 2HRymaK3JMd1TSFmijeiqvBsVLVKDQbH8Npxh1ZoPyszwXvyIxgS+vFqXnp47VsD6m fbJR1uDL8r2g2gY7wDV9wzxHlIkJiNCt1MftY6U/qzreO1u91fpXIVEfSWIewwcVDI feAOGOO8GY+4lu2kk0rADFobQ7c/KGosBKfVPz1Y/EsZS3cMVIKmjBF5hQEvjyn6h7 zQtKODeZCbadQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E8307690D9 for ; Sun, 4 Jan 2026 13:09:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557381; bh=I1rMGkJiM77kYnFrXV1oKDBdSwlQqK9z/qxEuwFGQr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fSNpIHJwntwcUXFzixoHV2ZpxIIxRpWWJ6Ypnd+LuVIiJUWswfwxAUL0v2EPLH8OO kDeN0zTy/tXccsJGtNiw2QuhrqCfukZ97d6IHv4npjDwxUhjHDI9gQ8u6937SMvXdv 9f9BY8BnLLwORQhOlCw+nJfkCXkI0QAjz18KezMW8dc7rjj0FTiA59vg7xl5NAS+JN gFhhGUZ7GlU2PrVXJ3aaxORlzeEv9CsP7nXHDiJj+fuS6R5BjHfugW2dTpLjXvzaJG dq8hUoKc9cFN1kd0TlD8s1OsLk/85j5PV/VNKS6oxOcnwPr+rliqiMC7FGsSZO/Wvf sLO0FIEqqzTKg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1797C69003; Sun, 4 Jan 2026 13:09:41 -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 gHiZW6uhBUja; Sun, 4 Jan 2026 13:09:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557376; bh=w8PVODVGzPIpxGatpx98igNESRP0f9VB+LNXGXYFH4M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oZcuI2KhkCMx0wplWujtuLT35gYikWgzD+d2Mbyk6xbgqWUjEwPeJYtZxV0wywUgU bEAFstbvKvNRxbFPxkFyIaKDM3pGwDqmGNWKK0vf+/oWm0vPGHCli/bgHTXdDQBpzG FzeyOPrntgX8IMFcGdXtHjhkROabDudTtpdfzTcth0llIYzx8vD+jDyqD6JGmQ50O9 YIlW/dPymw/wiuGNospW/I0TZAVSdKrgSsjLvlg1SQbV5XmjNanksHOG0/Zjfr2dq1 PxNEwc6OgqI3sIUBJZgOsTmn1yWhSTg9yBcQeBq5MSUmyzPM8LsCiAmu/rIOfl2Vyu tiD5y0OwEXk3Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 85FD268FD8; Sun, 4 Jan 2026 13:09:36 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:39 -0700 Message-ID: <20260104200844.481633-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: VUBXEYKRR6VHJCBKH5U7SRALNWL2TZ4S X-Message-ID-Hash: VUBXEYKRR6VHJCBKH5U7SRALNWL2TZ4S 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 10/11] buildman: Fix remaining pylint warnings in toolchain.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 various pylint warnings: - Remove unused import tempfile - Split urllib imports onto separate lines - Rename loop variable 'tag' to 'attr' to avoid redefining argument - Use enumerate instead of range(len()) - Remove unused show_warning parameter from get_wrapper() - Prefix unused loop variables with underscore - Remove unnecessary elif/else after return/raise statements - Split multiple statements on single lines - Use 'with' for urllib.request.urlopen resource management - Add pylint disable comments for functions with many arguments This brings toolchain.py to pylint 10.00/10. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/toolchain.py | 64 ++++++++++++++++++++----------------- 1 file changed, 35 insertions(+), 29 deletions(-) diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 90f56813300..8ec1dbdebba 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -8,8 +8,9 @@ import glob from html.parser import HTMLParser import os import sys -import tempfile -import urllib.request, urllib.error, urllib.parse +import urllib.error +import urllib.parse +import urllib.request from buildman import bsettings from u_boot_pylib import command @@ -48,8 +49,8 @@ class MyHTMLParser(HTMLParser): def handle_starttag(self, tag, attrs): """Handle a start tag in the HTML being parsed""" if tag == 'a': - for tag, value in attrs: - if tag == 'href': + for attr, value in attrs: + if attr == 'href': if value and value.endswith('.xz'): self.links.append(value) if self._re_arch.search(value): @@ -70,6 +71,7 @@ class Toolchain: normal one ok (bool): True if the toolchain works, False otherwise """ + # pylint: disable=too-many-arguments,too-many-positional-arguments def __init__(self, fname, test, verbose=False, priority=PRIORITY_CALC, arch=None, override_toolchain=None): """Create a new toolchain object. @@ -145,16 +147,16 @@ class Toolchain: '-none-linux-gnueabi', '-none-linux-gnueabihf', '-uclinux', '-none-eabi', '-gentoo-linux-gnu', '-linux-gnueabi', '-linux-gnueabihf', '-le-linux', '-uclinux'] - for prio in range(len(priority_list)): - if priority_list[prio] in fname: + for prio, item in enumerate(priority_list): + if item in fname: return PRIORITY_CALC + prio return PRIORITY_CALC + prio - def get_wrapper(self, show_warning=True): + def get_wrapper(self): """Get toolchain wrapper from the setting file. """ value = '' - for name, value in bsettings.get_items('toolchain-wrapper'): + for _, value in bsettings.get_items('toolchain-wrapper'): if not value: print("Warning: Wrapper not found") if value: @@ -177,17 +179,16 @@ class Toolchain: if (base == '' and self.cross == ''): return '' return wrapper + os.path.join(base, self.cross) - elif which == VAR_PATH: + if which == VAR_PATH: return self.path - elif which == VAR_ARCH: + if which == VAR_ARCH: return self.arch - elif which == VAR_MAKE_ARGS: + if which == VAR_MAKE_ARGS: args = self.make_args() if args: return ' '.join(args) return '' - else: - raise ValueError(f'Unknown arg to GetEnvArgs ({which})') + raise ValueError(f'Unknown arg to GetEnvArgs ({which})') def make_environment(self, full_path, env=None): """Returns an environment for using the toolchain. @@ -311,7 +312,7 @@ class Toolchains: f"{bsettings.config_fname}. See buildman.rst for details") paths = [] - for name, value in toolchains: + for _, value in toolchains: fname = os.path.expanduser(value) if '*' in value: paths += glob.glob(fname) @@ -329,6 +330,7 @@ class Toolchains: self.prefixes = bsettings.get_items('toolchain-prefix') self.paths += self.get_path_list(show_warning) + # pylint: disable=too-many-arguments,too-many-positional-arguments def add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, arch=None): """Add a toolchain to our list @@ -371,9 +373,11 @@ class Toolchains: fnames = [] for subdir in ['.', 'bin', 'usr/bin']: dirname = os.path.join(path, subdir) - if verbose: print(f" - looking in '{dirname}'") + if verbose: + print(f" - looking in '{dirname}'") for fname in glob.glob(dirname + '/*gcc'): - if verbose: print(f" - found '{fname}'") + if verbose: + print(f" - found '{fname}'") fnames.append(fname) return fnames @@ -406,7 +410,8 @@ class Toolchains: raise_on_error (bool): True to raise an error if a toolchain is not found """ - if verbose: print('Scanning for tool chains') + if verbose: + print('Scanning for tool chains') for name, value in self.prefixes: fname = os.path.expanduser(value) if verbose: @@ -425,10 +430,10 @@ class Toolchains: msg = f"No tool chain found for prefix '{fname}'" if raise_on_error: raise ValueError(msg) - else: - print(f'Error: {msg}') + print(f'Error: {msg}') for path in self.paths: - if verbose: print(f" - scanning path '{path}'") + if verbose: + print(f" - scanning path '{path}'") fnames = self.scan_path(path, verbose) for fname in fnames: self.add(fname, True, verbose) @@ -560,14 +565,14 @@ class Toolchains: for version in versions: url = f'{base}/{arch}/{version}/' print(f'Checking: {url}') - response = urllib.request.urlopen(url) - html = tools.to_string(response.read()) - parser = MyHTMLParser(fetch_arch) - parser.feed(html) - if fetch_arch == 'list': - links += parser.links - elif parser.arch_link: - return url + parser.arch_link + with urllib.request.urlopen(url) as response: + html = tools.to_string(response.read()) + parser = MyHTMLParser(fetch_arch) + parser.feed(html) + if fetch_arch == 'list': + links += parser.links + elif parser.arch_link: + return url + parser.arch_link if fetch_arch == 'list': return arch, links return None @@ -650,7 +655,8 @@ class Toolchains: print(col.build(col.RED, f"Warning, ambiguous toolchains: " f"{', '.join(compiler_fname_list)}")) - toolchain = Toolchain(compiler_fname_list[0], True, True) + # Instantiate to verify the toolchain works + Toolchain(compiler_fname_list[0], True, True) # Make sure that it will be found by buildman if not self.test_settings_has_path(dirpath): From patchwork Sun Jan 4 20:08:40 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1270 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=1767557387; bh=aUzHl/t1fndDYlCmJGps+iVrG2FD1uED3JsRyIe+HYU=; 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=CIDxaL6JpZX72xMXd9iDoPkev2B+rdP8/BCSYfWukto8cRzWFOu/+W9A5UfT6YTV4 VNqAhcCmScGtqUF1ql5FMN3HAfNYNATZG4u85y43+TUfVtlWj+IWbnfnLuOHgqzFL7 qtAumIY1ofaBp8aVZbwH1gExj/auoC38WbgSGNQDEDoT4ef+0vQclByg9pfPGd9OXN 7e0/g35nzH9XvQK14i/9ejmptMmFHgNONoA8WufkX/qZ85ixJ266rXLBJVBFayJzOM V14mf+nSmpMUuNel0BenBw0LpGjz7ohTsO1TtEzJdfC6R8C8ANFEaMUZqt9EW5qEZO Rjdc8lBxSqVkA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C4DBC690F1 for ; Sun, 4 Jan 2026 13:09:47 -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 JCI-dH8ZqWxB for ; Sun, 4 Jan 2026 13:09:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557387; bh=aUzHl/t1fndDYlCmJGps+iVrG2FD1uED3JsRyIe+HYU=; 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=CIDxaL6JpZX72xMXd9iDoPkev2B+rdP8/BCSYfWukto8cRzWFOu/+W9A5UfT6YTV4 VNqAhcCmScGtqUF1ql5FMN3HAfNYNATZG4u85y43+TUfVtlWj+IWbnfnLuOHgqzFL7 qtAumIY1ofaBp8aVZbwH1gExj/auoC38WbgSGNQDEDoT4ef+0vQclByg9pfPGd9OXN 7e0/g35nzH9XvQK14i/9ejmptMmFHgNONoA8WufkX/qZ85ixJ266rXLBJVBFayJzOM V14mf+nSmpMUuNel0BenBw0LpGjz7ohTsO1TtEzJdfC6R8C8ANFEaMUZqt9EW5qEZO Rjdc8lBxSqVkA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B2CA0690EB for ; Sun, 4 Jan 2026 13:09:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557385; bh=xju9+BWjQMnCmnQIITcdf8UmUxAHBXbTiTxbiULUap4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iQSWCQt1K+sJVyZpoRDPdfk1wv6AWp8gPEiOu/W+cEJTXmspRuw/Fq0Jdnou7I2LE M0FszKgDhTYFtsxkMD90f31p0GgD9ij4mf/2uqQe/A9wqUqerILzhs6wSVd9NXAP4d hKkkwL8w1sxxoHY/+XUET8ol3w7ScVKCNHeQNqg5vySapLWHknI/aB2QRCIWLP29Hi qRPwt/nlMSjn45zmXcMuyHzNO4Ou99YPBiJJfRJra98WPAdiSlihp9XlfQtuEFvIhS KBT/qriWig7XZA/+Jx3g5YsKbapZCf3wIJ6f2VBT5Bh8aU5YyPr+LXr4r8ZKF/ouk+ PEEtg3XHB46Gg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B1F0969003; Sun, 4 Jan 2026 13:09:45 -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 i4tvddDdFouD; Sun, 4 Jan 2026 13:09:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767557381; bh=Hixujm8RBLraoaTXJDIDu/GzgLyzGvVMUXKlpMdTS7w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EQV+sGZfZrDcFTQ8zFnfqL3gcmafsatR9FrEGd3xQ9Mp+df6cK/cJO0OQsnH08jRW mr8EFGKEA2DxJCvJod+KJucL43BbMuJHpUkjVh7Wzyp1t7/hGWalu9dkT9QWFR5uZA /RuNAp9Ale+qQWX47AtgbMlYcOaEmjrP9NyWZsvtA7OK3Ut2nL5QSj7Lub+qLcc3HU cWRH4ed/gVEwj/AOwRqJtSPRlb8i2rH30WRCL9o2jfOzq2+Dn7QSP5koykeClJu02J hqmSq9IbJXsCi3uqZG91XbhN8DFtvccrWyYuAfPkAUTseD1Dd4m7kfvbbCJFVAzAir kKFi40/gCRC0Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 5D3A568FD8; Sun, 4 Jan 2026 13:09:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 4 Jan 2026 13:08:40 -0700 Message-ID: <20260104200844.481633-12-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260104200844.481633-1-sjg@u-boot.org> References: <20260104200844.481633-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: TPPZCDZYNYWUBSITQ4CSANCUTOCJUOHD X-Message-ID-Hash: TPPZCDZYNYWUBSITQ4CSANCUTOCJUOHD 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 11/11] buildman: Fix pylint warnings in test_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 various pylint warnings: - Shorten long lines to fit within 80 characters - Replace unused variables with underscore (_) - Add pylint disable comment for too-many-public-methods - Add pylint disable comment for protected-access (needed to test cleanup of internal _tmpfile) This brings test_boards.py to pylint 10.00/10. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- tools/buildman/test_boards.py | 72 +++++++++++++++++++---------------- 1 file changed, 39 insertions(+), 33 deletions(-) diff --git a/tools/buildman/test_boards.py b/tools/buildman/test_boards.py index 66eb82bc755..0cb1f072543 100644 --- a/tools/buildman/test_boards.py +++ b/tools/buildman/test_boards.py @@ -22,13 +22,16 @@ from u_boot_pylib import tools BOARDS = [ - ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 0', 'board0', ''], + ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 0', 'board0', ''], ['Active', 'arm', 'armv7', '', 'Tester', 'ARM Board 1', 'board1', ''], - ['Active', 'powerpc', 'powerpc', '', 'Tester', 'PowerPC board 1', 'board2', ''], - ['Active', 'sandbox', 'sandbox', '', 'Tester', 'Sandbox board', 'board4', ''], + ['Active', 'powerpc', 'powerpc', '', 'Tester', 'PowerPC board 1', + 'board2', ''], + ['Active', 'sandbox', 'sandbox', '', 'Tester', 'Sandbox board', + 'board4', ''], ] +# pylint: disable=too-many-public-methods class TestBoards(unittest.TestCase): """Test boards.py functionality""" @@ -71,8 +74,8 @@ class TestBoards(unittest.TestCase): # Test normal boards.cfg file boards_cfg = os.path.join(self._base_dir, 'boards.cfg') content = '''# Comment line -Active arm armv7 - Tester ARM_Board_0 board0 config0 maint@test.com -Active powerpc ppc mpc85xx Tester PPC_Board_1 board2 config2 maint2@test.com +Active arm armv7 - Tester ARM0 board0 config0 m@t.co +Active powerpc ppc mpc85xx Tester PPC1 board2 config2 m@t.co ''' tools.write_file(boards_cfg, content.encode('utf-8')) @@ -97,15 +100,15 @@ Active powerpc ppc mpc85xx Tester PPC_Board_1 board2 config2 maint2@t # Test with more than 8 fields (extra fields ignored) boards_cfg = os.path.join(self._base_dir, 'boards_extra.cfg') - content = '''Active arm armv7 soc Tester Board target config maint extra -''' + content = ('Active arm armv7 soc Tester Board target ' + 'config maint extra\n') tools.write_file(boards_cfg, content.encode('utf-8')) brds = boards.Boards() brds.read_boards(boards_cfg) self.assertEqual('config', brds.get_list()[0].cfg_name) def test_boards_methods(self): - """Test Boards helper methods: get_dict, get_selected_names, find_by_target""" + """Test Boards helper methods""" brds = boards.Boards() for brd in BOARDS: brds.add_board(board.Board(*brd)) @@ -124,7 +127,8 @@ Active powerpc ppc mpc85xx Tester PPC_Board_1 board2 config2 maint2@t brds2 = boards.Boards() for brd in BOARDS: brds2.add_board(board.Board(*brd)) - result, warnings = brds2.select_boards([], brds=['nonexistent', 'board0']) + _, warnings = brds2.select_boards([], + brds=['nonexistent', 'board0']) self.assertEqual(1, len(warnings)) self.assertIn('nonexistent', warnings[0]) @@ -132,7 +136,7 @@ Active powerpc ppc mpc85xx Tester PPC_Board_1 board2 config2 maint2@t found = brds.find_by_target('board0') self.assertEqual('arm', found.arch) - with terminal.capture() as (stdout, stderr): + with terminal.capture(): with self.assertRaises(ValueError) as exc: brds.find_by_target('nonexistent') self.assertIn('nonexistent', str(exc.exception)) @@ -181,7 +185,7 @@ endif tools.write_file(defconfig, 'CONFIG_TARGET_RISCV_BOARD=y\n', False) # Test riscv64 (no RV32I) - res, warnings = scanner.scan(defconfig, False) + res, _ = scanner.scan(defconfig, False) self.assertEqual('riscv64', res['arch']) # Test riscv32 (with RV32I) @@ -191,7 +195,7 @@ config ARCH_RV32I ''' tools.write_file(kc_file, riscv32_kconfig) scanner = boards.KconfigScanner(src) - res, warnings = scanner.scan(defconfig, False) + res, _ = scanner.scan(defconfig, False) self.assertEqual('riscv32', res['arch']) finally: tools.write_file(kc_file, orig_kc_data) @@ -207,7 +211,7 @@ config ARCH_RV32I tools.write_file(main, new_data, binary=False) try: - params_list, warnings = self._boards.build_board_list(config_dir, src) + params_list, _ = self._boards.build_board_list(config_dir, src) self.assertEqual(2, len(params_list)) finally: tools.write_file(main, orig_data, binary=False) @@ -218,22 +222,22 @@ config ARCH_RV32I brds = boards.Boards() # Test force=False, quiet=False (normal generation) - with terminal.capture() as (stdout, stderr): + with terminal.capture(): brds.ensure_board_list(outfile, jobs=1, force=False, quiet=False) self.assertTrue(os.path.exists(outfile)) # Test force=True (regenerate even if current) - with terminal.capture() as (stdout, stderr): + with terminal.capture() as (stdout, _): brds.ensure_board_list(outfile, jobs=1, force=True, quiet=False) self.assertTrue(os.path.exists(outfile)) # Test quiet=True (minimal output) - with terminal.capture() as (stdout, stderr): + with terminal.capture() as (stdout, _): brds.ensure_board_list(outfile, jobs=1, force=False, quiet=True) self.assertNotIn('Checking', stdout.getvalue()) # Test quiet=True when up to date (no output) - with terminal.capture() as (stdout, stderr): + with terminal.capture() as (stdout, _): result = brds.ensure_board_list(outfile, jobs=1, force=False, quiet=True) self.assertTrue(result) @@ -297,7 +301,7 @@ Active arm armv7 - Tester Board board0 options maint tools.write_file(defconfig, 'CONFIG_SYS_ARCH="arm"\n', False) try: scanner = boards.KconfigScanner(src) - res, warnings = scanner.scan(defconfig, warn_targets=True) + _, warnings = scanner.scan(defconfig, warn_targets=True) self.assertEqual(1, len(warnings)) self.assertIn('No TARGET_NO_TARGET enabled', warnings[0]) finally: @@ -314,7 +318,7 @@ config TARGET_BOARD0_DUP try: scanner = boards.KconfigScanner(src) defconfig = os.path.join(src, 'configs', 'board0_defconfig') - res, warnings = scanner.scan(defconfig, warn_targets=True) + _, warnings = scanner.scan(defconfig, warn_targets=True) self.assertEqual(1, len(warnings)) self.assertIn('Duplicate TARGET_xxx', warnings[0]) finally: @@ -332,7 +336,8 @@ config TARGET_BOARD0_DUP targets=[['CONFIG_ARM', 'y']]) with mock.patch('qconfig.find_config') as mock_find, \ - mock.patch.object(tools, 'read_file', return_value='CONFIG_TEST=y'): + mock.patch.object(tools, 'read_file', + return_value='CONFIG_TEST=y'): mock_find.return_value = {'board0', 'board1'} result = brds.scan_extended(None, ext) self.assertEqual({'board0', 'board1'}, result) @@ -380,7 +385,7 @@ config TARGET_BOARD0_DUP 'configs/board2_defconfig'] mock_find.return_value = {'board0', 'board1', 'board2'} result = brds.scan_extended(None, ext) - # Should be intersection: {board0, board2} & {board0, board1, board2} + # Result is intersection of regex and find_config results self.assertEqual({'board0', 'board2'}, result) def test_parse_extended(self): @@ -479,7 +484,7 @@ Active arm armv7 - Tester Board board0 config0 maint # Simulate a leftover temp file tmpfile = os.path.join(self._base_dir, 'leftover.tmp') tools.write_file(tmpfile, b'temp') - scanner._tmpfile = tmpfile + scanner._tmpfile = tmpfile # pylint: disable=protected-access # Delete the scanner - should clean up the temp file del scanner @@ -520,8 +525,9 @@ endif try: scanner = boards.KconfigScanner(src) defconfig = os.path.join(src, 'aarch64_defconfig') - tools.write_file(defconfig, 'CONFIG_TARGET_AARCH64_BOARD=y\n', False) - res, warnings = scanner.scan(defconfig, False) + tools.write_file(defconfig, + 'CONFIG_TARGET_AARCH64_BOARD=y\n', False) + res, _ = scanner.scan(defconfig, False) # Should be fixed up to aarch64 self.assertEqual('aarch64', res['arch']) finally: @@ -550,11 +556,11 @@ endif brds = boards.Boards() # First generate the file - with terminal.capture() as (stdout, stderr): + with terminal.capture(): brds.ensure_board_list(outfile, jobs=1, force=False, quiet=False) # Run again - should say "up to date" - with terminal.capture() as (stdout, stderr): + with terminal.capture() as (stdout, _): result = brds.ensure_board_list(outfile, jobs=1, force=False, quiet=False) self.assertTrue(result) @@ -568,7 +574,7 @@ endif # Mock build_board_list to return warnings with mock.patch.object(brds, 'build_board_list') as mock_build: mock_build.return_value = ([], ['WARNING: test warning']) - with terminal.capture() as (stdout, stderr): + with terminal.capture() as (_, stderr): result = brds.ensure_board_list(outfile, jobs=1, force=True, quiet=False) self.assertFalse(result) @@ -601,7 +607,7 @@ endif with mock.patch('qconfig.find_config') as mock_find, \ mock.patch.object(tools, 'read_file', return_value=''), \ mock.patch('glob.glob') as mock_glob, \ - terminal.capture() as (stdout, stderr): + terminal.capture() as (stdout, _): mock_glob.return_value = [] # No matches mock_find.return_value = set() result = brds.scan_extended(None, ext) @@ -652,7 +658,7 @@ endif tools.write_file(defconfig, 'CONFIG_TARGET_RISCV_TEST=y\n', False) scanner = boards.KconfigScanner(src) - res, warnings = scanner.scan(defconfig, False) + res, _ = scanner.scan(defconfig, False) # Should default to riscv64 when ARCH_RV32I lookup fails self.assertEqual('riscv64', res['arch']) @@ -676,7 +682,7 @@ endif # Get the result from the queue result = queue.get(timeout=5) - params, warnings = result + params, _ = result self.assertEqual('board0', params['target']) self.assertEqual('arm', params['arch']) @@ -691,7 +697,7 @@ endif try: brds = boards.Boards() - params_list, warnings = brds.scan_defconfigs(config_dir, src, 1) + params_list, _ = brds.scan_defconfigs(config_dir, src, 1) # Hidden file should not be in results targets = [p['target'] for p in params_list] @@ -716,8 +722,8 @@ N: .* # Mock os.walk to return a path that doesn't start with 'configs/' # when walking the configs directory. This tests line 443. - def mock_walk(path): - # Return paths with 'configs/' prefix (normal) and without (edge case) + def mock_walk(_path): + # Return paths with and without 'configs/' prefix yield (os.path.join(src, 'configs'), [], ['board0_defconfig']) # This path will have 'other/' prefix after srcdir removal yield (os.path.join(src, 'other'), [], ['fred_defconfig'])