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 CC529C0015E for ; Sun, 16 Jul 2023 00:46:38 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 620738667C; Sun, 16 Jul 2023 02:40:09 +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="EK1COLUd"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6551E86308; Sun, 16 Jul 2023 02:38:20 +0200 (CEST) Received: from mail-il1-x130.google.com (mail-il1-x130.google.com [IPv6:2607:f8b0:4864:20::130]) (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 3E71686612 for ; Sun, 16 Jul 2023 02:38:03 +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-il1-x130.google.com with SMTP id e9e14a558f8ab-345e55a62d8so13770875ab.3 for ; Sat, 15 Jul 2023 17:38:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689467882; x=1692059882; 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=PJlt002kMhqSTEuiWYZ6Bf+/0yFr0nB1OyrUco0LGQY=; b=EK1COLUdSUkO+z0nchl39SiXPOGr4ENY2XnOvnlPuMs2R8sAqBDaxhe2ItQ6vkjxlb 5BiHca2thUcvE/gMcidPZsnJycQQm+j2KpirglJ50DMx6jdYcREZ95b2hz639jllWtMF fJ4CVwvbuAOXuL9361hApUZmkfh1duFG44A50= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689467882; x=1692059882; 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=PJlt002kMhqSTEuiWYZ6Bf+/0yFr0nB1OyrUco0LGQY=; b=Vf4QxQF8WfnpQbWxequ8ACgf9oFj7vOOMSEvmtaszKift5kk2HO54opApfb4V+E0AC ieTu3Vinl1YOlymqiXIyO2/od9rFZlhG/mDDEhyehFP4CwF8w6lUrv7FZ7Sz/WV+7O4o zcJvexVgar1i1VJG/7/dHiWdVTL9us8YrLs43Wbpq22HFN5N8GZOL1Q1jiGMS2jAVGmW 7zgr6UdfT/0iDuj+lceT+BPG0T2aa8hQ2I6edYMpcpVIH/3cDUg1hU4KnLFuRyCl3/iw 0qdFezWfmr2OtLqA80V3URPn8cezOt4Wpr6due5aV8Ro1Ih46/4sH15CHflX2yA6kL6p s4OA== X-Gm-Message-State: ABy/qLYM+TLczA/wv4pSpLApD7mPCTy2dxHvB5WMECP3kEswGnyz8WAf XCaR+2ESbF3OZ4u1LbVQvzOJA30lxsho61NreIY= X-Google-Smtp-Source: APBJJlG16xgteBgxWoZZRcwYcPtxtc5H7AlOGWz5iPnShEUDCT2osiGCNQINKLLJ7ZdXY6Zk11bKHA== X-Received: by 2002:a92:c945:0:b0:345:a3c6:87b8 with SMTP id i5-20020a92c945000000b00345a3c687b8mr7316877ilq.12.1689467881681; Sat, 15 Jul 2023 17:38:01 -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 t3-20020a05663801e300b0042b52dc77e3sm3510512jaq.158.2023.07.15.17.38.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Jul 2023 17:38:01 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Mike Frysinger , Simon Glass Subject: [PATCH v3 55/81] buildman: Convert camel case in bsettings.py Date: Sat, 15 Jul 2023 18:36:23 -0600 Message-ID: <20230716003718.231903-56-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.455.g037347b96a-goog In-Reply-To: <20230716003718.231903-1-sjg@chromium.org> References: <20230716003718.231903-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.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 --- (no changes since v1) tools/buildman/bsettings.py | 14 +++++++------- tools/buildman/control.py | 2 +- tools/buildman/func_test.py | 12 ++++++------ tools/buildman/main.py | 2 +- tools/buildman/test.py | 4 ++-- tools/buildman/toolchain.py | 14 +++++++------- tools/moveconfig.py | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/tools/buildman/bsettings.py b/tools/buildman/bsettings.py index 0eb894a558c1..612ec0c28464 100644 --- a/tools/buildman/bsettings.py +++ b/tools/buildman/bsettings.py @@ -7,7 +7,7 @@ import io config_fname = None -def Setup(fname=''): +def setup(fname=''): """Set up the buildman settings module by reading config files Args: @@ -23,15 +23,15 @@ def Setup(fname=''): config_fname = '%s/.buildman' % os.getenv('HOME') if not os.path.exists(config_fname): print('No config file found ~/.buildman\nCreating one...\n') - CreateBuildmanConfigFile(config_fname) + create_buildman_config_file(config_fname) print('To install tool chains, please use the --fetch-arch option') if config_fname: settings.read(config_fname) -def AddFile(data): +def add_file(data): settings.readfp(io.StringIO(data)) -def GetItems(section): +def get_items(section): """Get the items from a section of the config. Args: @@ -47,7 +47,7 @@ def GetItems(section): except: raise -def GetGlobalItemValue(name): +def get_global_item_value(name): """Get an item from the 'global' section of the config. Args: @@ -58,7 +58,7 @@ def GetGlobalItemValue(name): """ return settings.get('global', name, fallback=None) -def SetItem(section, tag, value): +def set_item(section, tag, value): """Set an item and write it back to the settings file""" global settings global config_fname @@ -68,7 +68,7 @@ def SetItem(section, tag, value): with open(config_fname, 'w') as fd: settings.write(fd) -def CreateBuildmanConfigFile(config_fname): +def create_buildman_config_file(config_fname): """Creates a new config file with no tool chain information. Args: diff --git a/tools/buildman/control.py b/tools/buildman/control.py index cda2d407de96..4bceaeabc87c 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -157,7 +157,7 @@ def get_allow_missing(opt_allow, opt_no_allow, num_selected, has_branch): external blobs are used """ allow_missing = False - am_setting = bsettings.GetGlobalItemValue('allow-missing') + am_setting = bsettings.get_global_item_value('allow-missing') if am_setting: if am_setting == 'always': allow_missing = True diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index ce1e60397279..d8b785fcb8ad 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -186,8 +186,8 @@ class TestFunctional(unittest.TestCase): self._buildman_pathname = sys.argv[0] self._buildman_dir = os.path.dirname(os.path.realpath(sys.argv[0])) command.test_result = self._HandleCommand - bsettings.Setup(None) - bsettings.AddFile(settings_data) + bsettings.setup(None) + bsettings.add_file(settings_data) self.setupToolchains() self._toolchains.Add('arm-gcc', test=False) self._toolchains.Add('powerpc-gcc', test=False) @@ -699,7 +699,7 @@ Some images are invalid''' def testBlobSettingsAlways(self): """Test the 'always' policy""" - bsettings.SetItem('global', 'allow-missing', 'always') + bsettings.set_item('global', 'allow-missing', 'always') self.assertEqual(True, control.get_allow_missing(False, False, 1, False)) self.assertEqual(False, @@ -707,7 +707,7 @@ Some images are invalid''' def testBlobSettingsBranch(self): """Test the 'branch' policy""" - bsettings.SetItem('global', 'allow-missing', 'branch') + bsettings.set_item('global', 'allow-missing', 'branch') self.assertEqual(False, control.get_allow_missing(False, False, 1, False)) self.assertEqual(True, @@ -717,7 +717,7 @@ Some images are invalid''' def testBlobSettingsMultiple(self): """Test the 'multiple' policy""" - bsettings.SetItem('global', 'allow-missing', 'multiple') + bsettings.set_item('global', 'allow-missing', 'multiple') self.assertEqual(False, control.get_allow_missing(False, False, 1, False)) self.assertEqual(True, @@ -727,7 +727,7 @@ Some images are invalid''' def testBlobSettingsBranchMultiple(self): """Test the 'branch multiple' policy""" - bsettings.SetItem('global', 'allow-missing', 'branch multiple') + bsettings.set_item('global', 'allow-missing', 'branch multiple') self.assertEqual(False, control.get_allow_missing(False, False, 1, False)) self.assertEqual(True, diff --git a/tools/buildman/main.py b/tools/buildman/main.py index 097e0594bf0b..a7f456bc8193 100755 --- a/tools/buildman/main.py +++ b/tools/buildman/main.py @@ -74,7 +74,7 @@ def run_buildman(): # Build selected commits for selected boards else: - bsettings.Setup(args.config_file) + bsettings.setup(args.config_file) ret_code = control.do_buildman(args) return ret_code diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 7eb25aa80eba..3f55035ea2e4 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -138,8 +138,8 @@ class TestBuild(unittest.TestCase): self.brds.select_boards([]) # Add some test settings - bsettings.Setup(None) - bsettings.AddFile(settings_data) + bsettings.setup(None) + bsettings.add_file(settings_data) # Set up the toolchains self.toolchains = toolchain.Toolchains() diff --git a/tools/buildman/toolchain.py b/tools/buildman/toolchain.py index 0ecd8458b912..57bf6149ca61 100644 --- a/tools/buildman/toolchain.py +++ b/tools/buildman/toolchain.py @@ -139,7 +139,7 @@ class Toolchain: """Get toolchain wrapper from the setting file. """ value = '' - for name, value in bsettings.GetItems('toolchain-wrapper'): + for name, value in bsettings.get_items('toolchain-wrapper'): if not value: print("Warning: Wrapper not found") if value: @@ -249,7 +249,7 @@ class Toolchains: self.prefixes = {} self.paths = [] self.override_toolchain = override_toolchain - self._make_flags = dict(bsettings.GetItems('make-flags')) + self._make_flags = dict(bsettings.get_items('make-flags')) def GetPathList(self, show_warning=True): """Get a list of available toolchain paths @@ -261,7 +261,7 @@ class Toolchains: List of strings, each a path to a toolchain mentioned in the [toolchain] section of the settings file. """ - toolchains = bsettings.GetItems('toolchain') + 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 " @@ -283,7 +283,7 @@ class Toolchains: Args: show_warning: True to show a warning if there are no tool chains. """ - self.prefixes = bsettings.GetItems('toolchain-prefix') + self.prefixes = bsettings.get_items('toolchain-prefix') self.paths += self.GetPathList(show_warning) def Add(self, fname, test=True, verbose=False, priority=PRIORITY_CALC, @@ -399,7 +399,7 @@ class Toolchains: returns: toolchain object, or None if none found """ - for tag, value in bsettings.GetItems('toolchain-alias'): + for tag, value in bsettings.get_items('toolchain-alias'): if arch == tag: for alias in value.split(): if alias in self.toolchains: @@ -421,7 +421,7 @@ class Toolchains: Returns: Resolved string - >>> bsettings.Setup(None) + >>> bsettings.setup(None) >>> tcs = Toolchains() >>> tcs.Add('fred', False) >>> var_dict = {'oblique' : 'OBLIQUE', 'first' : 'fi${second}rst', \ @@ -598,5 +598,5 @@ class Toolchains: if not self.TestSettingsHasPath(dirpath): print(("Adding 'download' to config file '%s'" % bsettings.config_fname)) - bsettings.SetItem('toolchain', 'download', '%s/*/*' % dest) + bsettings.set_item('toolchain', 'download', '%s/*/*' % dest) return 0 diff --git a/tools/moveconfig.py b/tools/moveconfig.py index c4d72ede3684..6cbecc3d5c80 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -2037,7 +2037,7 @@ doc/develop/moveconfig.rst for documentation.''' if not args.cleanup_headers_only: check_clean_directory() - bsettings.Setup('') + bsettings.setup('') toolchains = toolchain.Toolchains() toolchains.GetSettings() toolchains.Scan(verbose=False) -- 2.41.0.455.g037347b96a-goog