summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cache.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-12 08:30:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-06-02 08:24:02 +0100
commit0f2c59367a649de5f57acdccfb4f1fdba9cde730 (patch)
tree7a3558a3e08e690fbb0b5bdc4044316f9ab4bbcb /bitbake/lib/bb/cache.py
parentef1df516512587ad415f76a9626620992d660e45 (diff)
downloadpoky-0f2c59367a649de5f57acdccfb4f1fdba9cde730.tar.gz
bitbake: bitbake: Convert to python 3
Various misc changes to convert bitbake to python3 which don't warrant separation into separate commits. (Bitbake rev: d0f904d407f57998419bd9c305ce53e5eaa36b24) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/cache.py')
-rw-r--r--bitbake/lib/bb/cache.py18
1 files changed, 6 insertions, 12 deletions
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 393d541744..96abd7141b 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -28,21 +28,15 @@
28# with this program; if not, write to the Free Software Foundation, Inc., 28# with this program; if not, write to the Free Software Foundation, Inc.,
29# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 29# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
30 30
31
32import os 31import os
32import sys
33import logging 33import logging
34import pickle
34from collections import defaultdict 35from collections import defaultdict
35import bb.utils 36import bb.utils
36 37
37logger = logging.getLogger("BitBake.Cache") 38logger = logging.getLogger("BitBake.Cache")
38 39
39try:
40 import cPickle as pickle
41except ImportError:
42 import pickle
43 logger.info("Importing cPickle failed. "
44 "Falling back to a very slow implementation.")
45
46__cache_version__ = "150" 40__cache_version__ = "150"
47 41
48def getCacheFile(path, filename, data_hash): 42def getCacheFile(path, filename, data_hash):
@@ -80,7 +74,7 @@ class RecipeInfoCommon(object):
80 out_dict = dict((var, metadata.getVarFlag(var, flag, True)) 74 out_dict = dict((var, metadata.getVarFlag(var, flag, True))
81 for var in varlist) 75 for var in varlist)
82 if squash: 76 if squash:
83 return dict((k,v) for (k,v) in out_dict.iteritems() if v) 77 return dict((k,v) for (k,v) in out_dict.items() if v)
84 else: 78 else:
85 return out_dict 79 return out_dict
86 80
@@ -240,7 +234,7 @@ class CoreRecipeInfo(RecipeInfoCommon):
240 cachedata.universe_target.append(self.pn) 234 cachedata.universe_target.append(self.pn)
241 235
242 cachedata.hashfn[fn] = self.hashfilename 236 cachedata.hashfn[fn] = self.hashfilename
243 for task, taskhash in self.basetaskhashes.iteritems(): 237 for task, taskhash in self.basetaskhashes.items():
244 identifier = '%s.%s' % (fn, task) 238 identifier = '%s.%s' % (fn, task)
245 cachedata.basetaskhash[identifier] = taskhash 239 cachedata.basetaskhash[identifier] = taskhash
246 240
@@ -404,7 +398,7 @@ class Cache(object):
404 infos = [] 398 infos = []
405 datastores = cls.load_bbfile(filename, appends, configdata) 399 datastores = cls.load_bbfile(filename, appends, configdata)
406 depends = [] 400 depends = []
407 for variant, data in sorted(datastores.iteritems(), 401 for variant, data in sorted(datastores.items(),
408 key=lambda i: i[0], 402 key=lambda i: i[0],
409 reverse=True): 403 reverse=True):
410 virtualfn = cls.realfn2virtual(filename, variant) 404 virtualfn = cls.realfn2virtual(filename, variant)
@@ -616,7 +610,7 @@ class Cache(object):
616 pickler_dict['CoreRecipeInfo'].dump(bb.__version__) 610 pickler_dict['CoreRecipeInfo'].dump(bb.__version__)
617 611
618 try: 612 try:
619 for key, info_array in self.depends_cache.iteritems(): 613 for key, info_array in self.depends_cache.items():
620 for info in info_array: 614 for info in info_array:
621 if isinstance(info, RecipeInfoCommon): 615 if isinstance(info, RecipeInfoCommon):
622 cache_class_name = info.__class__.__name__ 616 cache_class_name = info.__class__.__name__