summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2015-08-17 12:12:16 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-08-19 18:05:44 +0100
commit715d857174ceca82b85d6c8c7df520047ba7fb0c (patch)
tree363aac81a06b013471f1dede8ba4c0dc7d8bbe92 /bitbake/lib/bb/cooker.py
parent22a653d02880c35d3c9d04811c31aabdf1e69951 (diff)
downloadpoky-715d857174ceca82b85d6c8c7df520047ba7fb0c.tar.gz
bitbake: 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 (Bitbake rev: 7859f7388f2e3f675d0e1527cfde18625f36f637) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 0f99342a0f..84bf46b9ee 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -114,12 +114,13 @@ class BBCooker:
114 Manages one bitbake build run 114 Manages one bitbake build run
115 """ 115 """
116 116
117 def __init__(self, configuration, featureSet = []): 117 def __init__(self, configuration, featureSet=None):
118 self.recipecache = None 118 self.recipecache = None
119 self.skiplist = {} 119 self.skiplist = {}
120 self.featureset = CookerFeatures() 120 self.featureset = CookerFeatures()
121 for f in featureSet: 121 if featureSet:
122 self.featureset.setFeature(f) 122 for f in featureSet:
123 self.featureset.setFeature(f)
123 124
124 self.configuration = configuration 125 self.configuration = configuration
125 126
@@ -567,12 +568,14 @@ class BBCooker:
567 568
568 logger.plain("%-35s %25s %25s", p, lateststr, prefstr) 569 logger.plain("%-35s %25s %25s", p, lateststr, prefstr)
569 570
570 def showEnvironment(self, buildfile = None, pkgs_to_build = []): 571 def showEnvironment(self, buildfile=None, pkgs_to_build=None):
571 """ 572 """
572 Show the outer or per-recipe environment 573 Show the outer or per-recipe environment
573 """ 574 """
574 fn = None 575 fn = None
575 envdata = None 576 envdata = None
577 if not pkgs_to_build:
578 pkgs_to_build = []
576 579
577 if buildfile: 580 if buildfile:
578 # Parse the configuration here. We need to do it explicitly here since 581 # Parse the configuration here. We need to do it explicitly here since
@@ -1037,13 +1040,13 @@ class BBCooker:
1037 1040
1038 return pkg_list 1041 return pkg_list
1039 1042
1040 def generateTargetsTree(self, klass=None, pkgs=[]): 1043 def generateTargetsTree(self, klass=None, pkgs=None):
1041 """ 1044 """
1042 Generate a dependency tree of buildable targets 1045 Generate a dependency tree of buildable targets
1043 Generate an event with the result 1046 Generate an event with the result
1044 """ 1047 """
1045 # if the caller hasn't specified a pkgs list default to universe 1048 # if the caller hasn't specified a pkgs list default to universe
1046 if not len(pkgs): 1049 if not pkgs:
1047 pkgs = ['universe'] 1050 pkgs = ['universe']
1048 # if inherited_class passed ensure all recipes which inherit the 1051 # if inherited_class passed ensure all recipes which inherit the
1049 # specified class are included in pkgs 1052 # specified class are included in pkgs