diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2015-08-17 12:12:16 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-08-17 14:40:55 +0100 |
commit | 7859f7388f2e3f675d0e1527cfde18625f36f637 (patch) | |
tree | dfc71fa8f3c8d66371d03336731b3015f45caaad /lib/bb/ui/crumbs | |
parent | 8e9bd559c8ef0ebc9e8babbada06e710908bae08 (diff) | |
download | openembedded-core-contrib-7859f7388f2e3f675d0e1527cfde18625f36f637.tar.gz |
Fix default function parameter assignment to a list
With python you should not assign a list as the default value of a
function parameter - because a list is mutable, the result will be that
the first time a value is passed it will actually modify the default.
Reference:
http://docs.python-guide.org/en/latest/writing/gotchas/#mutable-default-arguments
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/ui/crumbs')
-rw-r--r-- | lib/bb/ui/crumbs/hobeventhandler.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/bb/ui/crumbs/hobeventhandler.py b/lib/bb/ui/crumbs/hobeventhandler.py index 43edb70b08..b71fb33d30 100644 --- a/lib/bb/ui/crumbs/hobeventhandler.py +++ b/lib/bb/ui/crumbs/hobeventhandler.py @@ -440,11 +440,17 @@ class HobHandler(gobject.GObject): self.commands_async.append(self.SUB_BUILD_RECIPES) self.run_next_command(self.GENERATE_PACKAGES) - def generate_image(self, image, base_image, image_packages=[], toolchain_packages=[], default_task="build"): + def generate_image(self, image, base_image, image_packages=None, toolchain_packages=None, default_task="build"): self.image = image self.base_image = base_image - self.package_queue = image_packages - self.toolchain_packages = toolchain_packages + if image_packages: + self.package_queue = image_packages + else: + self.package_queue = [] + if toolchain_packages: + self.toolchain_packages = toolchain_packages + else: + self.toolchain_packages = [] self.default_task = default_task self.runCommand(["setPrePostConfFiles", "conf/.hob.conf", ""]) self.commands_async.append(self.SUB_PARSE_CONFIG) |