From patchwork Sun Jul 2 14:25:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1802325 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=LH6dYTNe; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QvBGf2dGbz20Pj for ; Mon, 3 Jul 2023 00:27:38 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 179DC86335; Sun, 2 Jul 2023 16:27:16 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="LH6dYTNe"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 9CBEF86330; Sun, 2 Jul 2023 16:27:13 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd36.google.com (mail-io1-xd36.google.com [IPv6:2607:f8b0:4864:20::d36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 85CE68637D for ; Sun, 2 Jul 2023 16:27:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-io1-xd36.google.com with SMTP id ca18e2360f4ac-777a6ebb542so147262139f.0 for ; Sun, 02 Jul 2023 07:27:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1688308027; x=1690900027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZHHF0pfdGV4dFqCK0dN4+TDtZWPKdsaKJZEYNr6Iy08=; b=LH6dYTNesCgyh6mS+u1YJZwWWZPrNm45kIzjiYulOfiYNTObJrzeXpcDws4aYK++rZ +fqpZC0dq9ucEVmB7y8WEZhPU1Kstyf1HHcQ+QmWqrGyNFVbf9GAbIOTi4u2weN9ffcM m8on1Wx+KtC9v+yZIDQBwpZK6BtdK/mALq0Kw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688308027; x=1690900027; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZHHF0pfdGV4dFqCK0dN4+TDtZWPKdsaKJZEYNr6Iy08=; b=JWHX5BS08AxPRHPDzdACIgWep4ZfbEwDgqHTSaOiAAL7a8xp7uRr2Z6Zp1+ZRvD59X fc99x9DK4xAQrXFlELqiEmrH+fFppn+HvlGh98hD7cA/NMqu3uUTDDP9m0S9gZuQlG69 BeE5kXFnCyzmI592C2uLPpcvw5B+dpZRr3uwwVL2xh6bXPZG++JqWkp6e5hhRG04Cej5 04mQ7KTBUca+UqpnNvoiHeQctu4afCqZu7Cnbdc8H0mfqplzu0ETKmACHwyWGX26uLdf GtgNwWoTKvrrSyDp4Tz2y3ZalxmSIfip3WmUj2uFe7YpSATbRUfu28u9Arcgyi8DJczA hThQ== X-Gm-Message-State: AC+VfDxaud3/gl2Gels0b+j/oPsi8pI41Byz0Uh5dOoDp1JJZKQBxAb9 1jyPNIx4/oYSwgKeiQfZ526c57zWI34HN/QtIVI= X-Google-Smtp-Source: ACHHUZ54AZ4NpJvJrcTxKtSzfc7h21NGzyNVl4QdEFBqzuPMzhurGbjixvuAaw5L6T8wv8UpgyxOtw== X-Received: by 2002:a6b:f90d:0:b0:780:d338:5373 with SMTP id j13-20020a6bf90d000000b00780d3385373mr7726117iog.15.1688308026931; Sun, 02 Jul 2023 07:27:06 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id c13-20020a02c9cd000000b0042af5268e4asm2934713jap.58.2023.07.02.07.27.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Jul 2023 07:27:06 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Simon Glass Subject: [PATCH 02/58] buildman: Convert camel case in control.py Date: Sun, 2 Jul 2023 15:25:27 +0100 Message-ID: <20230702142639.1249681-3-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.255.g8b1d071c50-goog In-Reply-To: <20230702142639.1249681-1-sjg@chromium.org> References: <20230702142639.1249681-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass --- tools/buildman/control.py | 31 ++++++++++++++++++------------- tools/buildman/func_test.py | 7 ++++--- tools/buildman/main.py | 2 +- tools/buildman/test.py | 2 +- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/tools/buildman/control.py b/tools/buildman/control.py index b8286e185411..bfb02834e8fb 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -2,6 +2,11 @@ # Copyright (c) 2013 The Chromium OS Authors. # +"""Control module for buildman + +This holds the main control logic for buildman, when not running tests. +""" + import multiprocessing try: import importlib.resources @@ -25,11 +30,11 @@ from u_boot_pylib import terminal from u_boot_pylib import tools from u_boot_pylib.terminal import tprint -def GetPlural(count): +def get_plural(count): """Returns a plural 's' if count is not 1""" return 's' if count != 1 else '' -def GetActionSummary(is_summary, commits, selected, options): +def get_action_summary(is_summary, commits, selected, options): """Return a string summarising the intended action. Returns: @@ -38,18 +43,18 @@ def GetActionSummary(is_summary, commits, selected, options): if commits: count = len(commits) count = (count + options.step - 1) // options.step - commit_str = '%d commit%s' % (count, GetPlural(count)) + commit_str = '%d commit%s' % (count, get_plural(count)) else: commit_str = 'current source' str = '%s %s for %d boards' % ( 'Summary of' if is_summary else 'Building', commit_str, len(selected)) str += ' (%d thread%s, %d job%s per thread)' % (options.threads, - GetPlural(options.threads), options.jobs, GetPlural(options.jobs)) + get_plural(options.threads), options.jobs, get_plural(options.jobs)) return str -def ShowActions(series, why_selected, boards_selected, builder, options, - board_warnings): +def show_actions(series, why_selected, boards_selected, builder, options, + board_warnings): """Display a list of actions that we would take, if not a dry run. Args: @@ -72,7 +77,7 @@ def ShowActions(series, why_selected, boards_selected, builder, options, commits = series.commits else: commits = None - print(GetActionSummary(False, commits, boards_selected, + print(get_action_summary(False, commits, boards_selected, options)) print('Build directory: %s' % builder.base_dir) if commits: @@ -92,7 +97,7 @@ def ShowActions(series, why_selected, boards_selected, builder, options, for warning in board_warnings: print(col.build(col.YELLOW, warning)) -def ShowToolchainPrefix(brds, toolchains): +def show_toolchain_prefix(brds, toolchains): """Show information about a the tool chain used by one or more boards The function checks that all boards use the same toolchain, then prints @@ -133,8 +138,8 @@ def get_allow_missing(opt_allow, opt_no_allow, num_selected, has_branch): allow_missing = False return allow_missing -def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, - clean_dir=False, test_thread_exceptions=False): +def do_buildman(options, args, toolchains=None, make_func=None, brds=None, + clean_dir=False, test_thread_exceptions=False): """The main control code for buildman Args: @@ -237,7 +242,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, sys.exit(col.build(col.RED, 'No matching boards found')) if options.print_prefix: - err = ShowToolchainPrefix(brds, toolchains) + err = show_toolchain_prefix(brds, toolchains) if err: sys.exit(col.build(col.RED, err)) return 0 @@ -373,7 +378,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, # For a dry run, just show our actions as a sanity check if options.dry_run: - ShowActions(series, why_selected, selected, builder, options, + show_actions(series, why_selected, selected, builder, options, board_warnings) else: builder.force_build = options.force_build @@ -393,7 +398,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, brds=None, commits = None if not options.ide: - tprint(GetActionSummary(options.summary, commits, board_selected, + tprint(get_action_summary(options.summary, commits, board_selected, options)) # We can't show function sizes without board details at present diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 08b2714b7be2..052153043b21 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -247,9 +247,10 @@ class TestFunctional(unittest.TestCase): options, args = cmdline.ParseArgs() if brds == False: brds = self._boards - result = control.DoBuildman(options, args, toolchains=self._toolchains, - make_func=self._HandleMake, brds=brds, clean_dir=clean_dir, - test_thread_exceptions=test_thread_exceptions) + result = control.do_buildman( + options, args, toolchains=self._toolchains, + make_func=self._HandleMake, brds=brds, clean_dir=clean_dir, + test_thread_exceptions=test_thread_exceptions) if get_builder: self._builder = control.builder return result diff --git a/tools/buildman/main.py b/tools/buildman/main.py index ca1beb098292..9c84e16e7df0 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -65,7 +65,7 @@ def run_buildman(): # Build selected commits for selected boards else: bsettings.Setup(options.config_file) - ret_code = control.DoBuildman(options, args) + ret_code = control.do_buildman(options, args) sys.exit(ret_code) diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 9fa6445b798f..7eb25aa80eba 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -465,7 +465,7 @@ class TestBuild(unittest.TestCase): options.show_errors = False options.keep_outputs = False args = ['tegra20'] - control.DoBuildman(options, args) + control.do_buildman(options, args) def testBoardSingle(self): """Test single board selection"""