devtool: misc cleanups

1. Bad None comparison
2. Reliance on transitive includes in bb
3. Unbound 'ret' variable

(From OE-Core rev: 0966d04c740f11da41c342a2a2d160d9ec5f5d70)

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>
This commit is contained in:
Chris Laplante 2025-01-12 09:53:58 -05:00 committed by Richard Purdie
parent 8a46267032
commit b44cfce570

View File

@ -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