bitbake: main: fix bad-witespace pylint warnings
PATCH 1/4 bitbake: main: fix bad-witespace pylint warnings
Fixed pylint warnings:
No space allowed around keyword argument assignment No space allowed after bracket
No space allowed before bracket
--- bitbake/lib/bb/main.py | 138 ++++++++++++++++++++++++------------------------- 1 file changed, 69 insertions(+), 69 deletions(-)
bitbake/lib/bb/main.py +69 -69
@@ -100,7 +100,7 @@ def import_extension_module(pkg, modulename, checkattr): # Dynamically load the UI based on the ui name. Although we # suggest a fixed set this allows you to have flexibility in which # ones are available. - module = __import__(pkg.__name__, fromlist = [modulename]) + module = __import__(pkg.__name__, fromlist=[modulename]) return getattr(module, modulename) except AttributeError: raise BBMainException('FATAL: Unable to import extension module "%s" from %s. Valid extension modules: %s' % (modulename, pkg.__name__, present_options(list_extension_modules(pkg, checkattr))))
@@ -129,111 +129,111 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): def parseCommandLine(self, argv=sys.argv): parser = optparse.OptionParser( - formatter = BitbakeHelpFormatter(), - version = "BitBake Build Tool Core version %s" % bb.__version__, - usage = """%prog [options] [recipename/target recipe:do_task ...] + formatter=BitbakeHelpFormatter(), + version="BitBake Build Tool Core version %s" % bb.__version__, + usage="""%prog [options] [recipename/target recipe:do_task ...] Executes the specified task (default is 'build') for a given set of target recipes (.bb files). It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which will provide the layer, BBFILES and other configuration information.""") - parser.add_option("-b", "--buildfile", help = "Execute tasks from a specific .bb recipe directly. WARNING: Does not handle any dependencies from other recipes.", - action = "store", dest = "buildfile", default = None) + parser.add_option("-b", "--buildfile", help="Execute tasks from a specific .bb recipe directly. WARNING: Does not handle any dependencies from other recipes.", + action="store", dest="buildfile", default=None) - parser.add_option("-k", "--continue", help = "Continue as much as possible after an error. While the target that failed and anything depending on it cannot be built, as much as possible will be built before stopping.", - action = "store_false", dest = "abort", default = True) + parser.add_option("-k", "--continue", help="Continue as much as possible after an error. While the target that failed and anything depending on it cannot be built, as much as possible will be built before stopping.", + action="store_false", dest="abort", default=True) - parser.add_option("-a", "--tryaltconfigs", help = "Continue with builds by trying to use alternative providers where possible.", - action = "store_true", dest = "tryaltconfigs", default = False) + parser.add_option("-a", "--tryaltconfigs", help="Continue with builds by trying to use alternative providers where possible.", + action="store_true", dest="tryaltconfigs", default=False) - parser.add_option("-f", "--force", help = "Force the specified targets/task to run (invalidating any existing stamp file).", - action = "store_true", dest = "force", default = False) + parser.add_option("-f", "--force", help="Force the specified targets/task to run (invalidating any existing stamp file).", + action="store_true", dest="force", default=False) - parser.add_option("-c", "--cmd", help = "Specify the task to execute. The exact options available depend on the metadata. Some examples might be 'compile' or 'populate_sysroot' or 'listtasks' may give a list of the tasks available.", - action = "store", dest = "cmd") + parser.add_option("-c", "--cmd", help="Specify the task to execute. The exact options available depend on the metadata. Some examples might be 'compile' or 'populate_sysroot' or 'listtasks' may give a list of the tasks available.", + action="store", dest="cmd") - parser.add_option("-C", "--clear-stamp", help = "Invalidate the stamp for the specified task such as 'compile' and then run the default task for the specified target(s).", - action = "store", dest = "invalidate_stamp") + parser.add_option("-C", "--clear-stamp", help="Invalidate the stamp for the specified task such as 'compile' and then run the default task for the specified target(s).", + action="store", dest="invalidate_stamp") - parser.add_option("-r", "--read", help = "Read the specified file before bitbake.conf.", - action = "append", dest = "prefile", default = []) + parser.add_option("-r", "--read", help="Read the specified file before bitbake.conf.", + action="append", dest="prefile", default=[]) - parser.add_option("-R", "--postread", help = "Read the specified file after bitbake.conf.", - action = "append", dest = "postfile", default = []) + parser.add_option("-R", "--postread", help="Read the specified file after bitbake.conf.", + action="append", dest="postfile", default=[]) - parser.add_option("-v", "--verbose", help = "Output more log message data to the terminal.", - action = "store_true", dest = "verbose", default = False) + parser.add_option("-v", "--verbose", help="Output more log message data to the terminal.", + action="store_true", dest="verbose", default=False) - parser.add_option("-D", "--debug", help = "Increase the debug level. You can specify this more than once.", - action = "count", dest="debug", default = 0) + parser.add_option("-D", "--debug", help="Increase the debug level. You can specify this more than once.", + action="count", dest="debug", default=0) - parser.add_option("-n", "--dry-run", help = "Don't execute, just go through the motions.", - action = "store_true", dest = "dry_run", default = False) + parser.add_option("-n", "--dry-run", help="Don't execute, just go through the motions.", + action="store_true", dest="dry_run", default=False) - parser.add_option("-S", "--dump-signatures", help = "Dump out the signature construction information, with no task execution. The SIGNATURE_HANDLER parameter is passed to the handler. Two common values are none and printdiff but the handler may define more/less. none means only dump the signature, printdiff means compare the dumped signature with the cached one.", - action = "append", dest = "dump_signatures", default = [], metavar="SIGNATURE_HANDLER") + parser.add_option("-S", "--dump-signatures", help="Dump out the signature construction information, with no task execution. The SIGNATURE_HANDLER parameter is passed to the handler. Two common values are none and printdiff but the handler may define more/less. none means only dump the signature, printdiff means compare the dumped signature with the cached one.", + action="append", dest="dump_signatures", default=[], metavar="SIGNATURE_HANDLER") - parser.add_option("-p", "--parse-only", help = "Quit after parsing the BB recipes.", - action = "store_true", dest = "parse_only", default = False) + parser.add_option("-p", "--parse-only", help="Quit after parsing the BB recipes.", + action="store_true", dest="parse_only", default=False) - parser.add_option("-s", "--show-versions", help = "Show current and preferred versions of all recipes.", - action = "store_true", dest = "show_versions", default = False) + parser.add_option("-s", "--show-versions", help="Show current and preferred versions of all recipes.", + action="store_true", dest="show_versions", default=False) - parser.add_option("-e", "--environment", help = "Show the global or per-recipe environment complete with information about where variables were set/changed.", - action = "store_true", dest = "show_environment", default = False) + parser.add_option("-e", "--environment", help="Show the global or per-recipe environment complete with information about where variables were set/changed.", + action="store_true", dest="show_environment", default=False) - parser.add_option("-g", "--graphviz", help = "Save dependency tree information for the specified targets in the dot syntax.", - action = "store_true", dest = "dot_graph", default = False) + parser.add_option("-g", "--graphviz", help="Save dependency tree information for the specified targets in the dot syntax.", + action="store_true", dest="dot_graph", default=False) - parser.add_option("-I", "--ignore-deps", help = """Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""", - action = "append", dest = "extra_assume_provided", default = []) + parser.add_option("-I", "--ignore-deps", help="""Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""", + action="append", dest="extra_assume_provided", default=[]) - parser.add_option("-l", "--log-domains", help = """Show debug logging for the specified logging domains""", - action = "append", dest = "debug_domains", default = []) + parser.add_option("-l", "--log-domains", help="""Show debug logging for the specified logging domains""", + action="append", dest="debug_domains", default=[]) - parser.add_option("-P", "--profile", help = "Profile the command and save reports.", - action = "store_true", dest = "profile", default = False) + parser.add_option("-P", "--profile", help="Profile the command and save reports.", + action="store_true", dest="profile", default=False) # @CHOICES@ is substituted out by BitbakeHelpFormatter above - parser.add_option("-u", "--ui", help = "The user interface to use (@CHOICES@ - default %default).", + parser.add_option("-u", "--ui", help="The user interface to use (@CHOICES@ - default %default).", action="store", dest="ui", default=os.environ.get('BITBAKE_UI', 'knotty')) # @CHOICES@ is substituted out by BitbakeHelpFormatter above - parser.add_option("-t", "--servertype", help = "Choose which server type to use (@CHOICES@ - default %default).", - action = "store", dest = "servertype", default = ["process", "xmlrpc"]["BBSERVER" in os.environ]) + parser.add_option("-t", "--servertype", help="Choose which server type to use (@CHOICES@ - default %default).", + action="store", dest="servertype", default=["process", "xmlrpc"]["BBSERVER" in os.environ]) - parser.add_option("", "--token", help = "Specify the connection token to be used when connecting to a remote server.", - action = "store", dest = "xmlrpctoken", default = os.environ.get("BBTOKEN")) + parser.add_option("", "--token", help="Specify the connection token to be used when connecting to a remote server.", + action="store", dest="xmlrpctoken", default=os.environ.get("BBTOKEN")) - parser.add_option("", "--revisions-changed", help = "Set the exit code depending on whether upstream floating revisions have changed or not.", - action = "store_true", dest = "revisions_changed", default = False) + parser.add_option("", "--revisions-changed", help="Set the exit code depending on whether upstream floating revisions have changed or not.", + action="store_true", dest="revisions_changed", default=False) - parser.add_option("", "--server-only", help = "Run bitbake without a UI, only starting a server (cooker) process.", - action = "store_true", dest = "server_only", default = False) + parser.add_option("", "--server-only", help="Run bitbake without a UI, only starting a server (cooker) process.", + action="store_true", dest="server_only", default=False) - parser.add_option("-B", "--bind", help = "The name/address for the bitbake server to bind to.", - action = "store", dest = "bind", default = False) + parser.add_option("-B", "--bind", help="The name/address for the bitbake server to bind to.", + action="store", dest="bind", default=False) - parser.add_option("", "--no-setscene", help = "Do not run any setscene tasks. sstate will be ignored and everything needed, built.", - action = "store_true", dest = "nosetscene", default = False) + parser.add_option("", "--no-setscene", help="Do not run any setscene tasks. sstate will be ignored and everything needed, built.", + action="store_true", dest="nosetscene", default=False) - parser.add_option("", "--setscene-only", help = "Only run setscene tasks, don't run any real tasks.", - action = "store_true", dest = "setsceneonly", default = False) + parser.add_option("", "--setscene-only", help="Only run setscene tasks, don't run any real tasks.", + action="store_true", dest="setsceneonly", default=False) - parser.add_option("", "--remote-server", help = "Connect to the specified server.", - action = "store", dest = "remote_server", default = os.environ.get("BBSERVER")) + parser.add_option("", "--remote-server", help="Connect to the specified server.", + action="store", dest="remote_server", default=os.environ.get("BBSERVER")) - parser.add_option("-m", "--kill-server", help = "Terminate the remote server.", - action = "store_true", dest = "kill_server", default = False) + parser.add_option("-m", "--kill-server", help="Terminate the remote server.", + action="store_true", dest="kill_server", default=False) - parser.add_option("", "--observe-only", help = "Connect to a server as an observing-only client.", - action = "store_true", dest = "observe_only", default = False) + parser.add_option("", "--observe-only", help="Connect to a server as an observing-only client.", + action="store_true", dest="observe_only", default=False) - parser.add_option("", "--status-only", help = "Check the status of the remote bitbake server.", - action = "store_true", dest = "status_only", default = False) + parser.add_option("", "--status-only", help="Check the status of the remote bitbake server.", + action="store_true", dest="status_only", default=False) - parser.add_option("-w", "--write-log", help = "Writes the event log of the build to a bitbake event json file. Use '' (empty string) to assign the name automatically.", - action = "store", dest = "writeeventlog", default = os.environ.get("BBEVENTLOG")) + parser.add_option("-w", "--write-log", help="Writes the event log of the build to a bitbake event json file. Use '' (empty string) to assign the name automatically.", + action="store", dest="writeeventlog", default=os.environ.get("BBEVENTLOG")) options, targets = parser.parse_args(argv)
@@ -280,7 +280,7 @@ def start_server(servermodule, configParams, configuration, features): if configParams.bind: (host, port) = configParams.bind.split(':') server.initServer((host, int(port)), single_use) - configuration.interface = [ server.serverImpl.host, server.serverImpl.port ] + configuration.interface = [server.serverImpl.host, server.serverImpl.port] else: server.initServer(single_use=single_use) configuration.interface = []
@@ -342,7 +342,7 @@ def bitbake_main(configParams, configuration): if configParams.remote_server: raise BBMainException("FATAL: The '--server-only' option conflicts with %s.\n" % ("the BBSERVER environment variable" if "BBSERVER" in os.environ \ - else "the '--remote-server' option" )) + else "the '--remote-server' option")) if configParams.bind and configParams.servertype != "xmlrpc": raise BBMainException("FATAL: If '-B' or '--bind' is defined, we must "
Signature · 1 line
2.1.4
PATCH 2/4 bitbake: main: fix bad-continuation warnings
Fixed pylint warning 'Wrong continued indentation'.
--- bitbake/lib/bb/main.py | 135 +++++++++++++++++++++++++------------------------ 1 file changed, 69 insertions(+), 66 deletions(-)
bitbake/lib/bb/main.py +69 -66
@@ -137,103 +137,106 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): It is assumed there is a conf/bblayers.conf available in cwd or in BBPATH which will provide the layer, BBFILES and other configuration information.""") - parser.add_option("-b", "--buildfile", help="Execute tasks from a specific .bb recipe directly. WARNING: Does not handle any dependencies from other recipes.", - action="store", dest="buildfile", default=None) + parser.add_option("-b", "--buildfile", action="store", dest="buildfile", default=None, + help="Execute tasks from a specific .bb recipe directly. WARNING: Does not handle any dependencies from other recipes.") + parser.add_option("-k", "--continue", action="store_false", dest="abort", default=True, + help="Continue as much as possible after an error. While the target that failed and anything depending on it cannot be built, as much as possible will be built before stopping.") - parser.add_option("-k", "--continue", help="Continue as much as possible after an error. While the target that failed and anything depending on it cannot be built, as much as possible will be built before stopping.", - action="store_false", dest="abort", default=True) + parser.add_option("-a", "--tryaltconfigs", action="store_true", dest="tryaltconfigs", default=False, + help="Continue with builds by trying to use alternative providers where possible.") - parser.add_option("-a", "--tryaltconfigs", help="Continue with builds by trying to use alternative providers where possible.", - action="store_true", dest="tryaltconfigs", default=False) + parser.add_option("-f", "--force", action="store_true", dest="force", default=False, + help="Force the specified targets/task to run (invalidating any existing stamp file).") - parser.add_option("-f", "--force", help="Force the specified targets/task to run (invalidating any existing stamp file).", - action="store_true", dest="force", default=False) + parser.add_option("-c", "--cmd", action="store", dest="cmd", + help="Specify the task to execute. The exact options available depend on the metadata. Some examples might be 'compile' or 'populate_sysroot' or 'listtasks' may give a list of the tasks available.") - parser.add_option("-c", "--cmd", help="Specify the task to execute. The exact options available depend on the metadata. Some examples might be 'compile' or 'populate_sysroot' or 'listtasks' may give a list of the tasks available.", - action="store", dest="cmd") + parser.add_option("-C", "--clear-stamp", action="store", dest="invalidate_stamp", + help="Invalidate the stamp for the specified task such as 'compile' and then run the default task for the specified target(s).") - parser.add_option("-C", "--clear-stamp", help="Invalidate the stamp for the specified task such as 'compile' and then run the default task for the specified target(s).", - action="store", dest="invalidate_stamp") + parser.add_option("-r", "--read", action="append", dest="prefile", default=[], + help="Read the specified file before bitbake.conf.") - parser.add_option("-r", "--read", help="Read the specified file before bitbake.conf.", - action="append", dest="prefile", default=[]) + parser.add_option("-R", "--postread", action="append", dest="postfile", default=[], + help="Read the specified file after bitbake.conf.") - parser.add_option("-R", "--postread", help="Read the specified file after bitbake.conf.", - action="append", dest="postfile", default=[]) + parser.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, + help="Output more log message data to the terminal.") - parser.add_option("-v", "--verbose", help="Output more log message data to the terminal.", - action="store_true", dest="verbose", default=False) + parser.add_option("-D", "--debug", action="count", dest="debug", default=0, + help="Increase the debug level. You can specify this more than once.") - parser.add_option("-D", "--debug", help="Increase the debug level. You can specify this more than once.", - action="count", dest="debug", default=0) + parser.add_option("-n", "--dry-run", action="store_true", dest="dry_run", default=False, + help="Don't execute, just go through the motions.") - parser.add_option("-n", "--dry-run", help="Don't execute, just go through the motions.", - action="store_true", dest="dry_run", default=False) + parser.add_option("-S", "--dump-signatures", action="append", dest="dump_signatures", + default=[], metavar="SIGNATURE_HANDLER", + help="Dump out the signature construction information, with no task execution. The SIGNATURE_HANDLER parameter is passed to the handler. Two common values are none and printdiff but the handler may define more/less. none means only dump the signature, printdiff means compare the dumped signature with the cached one.") - parser.add_option("-S", "--dump-signatures", help="Dump out the signature construction information, with no task execution. The SIGNATURE_HANDLER parameter is passed to the handler. Two common values are none and printdiff but the handler may define more/less. none means only dump the signature, printdiff means compare the dumped signature with the cached one.", - action="append", dest="dump_signatures", default=[], metavar="SIGNATURE_HANDLER") + parser.add_option("-p", "--parse-only", action="store_true", dest="parse_only", default=False, + help="Quit after parsing the BB recipes.") - parser.add_option("-p", "--parse-only", help="Quit after parsing the BB recipes.", - action="store_true", dest="parse_only", default=False) + parser.add_option("-s", "--show-versions", action="store_true", dest="show_versions", default=False, + help="Show current and preferred versions of all recipes.") - parser.add_option("-s", "--show-versions", help="Show current and preferred versions of all recipes.", - action="store_true", dest="show_versions", default=False) + parser.add_option("-e", "--environment", action="store_true", dest="show_environment", default=False, + help="Show the global or per-recipe environment complete with information about where variables were set/changed.") - parser.add_option("-e", "--environment", help="Show the global or per-recipe environment complete with information about where variables were set/changed.", - action="store_true", dest="show_environment", default=False) + parser.add_option("-g", "--graphviz", action="store_true", dest="dot_graph", default=False, + help="Save dependency tree information for the specified targets in the dot syntax.") - parser.add_option("-g", "--graphviz", help="Save dependency tree information for the specified targets in the dot syntax.", - action="store_true", dest="dot_graph", default=False) + parser.add_option("-I", "--ignore-deps", action="append", dest="extra_assume_provided", default=[], + help="""Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""") - parser.add_option("-I", "--ignore-deps", help="""Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""", - action="append", dest="extra_assume_provided", default=[]) + parser.add_option("-l", "--log-domains", action="append", dest="debug_domains", default=[], + help="""Show debug logging for the specified logging domains""") - parser.add_option("-l", "--log-domains", help="""Show debug logging for the specified logging domains""", - action="append", dest="debug_domains", default=[]) - - parser.add_option("-P", "--profile", help="Profile the command and save reports.", - action="store_true", dest="profile", default=False) + parser.add_option("-P", "--profile", action="store_true", dest="profile", default=False, + help="Profile the command and save reports.") # @CHOICES@ is substituted out by BitbakeHelpFormatter above - parser.add_option("-u", "--ui", help="The user interface to use (@CHOICES@ - default %default).", - action="store", dest="ui", default=os.environ.get('BITBAKE_UI', 'knotty')) + parser.add_option("-u", "--ui", action="store", dest="ui", default=os.environ.get('BITBAKE_UI', 'knotty'), + help="The user interface to use (@CHOICES@ - default %default).") # @CHOICES@ is substituted out by BitbakeHelpFormatter above - parser.add_option("-t", "--servertype", help="Choose which server type to use (@CHOICES@ - default %default).", - action="store", dest="servertype", default=["process", "xmlrpc"]["BBSERVER" in os.environ]) + parser.add_option("-t", "--servertype", action="store", dest="servertype", + default=["process", "xmlrpc"]["BBSERVER" in os.environ], + help="Choose which server type to use (@CHOICES@ - default %default).") - parser.add_option("", "--token", help="Specify the connection token to be used when connecting to a remote server.", - action="store", dest="xmlrpctoken", default=os.environ.get("BBTOKEN")) + parser.add_option("", "--token", action="store", dest="xmlrpctoken", default=os.environ.get("BBTOKEN"), + help="Specify the connection token to be used when connecting to a remote server.") - parser.add_option("", "--revisions-changed", help="Set the exit code depending on whether upstream floating revisions have changed or not.", - action="store_true", dest="revisions_changed", default=False) + parser.add_option("", "--revisions-changed", action="store_true", dest="revisions_changed", default=False, + help="Set the exit code depending on whether upstream floating revisions have changed or not.") - parser.add_option("", "--server-only", help="Run bitbake without a UI, only starting a server (cooker) process.", - action="store_true", dest="server_only", default=False) + parser.add_option("", "--server-only", action="store_true", dest="server_only", default=False, + help="Run bitbake without a UI, only starting a server (cooker) process.") - parser.add_option("-B", "--bind", help="The name/address for the bitbake server to bind to.", - action="store", dest="bind", default=False) + parser.add_option("-B", "--bind", action="store", dest="bind", default=False, + help="The name/address for the bitbake server to bind to.") - parser.add_option("", "--no-setscene", help="Do not run any setscene tasks. sstate will be ignored and everything needed, built.", - action="store_true", dest="nosetscene", default=False) + parser.add_option("", "--no-setscene", action="store_true", dest="nosetscene", default=False, + help="Do not run any setscene tasks. sstate will be ignored and everything needed, built.") - parser.add_option("", "--setscene-only", help="Only run setscene tasks, don't run any real tasks.", - action="store_true", dest="setsceneonly", default=False) + parser.add_option("", "--setscene-only", action="store_true", dest="setsceneonly", default=False, + help="Only run setscene tasks, don't run any real tasks.") - parser.add_option("", "--remote-server", help="Connect to the specified server.", - action="store", dest="remote_server", default=os.environ.get("BBSERVER")) + parser.add_option("", "--remote-server", action="store", dest="remote_server", + default=os.environ.get("BBSERVER"), + help="Connect to the specified server.") - parser.add_option("-m", "--kill-server", help="Terminate the remote server.", - action="store_true", dest="kill_server", default=False) + parser.add_option("-m", "--kill-server", action="store_true", dest="kill_server", default=False, + help="Terminate the remote server.") - parser.add_option("", "--observe-only", help="Connect to a server as an observing-only client.", - action="store_true", dest="observe_only", default=False) + parser.add_option("", "--observe-only", action="store_true", dest="observe_only", default=False, + help="Connect to a server as an observing-only client.") - parser.add_option("", "--status-only", help="Check the status of the remote bitbake server.", - action="store_true", dest="status_only", default=False) + parser.add_option("", "--status-only", action="store_true", dest="status_only", default=False, + help="Check the status of the remote bitbake server.") - parser.add_option("-w", "--write-log", help="Writes the event log of the build to a bitbake event json file. Use '' (empty string) to assign the name automatically.", - action="store", dest="writeeventlog", default=os.environ.get("BBEVENTLOG")) + parser.add_option("-w", "--write-log", action="store", dest="writeeventlog", + default=os.environ.get("BBEVENTLOG"), + help="Writes the event log of the build to a bitbake event json file. Use '' (empty string) to assign the name automatically.") options, targets = parser.parse_args(argv)
@@ -365,7 +368,7 @@ def bitbake_main(configParams, configuration): configuration.debug = level bb.msg.init_msgconfig(configParams.verbose, configuration.debug, - configuration.debug_domains) + configuration.debug_domains) # Ensure logging messages get sent to the UI as events handler = bb.event.LogHandler()
Signature · 1 line
2.1.4
PATCH 3/4 bitake: main: fix line-too-long pytling warnings
In reply to Ed BartoshWrapped long lines to fix "Line too long" pylint warnings.
--- bitbake/lib/bb/main.py | 121 +++++++++++++++++++++++++++++++++---------------- 1 file changed, 82 insertions(+), 39 deletions(-)
bitbake/lib/bb/main.py +82 -39
@@ -103,8 +103,9 @@ def import_extension_module(pkg, modulename, checkattr): module = __import__(pkg.__name__, fromlist=[modulename]) return getattr(module, modulename) except AttributeError: - raise BBMainException('FATAL: Unable to import extension module "%s" from %s. Valid extension modules: %s' % (modulename, pkg.__name__, present_options(list_extension_modules(pkg, checkattr)))) - + modules = present_options(list_extension_modules(pkg, checkattr)) + raise BBMainException('FATAL: Unable to import extension module "%s" from %s. ' + 'Valid extension modules: %s' % (modulename, pkg.__name__, modules)) # Display bitbake/OE warnings via the BitBake.Warnings logger, ignoring others""" warnlog = logging.getLogger("BitBake.Warnings")
@@ -138,21 +139,32 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): will provide the layer, BBFILES and other configuration information.""") parser.add_option("-b", "--buildfile", action="store", dest="buildfile", default=None, - help="Execute tasks from a specific .bb recipe directly. WARNING: Does not handle any dependencies from other recipes.") + help="Execute tasks from a specific .bb recipe directly. WARNING: Does " + "not handle any dependencies from other recipes.") + parser.add_option("-k", "--continue", action="store_false", dest="abort", default=True, - help="Continue as much as possible after an error. While the target that failed and anything depending on it cannot be built, as much as possible will be built before stopping.") + help="Continue as much as possible after an error. While the target that " + "failed and anything depending on it cannot be built, as much as " + "possible will be built before stopping.") - parser.add_option("-a", "--tryaltconfigs", action="store_true", dest="tryaltconfigs", default=False, - help="Continue with builds by trying to use alternative providers where possible.") + parser.add_option("-a", "--tryaltconfigs", action="store_true", + dest="tryaltconfigs", default=False, + help="Continue with builds by trying to use alternative providers " + "where possible.") parser.add_option("-f", "--force", action="store_true", dest="force", default=False, - help="Force the specified targets/task to run (invalidating any existing stamp file).") + help="Force the specified targets/task to run (invalidating any " + "existing stamp file).") parser.add_option("-c", "--cmd", action="store", dest="cmd", - help="Specify the task to execute. The exact options available depend on the metadata. Some examples might be 'compile' or 'populate_sysroot' or 'listtasks' may give a list of the tasks available.") + help="Specify the task to execute. The exact options available " + "depend on the metadata. Some examples might be 'compile'" + " or 'populate_sysroot' or 'listtasks' may give a list of " + "the tasks available.") parser.add_option("-C", "--clear-stamp", action="store", dest="invalidate_stamp", - help="Invalidate the stamp for the specified task such as 'compile' and then run the default task for the specified target(s).") + help="Invalidate the stamp for the specified task such as 'compile' " + "and then run the default task for the specified target(s).") parser.add_option("-r", "--read", action="append", dest="prefile", default=[], help="Read the specified file before bitbake.conf.")
@@ -171,31 +183,44 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): parser.add_option("-S", "--dump-signatures", action="append", dest="dump_signatures", default=[], metavar="SIGNATURE_HANDLER", - help="Dump out the signature construction information, with no task execution. The SIGNATURE_HANDLER parameter is passed to the handler. Two common values are none and printdiff but the handler may define more/less. none means only dump the signature, printdiff means compare the dumped signature with the cached one.") - - parser.add_option("-p", "--parse-only", action="store_true", dest="parse_only", default=False, + help="Dump out the signature construction information, with no task " + "execution. The SIGNATURE_HANDLER parameter is passed to the " + "handler. Two common values are none and printdiff but the handler " + "may define more/less. none means only dump the signature, printdiff" + " means compare the dumped signature with the cached one.") + + parser.add_option("-p", "--parse-only", action="store_true", + dest="parse_only", default=False, help="Quit after parsing the BB recipes.") - parser.add_option("-s", "--show-versions", action="store_true", dest="show_versions", default=False, + parser.add_option("-s", "--show-versions", action="store_true", + dest="show_versions", default=False, help="Show current and preferred versions of all recipes.") - parser.add_option("-e", "--environment", action="store_true", dest="show_environment", default=False, - help="Show the global or per-recipe environment complete with information about where variables were set/changed.") + parser.add_option("-e", "--environment", action="store_true", + dest="show_environment", default=False, + help="Show the global or per-recipe environment complete with information" + " about where variables were set/changed.") parser.add_option("-g", "--graphviz", action="store_true", dest="dot_graph", default=False, - help="Save dependency tree information for the specified targets in the dot syntax.") + help="Save dependency tree information for the specified " + "targets in the dot syntax.") - parser.add_option("-I", "--ignore-deps", action="append", dest="extra_assume_provided", default=[], - help="""Assume these dependencies don't exist and are already provided (equivalent to ASSUME_PROVIDED). Useful to make dependency graphs more appealing""") + parser.add_option("-I", "--ignore-deps", action="append", + dest="extra_assume_provided", default=[], + help="Assume these dependencies don't exist and are already provided " + "(equivalent to ASSUME_PROVIDED). Useful to make dependency " + "graphs more appealing") parser.add_option("-l", "--log-domains", action="append", dest="debug_domains", default=[], - help="""Show debug logging for the specified logging domains""") + help="Show debug logging for the specified logging domains") parser.add_option("-P", "--profile", action="store_true", dest="profile", default=False, help="Profile the command and save reports.") # @CHOICES@ is substituted out by BitbakeHelpFormatter above - parser.add_option("-u", "--ui", action="store", dest="ui", default=os.environ.get('BITBAKE_UI', 'knotty'), + parser.add_option("-u", "--ui", action="store", dest="ui", + default=os.environ.get('BITBAKE_UI', 'knotty'), help="The user interface to use (@CHOICES@ - default %default).") # @CHOICES@ is substituted out by BitbakeHelpFormatter above
@@ -203,40 +228,53 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): default=["process", "xmlrpc"]["BBSERVER" in os.environ], help="Choose which server type to use (@CHOICES@ - default %default).") - parser.add_option("", "--token", action="store", dest="xmlrpctoken", default=os.environ.get("BBTOKEN"), - help="Specify the connection token to be used when connecting to a remote server.") + parser.add_option("", "--token", action="store", dest="xmlrpctoken", + default=os.environ.get("BBTOKEN"), + help="Specify the connection token to be used when connecting " + "to a remote server.") - parser.add_option("", "--revisions-changed", action="store_true", dest="revisions_changed", default=False, - help="Set the exit code depending on whether upstream floating revisions have changed or not.") + parser.add_option("", "--revisions-changed", action="store_true", + dest="revisions_changed", default=False, + help="Set the exit code depending on whether upstream floating " + "revisions have changed or not.") - parser.add_option("", "--server-only", action="store_true", dest="server_only", default=False, - help="Run bitbake without a UI, only starting a server (cooker) process.") + parser.add_option("", "--server-only", action="store_true", + dest="server_only", default=False, + help="Run bitbake without a UI, only starting a server " + "(cooker) process.") parser.add_option("-B", "--bind", action="store", dest="bind", default=False, help="The name/address for the bitbake server to bind to.") - parser.add_option("", "--no-setscene", action="store_true", dest="nosetscene", default=False, - help="Do not run any setscene tasks. sstate will be ignored and everything needed, built.") + parser.add_option("", "--no-setscene", action="store_true", + dest="nosetscene", default=False, + help="Do not run any setscene tasks. sstate will be ignored and " + "everything needed, built.") - parser.add_option("", "--setscene-only", action="store_true", dest="setsceneonly", default=False, + parser.add_option("", "--setscene-only", action="store_true", + dest="setsceneonly", default=False, help="Only run setscene tasks, don't run any real tasks.") parser.add_option("", "--remote-server", action="store", dest="remote_server", default=os.environ.get("BBSERVER"), help="Connect to the specified server.") - parser.add_option("-m", "--kill-server", action="store_true", dest="kill_server", default=False, + parser.add_option("-m", "--kill-server", action="store_true", + dest="kill_server", default=False, help="Terminate the remote server.") - parser.add_option("", "--observe-only", action="store_true", dest="observe_only", default=False, + parser.add_option("", "--observe-only", action="store_true", + dest="observe_only", default=False, help="Connect to a server as an observing-only client.") - parser.add_option("", "--status-only", action="store_true", dest="status_only", default=False, + parser.add_option("", "--status-only", action="store_true", + dest="status_only", default=False, help="Check the status of the remote bitbake server.") parser.add_option("-w", "--write-log", action="store", dest="writeeventlog", default=os.environ.get("BBEVENTLOG"), - help="Writes the event log of the build to a bitbake event json file. Use '' (empty string) to assign the name automatically.") + help="Writes the event log of the build to a bitbake event json file. " + "Use '' (empty string) to assign the name automatically.") options, targets = parser.parse_args(argv)
@@ -249,8 +287,9 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): # fill in proper log name if not supplied if options.writeeventlog is not None and len(options.writeeventlog) == 0: - import datetime - options.writeeventlog = "bitbake_eventlog_%s.json" % datetime.datetime.now().strftime("%Y%m%d%H%M%S") + from datetime import datetime + eventlog = "bitbake_eventlog_%s.json" % datetime.now().strftime("%Y%m%d%H%M%S") + options.writeeventlog = eventlog # if BBSERVER says to autodetect, let's do that if options.remote_server:
@@ -360,7 +399,8 @@ def bitbake_main(configParams, configuration): "connecting to a server.\n") if configParams.kill_server and not configParams.remote_server: - raise BBMainException("FATAL: '--kill-server' can only be used to terminate a remote server") + raise BBMainException("FATAL: '--kill-server' can only be used to " + "terminate a remote server") if "BBDEBUG" in os.environ: level = int(os.environ["BBDEBUG"])
@@ -397,7 +437,8 @@ def bitbake_main(configParams, configuration): bb.event.ui_queue = [] else: # we start a stub server that is actually a XMLRPClient that connects to a real server - server = servermodule.BitBakeXMLRPCClient(configParams.observe_only, configParams.xmlrpctoken) + server = servermodule.BitBakeXMLRPCClient(configParams.observe_only, + configParams.xmlrpctoken) server.saveConnectionDetails(configParams.remote_server)
@@ -426,12 +467,14 @@ def bitbake_main(configParams, configuration): return 0 try: - return ui_module.main(server_connection.connection, server_connection.events, configParams) + return ui_module.main(server_connection.connection, server_connection.events, + configParams) finally: bb.event.ui_queue = [] server_connection.terminate() else: - print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host, server.serverImpl.port)) + print("Bitbake server address: %s, server port: %s" % (server.serverImpl.host, + server.serverImpl.port)) return 0 return 1
Signature · 1 line
2.1.4
PATCH 4/4 bitbake: main: fix invalid variable names
In reply to Ed BartoshFixed the follwoing pylint warnings:
C:118, 8: Invalid variable name "s" (invalid-name) C:307,20: Invalid variable name "lf" (invalid-name) C:313,36: Invalid variable name "e" (invalid-name) C:319, 0: Invalid argument name "configParams" (invalid-name) C:337,24: Invalid variable name "e" (invalid-name) C:356, 0: Invalid argument name "configParams" (invalid-name) C:447,28: Invalid variable name "e" (invalid-name)
--- bitbake/lib/bb/main.py | 81 +++++++++++++++++++++++++------------------------- 1 file changed, 41 insertions(+), 40 deletions(-)
bitbake/lib/bb/main.py +41 -40
@@ -115,8 +115,8 @@ def _showwarning(message, category, filename, lineno, file=None, line=None): if _warnings_showwarning is not None: _warnings_showwarning(message, category, filename, lineno, file, line) else: - s = warnings.formatwarning(message, category, filename, lineno) - warnlog.warn(s) + warning = warnings.formatwarning(message, category, filename, lineno) + warnlog.warn(warning) warnings.showwarning = _showwarning warnings.filterwarnings("ignore")
@@ -304,23 +304,24 @@ class BitBakeConfigParameters(cookerdata.ConfigParameters): # we try to read the address at all times; if the server is not started, # we'll try to start it after the first connect fails, below try: - lf = open(lock_location, 'r') - remotedef = lf.readline() + lockf = open(lock_location, 'r') + remotedef = lockf.readline() [host, port] = remotedef.split(":") port = int(port) - lf.close() + lockf.close() options.remote_server = remotedef - except Exception as e: - raise BBMainException("Failed to read bitbake.lock (%s), invalid port" % str(e)) + except Exception as err: + raise BBMainException("Failed to read bitbake.lock (%s), " + "invalid port" % str(err)) return options, targets[1:] -def start_server(servermodule, configParams, configuration, features): +def start_server(servermodule, configparams, configuration, features): server = servermodule.BitBakeServer() - single_use = not configParams.server_only - if configParams.bind: - (host, port) = configParams.bind.split(':') + single_use = not configparams.server_only + if configparams.bind: + (host, port) = configparams.bind.split(':') server.initServer((host, int(port)), single_use) configuration.interface = [server.serverImpl.host, server.serverImpl.port] else:
@@ -334,7 +335,7 @@ def start_server(servermodule, configParams, configuration, features): server.addcooker(cooker) server.saveConnectionDetails() - except Exception as e: + except Exception: exc_info = sys.exc_info() while hasattr(server, "event_queue"): try:
@@ -353,7 +354,7 @@ def start_server(servermodule, configParams, configuration, features): return server -def bitbake_main(configParams, configuration): +def bitbake_main(configparams, configuration): # Python multiprocessing requires /dev/shm on Linux if sys.platform.startswith('linux') and not os.access('/dev/shm', os.W_OK | os.X_OK):
@@ -369,36 +370,36 @@ def bitbake_main(configParams, configuration): pass - configuration.setConfigParameters(configParams) + configuration.setConfigParameters(configparams) - ui_module = import_extension_module(bb.ui, configParams.ui, 'main') - servermodule = import_extension_module(bb.server, configParams.servertype, 'BitBakeServer') + ui_module = import_extension_module(bb.ui, configparams.ui, 'main') + servermodule = import_extension_module(bb.server, configparams.servertype, 'BitBakeServer') - if configParams.server_only: - if configParams.servertype != "xmlrpc": + if configparams.server_only: + if configparams.servertype != "xmlrpc": raise BBMainException("FATAL: If '--server-only' is defined, we must set the " "servertype as 'xmlrpc'.\n") - if not configParams.bind: + if not configparams.bind: raise BBMainException("FATAL: The '--server-only' option requires a name/address " "to bind to with the -B option.\n") - if configParams.remote_server: + if configparams.remote_server: raise BBMainException("FATAL: The '--server-only' option conflicts with %s.\n" % ("the BBSERVER environment variable" if "BBSERVER" in os.environ \ else "the '--remote-server' option")) - if configParams.bind and configParams.servertype != "xmlrpc": + if configparams.bind and configparams.servertype != "xmlrpc": raise BBMainException("FATAL: If '-B' or '--bind' is defined, we must " "set the servertype as 'xmlrpc'.\n") - if configParams.remote_server and configParams.servertype != "xmlrpc": + if configparams.remote_server and configparams.servertype != "xmlrpc": raise BBMainException("FATAL: If '--remote-server' is defined, we must " "set the servertype as 'xmlrpc'.\n") - if configParams.observe_only and (not configParams.remote_server or configParams.bind): + if configparams.observe_only and (not configparams.remote_server or configparams.bind): raise BBMainException("FATAL: '--observe-only' can only be used by UI clients " "connecting to a server.\n") - if configParams.kill_server and not configParams.remote_server: + if configparams.kill_server and not configparams.remote_server: raise BBMainException("FATAL: '--kill-server' can only be used to " "terminate a remote server")
@@ -407,12 +408,12 @@ def bitbake_main(configParams, configuration): if level > configuration.debug: configuration.debug = level - bb.msg.init_msgconfig(configParams.verbose, configuration.debug, + bb.msg.init_msgconfig(configparams.verbose, configuration.debug, configuration.debug_domains) # Ensure logging messages get sent to the UI as events handler = bb.event.LogHandler() - if not configParams.status_only: + if not configparams.status_only: # In status only mode there are no logs and no UI logger.addHandler(handler)
@@ -420,35 +421,35 @@ def bitbake_main(configParams, configuration): cleanedvars = bb.utils.clean_environment() featureset = [] - if not configParams.server_only: + if not configparams.server_only: # Collect the feature set for the UI featureset = getattr(ui_module, "featureSet", []) - if configParams.server_only: + if configparams.server_only: for param in ('prefile', 'postfile'): - value = getattr(configParams, param) + value = getattr(configparams, param) if value: setattr(configuration, "%s_server" % param, value) param = "%s_server" % param - if not configParams.remote_server: + if not configparams.remote_server: # we start a server with a given configuration - server = start_server(servermodule, configParams, configuration, featureset) + server = start_server(servermodule, configparams, configuration, featureset) bb.event.ui_queue = [] else: # we start a stub server that is actually a XMLRPClient that connects to a real server - server = servermodule.BitBakeXMLRPCClient(configParams.observe_only, - configParams.xmlrpctoken) - server.saveConnectionDetails(configParams.remote_server) + server = servermodule.BitBakeXMLRPCClient(configparams.observe_only, + configparams.xmlrpctoken) + server.saveConnectionDetails(configparams.remote_server) - if not configParams.server_only: + if not configparams.server_only: try: server_connection = server.establishConnection(featureset) - except Exception as e: - bb.fatal("Could not connect to server %s: %s" % (configParams.remote_server, str(e))) + except Exception as err: + bb.fatal("Could not connect to server %s: %s" % (configparams.remote_server, str(err))) - if configParams.kill_server: + if configparams.kill_server: server_connection.connection.terminateServer() bb.event.ui_queue = [] return 0
@@ -462,13 +463,13 @@ def bitbake_main(configParams, configuration): logger.removeHandler(handler) - if configParams.status_only: + if configparams.status_only: server_connection.terminate() return 0 try: return ui_module.main(server_connection.connection, server_connection.events, - configParams) + configparams) finally: bb.event.ui_queue = [] server_connection.terminate()
Signature · 1 line
2.1.4
This patchset triggered a lively discussion between a few of us about whether we should or shouldn't make whitespace changes to the codebase.
There is one viewpoint which is that we should state we're aiming for PEP8 and modify the codebase to match.
Unfortunately there are pieces of API and conventions we have which do make sense for us and don't match PEP8. For example the use of "d" as our datastore variable (its a short variable name) or the camelcase in the datastore methods (getVarFlag) which happens to have worked really well for the variable dependency analysis.
Personally, I also really don't like unnecessary changes in the history so that git blame and code annotation get distorted to the whitespace change commits. I probably spend more time doing that than most.
My general thought is that we should aim for something PEP8 like, particularly around argument and keyword spacing. I'd prefer to do this as we add new code or modify existing code and I have been doing that in my own changes for a while to try and improve consistency.
That said, I personally don't get worked up about line length limits and even the short variable names aren't that bad, *if* they're limited in scope to a handful of lines or follow a codebase wide convention (fn is filename, lf is lockfile, e is exception are the main bitbake ones that come to mind).
So my feeling is we continue to try and improve the style but not go as far as large whitespace changes just for the sake of it.
There are some sections which might be worth considering such as Ed's changes here to the continuation and line too long pieces of main.py specifically as it is currently a mess. I think the short variable change may actually confuse some conventions more than fixing them though.
Certainly I don't want to see a ton of "PEP8" style cosmetic patches hitting the list.
Cheers,
Richard
Quoted 21 lines · Richard Purdie
This patchset triggered a lively discussion between a few of us about whether we should or shouldn't make whitespace changes to the codebase.
There is one viewpoint which is that we should state we're aiming for PEP8 and modify the codebase to match.
Unfortunately there are pieces of API and conventions we have which do make sense for us and don't match PEP8. For example the use of "d" as our datastore variable (its a short variable name) or the camelcase in the datastore methods (getVarFlag) which happens to have worked really well for the variable dependency analysis.
Personally, I also really don't like unnecessary changes in the history so that git blame and code annotation get distorted to the whitespace change commits. I probably spend more time doing that than most.
My general thought is that we should aim for something PEP8 like, particularly around argument and keyword spacing. I'd prefer to do this as we add new code or modify existing code and I have been doing that in my own changes for a while to try and improve consistency.
Quoted 6 lines
That said, I personally don't get worked up about line length limits and even the short variable names aren't that bad, *if* they're limited in scope to a handful of lines or follow a codebase wide convention (fn is filename, lf is lockfile, e is exception are the main bitbake ones that come to mind).
Indeed, and 'd' of course in many functions. I think there are a number of instances in which short variable names are perfectly valid. List comprehensions, generator expressions, and personally I think it's still reasonable to use 'i' when iterating over a range in some cases.
So my feeling is we continue to try and improve the style but not go as
Quoted 11 lines
far as large whitespace changes just for the sake of it.
There are some sections which might be worth considering such as Ed's changes here to the continuation and line too long pieces of
main.pyspecifically as it is currently a mess. I think the short variable change may actually confuse some conventions more than fixing them though.Certainly I don't want to see a ton of "PEP8" style cosmetic patches hitting the list.
I'd agree with all of this. Personally, I'm a fan of leaving the code better than you found it, rather than doing blanket fixes (admittedly I've been guilty of the latter in the past on a number of occasions, though :), so clean up the areas we're working on for other reasons while we're in the vicinity.
PEP8 specifically outlines that there are valid reasons to deviate from it. See the "A Foolish Consistency is the Hobgoblin of Little Minds" section.
Regarding line length: "Some teams strongly prefer a longer line length. For code maintained exclusively or primarily by a team that can reach agreement on this issue, it is okay to increase the nominal line length from 80 to 100 characters (effectively increasing the maximum length to 99 characters), provided that comments and docstrings are still wrapped at 72 characters."
It's also worth noting that a number of the things pylint recommends really have nothing to do with pep8. I'd advise use of 'pep8' or 'flake8' rather than pylint if you want to avoid potentially unnecessary changes.
Personally, I like to use vim with the syntastic plugin backed by flake8, and fix the things it identifies when I'm modifying a piece of code already.
Signature · 5 lines
Christopher Larson clarson at kergoth dot com Founder - BitBake, OpenEmbedded, OpenZaurus Maintainer - Tslib Senior Software Engineer, Mentor Graphics