Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 98592C61DA4 for ; Fri, 24 Feb 2023 01:21:27 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E23A185B3D; Fri, 24 Feb 2023 02:20:11 +0100 (CET) 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="C2sxGG+N"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1F0E285B05; Fri, 24 Feb 2023 02:19:13 +0100 (CET) Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) (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 DB57A859A6 for ; Fri, 24 Feb 2023 02:18:52 +0100 (CET) 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-il1-x12e.google.com with SMTP id o8so3934946ilt.13 for ; Thu, 23 Feb 2023 17:18:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; 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=KniEtLep/wcPGDprSN4+tC/5UKqZUbYyvPTR2lRLe0Y=; b=C2sxGG+NnXq20I0JOXJtxvorO1YLfN52NnAql1KYAFBrfqXrxFDEHu92Tfv8yy1tgC RFrfTlRERADHwRWOxkdRufP4iwyBXrwiWw0xrWyMxyRTGBQ06mMdk29N95/mvPyZgHlA C+dTwWvZ+Rq3Qlp1a3JHrxNP3ZLTsmPr2+Krk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=KniEtLep/wcPGDprSN4+tC/5UKqZUbYyvPTR2lRLe0Y=; b=FRVdqyTRd7e+PYrZgTcvWk/pwhXTHfqM23k1DXVUlUIB2OpeYdvolye/55tIJfxJen heZ3LYJHK7X7zH09LZiXWQhgeBmXUbXDJf5wmSBQcG5gHOiT+M5aQEAcWLbEuEbc6bxA sqladGq+NnGMxNIfjI5Fshml6Nht3rwe70LmXh5PcRubrTCT0Ah0a3QuKEYrMAHvnWny LW9H7oD5oj0WNZghg7ErgL1GbD7fjSA/2r//H8ao5KaowQYb5ScDjV84Wom/0q4IQAy/ VLVktHrjL6/O+kUA9xLb1+ab8vCbTtHt3KtyLLSnxVVtZxxuMzFohf+VmVFk3RLXPJ9I Fa8g== X-Gm-Message-State: AO0yUKWNEdwyFoyaHqOpHR5e1RwKBVJHxu+R1dnkPrSbMQnGU7r/4FA3 VmoQSWD4jlqcrlXkF7Dgg3UPfgJBTky6/fPs X-Google-Smtp-Source: AK7set8iU7PDRs5ysX+nUWY4iJfq/t2fT68KGjHuFRNCq+DwKaEM3scifHiX9yXXPa9U0kPq8jyCEQ== X-Received: by 2002:a05:6e02:1948:b0:313:e73b:d3dd with SMTP id x8-20020a056e02194800b00313e73bd3ddmr8786423ilu.13.1677201532378; Thu, 23 Feb 2023 17:18:52 -0800 (PST) Received: from sjg1.roam.corp.google.com (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id q3-20020a92d403000000b003127b668eafsm2677214ilm.19.2023.02.23.17.18.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Feb 2023 17:18:52 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Heinrich Schuchardt , Simon Glass Subject: [PATCH v2 09/24] buildman: Move the main code into a function Date: Thu, 23 Feb 2023 18:18:09 -0700 Message-Id: <20230224011824.2111976-10-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230224011824.2111976-1-sjg@chromium.org> References: <20230224011824.2111976-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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.6 at phobos.denx.de X-Virus-Status: Clean Put this code into a function so it is easy for it be run when packaged. Signed-off-by: Simon Glass --- Changes in v2: - Add patch to split out the main code into a function tools/buildman/main.py | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 6076ba5d63d..5e1f68d8235 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -46,17 +46,22 @@ def RunTests(skip_net_tests, verboose, args): return (0 if result.wasSuccessful() else 1) -options, args = cmdline.ParseArgs() +def run_buildman(): + options, args = cmdline.ParseArgs() -if not options.debug: - sys.tracebacklimit = 0 + if not options.debug: + sys.tracebacklimit = 0 -# Run our meagre tests -if options.test: - RunTests(options.skip_net_tests, options.verbose, args) + # Run our meagre tests + if cmdline.HAS_TESTS and options.test: + RunTests(options.skip_net_tests, options.verbose, args) -# Build selected commits for selected boards -else: - bsettings.Setup(options.config_file) - ret_code = control.DoBuildman(options, args) - sys.exit(ret_code) + # Build selected commits for selected boards + else: + bsettings.Setup(options.config_file) + ret_code = control.DoBuildman(options, args) + sys.exit(ret_code) + + +if __name__ == "__main__": + run_buildman() -- 2.39.2.637.g21b0678d19-goog