]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
buildman: Convert camel case in bsettings.py
authorSimon Glass <sjg@chromium.org>
Wed, 19 Jul 2023 23:49:05 +0000 (17:49 -0600)
committerSimon Glass <sjg@chromium.org>
Mon, 24 Jul 2023 15:34:11 +0000 (09:34 -0600)
Convert this file to snake case and update all files which use it.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/buildman/bsettings.py
tools/buildman/control.py
tools/buildman/func_test.py
tools/buildman/main.py
tools/buildman/test.py
tools/buildman/toolchain.py
tools/moveconfig.py

index 029c401fd2a90a38903babdf1d9b8579071b866b..f7f8276e629136d241eafdbbb170b974dcabac64 100644 (file)
@@ -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:
index cda2d407de969425f62a3937ab85ba6ec99c0513..4bceaeabc87c1a197cb061d7aa647b7c003ee325 100644 (file)
@@ -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
index fe11917abcf794a21a2827892c0d1488d427a0ad..56e9f009eb6ca4fd07970b5e8ff3719972789435 100644 (file)
@@ -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,
index 097e0594bf0b6811b031d2108d6a23f41168f2c5..a7f456bc81934b94896c460197b4cb0f7cc6b193 100755 (executable)
@@ -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
 
index 7eb25aa80ebaa671d4c474242bb9b563b34b2302..3f55035ea2e4be25389566003a7f27a227f4014f 100644 (file)
@@ -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()
index 1001b612086f96a98d342f845691d560e20f0291..b05001194e42b320078606b55806ca7ae36e831e 100644 (file)
@@ -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
index c4d72ede368437a4339e92746f4099fec24a950b..6cbecc3d5c8035abc30d498b05270f800c68a5d7 100755 (executable)
@@ -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)