]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
devtool: misc cleanups
authorChris Laplante <chris.laplante@agilent.com>
Sun, 12 Jan 2025 14:53:58 +0000 (09:53 -0500)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 20 Jan 2025 13:38:56 +0000 (13:38 +0000)
1. Bad None comparison
2. Reliance on transitive includes in bb
3. Unbound 'ret' variable

Signed-off-by: Chris Laplante <chris.laplante@agilent.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
scripts/devtool

index 596fdaac669fc183ad6b45eb1af25538ca2b4bae..d29faf0238f0ae0ea9eea47f1799f04e4ddc4ac2 100755 (executable)
@@ -45,7 +45,7 @@ class ConfigHandler:
         try:
             ret = self.config_obj.get(section, option)
         except (configparser.NoOptionError, configparser.NoSectionError):
-            if default != None:
+            if default is not None:
                 ret = default
             else:
                 raise
@@ -147,7 +147,7 @@ def create_workspace(args, config, basepath, workspace):
         _enable_workspace_layer(workspacedir, config, basepath)
 
 def _create_workspace(workspacedir, config, basepath, layerseries=None):
-    import bb
+    import bb.utils
 
     confdir = os.path.join(workspacedir, 'conf')
     if os.path.exists(os.path.join(confdir, 'layer.conf')):
@@ -192,7 +192,7 @@ def _create_workspace(workspacedir, config, basepath, layerseries=None):
 
 def _enable_workspace_layer(workspacedir, config, basepath):
     """Ensure the workspace layer is in bblayers.conf"""
-    import bb
+    import bb.utils
     bblayers_conf = os.path.join(basepath, 'conf', 'bblayers.conf')
     if not os.path.exists(bblayers_conf):
         logger.error('Unable to find bblayers.conf')
@@ -286,6 +286,7 @@ def main():
     scriptutils.logger_setup_color(logger, global_args.color)
 
     if global_args.bbpath is None:
+        import bb
         try:
             tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
             try:
@@ -341,6 +342,7 @@ def main():
         ret = err.exitcode
     except argparse_oe.ArgumentUsageError as ae:
         parser.error_subcommand(ae.message, ae.subcommand)
+        ret = 2
 
     return ret