summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/cooker.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/cooker.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/cooker.py')
-rw-r--r--bitbake/lib/bb/cooker.py38
1 files changed, 19 insertions, 19 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 11f17efa6f..2154ef49c4 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -30,13 +30,13 @@ import logging
30import multiprocessing 30import multiprocessing
31import sre_constants 31import sre_constants
32import threading 32import threading
33from cStringIO import StringIO 33from io import StringIO
34from contextlib import closing 34from contextlib import closing
35from functools import wraps 35from functools import wraps
36from collections import defaultdict 36from collections import defaultdict
37import bb, bb.exceptions, bb.command 37import bb, bb.exceptions, bb.command
38from bb import utils, data, parse, event, cache, providers, taskdata, runqueue, build 38from bb import utils, data, parse, event, cache, providers, taskdata, runqueue, build
39import Queue 39import queue
40import signal 40import signal
41import subprocess 41import subprocess
42import errno 42import errno
@@ -65,7 +65,7 @@ class CollectionError(bb.BBHandledException):
65 """ 65 """
66 66
67class state: 67class state:
68 initial, parsing, running, shutdown, forceshutdown, stopped, error = range(7) 68 initial, parsing, running, shutdown, forceshutdown, stopped, error = list(range(7))
69 69
70 @classmethod 70 @classmethod
71 def get_name(cls, code): 71 def get_name(cls, code):
@@ -93,7 +93,7 @@ class SkippedPackage:
93 93
94 94
95class CookerFeatures(object): 95class CookerFeatures(object):
96 _feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS] = range(3) 96 _feature_list = [HOB_EXTRA_CACHES, BASEDATASTORE_TRACKING, SEND_SANITYEVENTS] = list(range(3))
97 97
98 def __init__(self): 98 def __init__(self):
99 self._features=set() 99 self._features=set()
@@ -110,8 +110,8 @@ class CookerFeatures(object):
110 def __iter__(self): 110 def __iter__(self):
111 return self._features.__iter__() 111 return self._features.__iter__()
112 112
113 def next(self): 113 def __next__(self):
114 return self._features.next() 114 return next(self._features)
115 115
116 116
117#============================================================================# 117#============================================================================#
@@ -726,13 +726,13 @@ class BBCooker:
726 depend_tree['providermap'] = {} 726 depend_tree['providermap'] = {}
727 depend_tree["layer-priorities"] = self.recipecache.bbfile_config_priorities 727 depend_tree["layer-priorities"] = self.recipecache.bbfile_config_priorities
728 728
729 for name, fn in taskdata.get_providermap().iteritems(): 729 for name, fn in list(taskdata.get_providermap().items()):
730 pn = self.recipecache.pkg_fn[fn] 730 pn = self.recipecache.pkg_fn[fn]
731 if name != pn: 731 if name != pn:
732 version = "%s:%s-%s" % self.recipecache.pkg_pepvpr[fn] 732 version = "%s:%s-%s" % self.recipecache.pkg_pepvpr[fn]
733 depend_tree['providermap'][name] = (pn, version) 733 depend_tree['providermap'][name] = (pn, version)
734 734
735 for task in xrange(len(rq.rqdata.runq_fnid)): 735 for task in range(len(rq.rqdata.runq_fnid)):
736 taskname = rq.rqdata.runq_task[task] 736 taskname = rq.rqdata.runq_task[task]
737 fnid = rq.rqdata.runq_fnid[task] 737 fnid = rq.rqdata.runq_fnid[task]
738 fn = taskdata.fn_index[fnid] 738 fn = taskdata.fn_index[fnid]
@@ -807,7 +807,7 @@ class BBCooker:
807 _, taskdata = self.prepareTreeData(pkgs_to_build, task) 807 _, taskdata = self.prepareTreeData(pkgs_to_build, task)
808 tasks_fnid = [] 808 tasks_fnid = []
809 if len(taskdata.tasks_name) != 0: 809 if len(taskdata.tasks_name) != 0:
810 for task in xrange(len(taskdata.tasks_name)): 810 for task in range(len(taskdata.tasks_name)):
811 tasks_fnid.append(taskdata.tasks_fnid[task]) 811 tasks_fnid.append(taskdata.tasks_fnid[task])
812 812
813 seen_fnids = [] 813 seen_fnids = []
@@ -825,7 +825,7 @@ class BBCooker:
825 cachefields = getattr(cache_class, 'cachefields', []) 825 cachefields = getattr(cache_class, 'cachefields', [])
826 extra_info = extra_info + cachefields 826 extra_info = extra_info + cachefields
827 827
828 for task in xrange(len(tasks_fnid)): 828 for task in range(len(tasks_fnid)):
829 fnid = tasks_fnid[task] 829 fnid = tasks_fnid[task]
830 fn = taskdata.fn_index[fnid] 830 fn = taskdata.fn_index[fnid]
831 pn = self.recipecache.pkg_fn[fn] 831 pn = self.recipecache.pkg_fn[fn]
@@ -953,7 +953,7 @@ class BBCooker:
953 # Determine which bbappends haven't been applied 953 # Determine which bbappends haven't been applied
954 954
955 # First get list of recipes, including skipped 955 # First get list of recipes, including skipped
956 recipefns = self.recipecache.pkg_fn.keys() 956 recipefns = list(self.recipecache.pkg_fn.keys())
957 recipefns.extend(self.skiplist.keys()) 957 recipefns.extend(self.skiplist.keys())
958 958
959 # Work out list of bbappends that have been applied 959 # Work out list of bbappends that have been applied
@@ -1152,7 +1152,7 @@ class BBCooker:
1152 deplist = bb.utils.explode_dep_versions2(deps) 1152 deplist = bb.utils.explode_dep_versions2(deps)
1153 except bb.utils.VersionStringException as vse: 1153 except bb.utils.VersionStringException as vse:
1154 bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (c, str(vse))) 1154 bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (c, str(vse)))
1155 for dep, oplist in deplist.iteritems(): 1155 for dep, oplist in list(deplist.items()):
1156 if dep in collection_list: 1156 if dep in collection_list:
1157 for opstr in oplist: 1157 for opstr in oplist:
1158 layerver = self.data.getVar("LAYERVERSION_%s" % dep, True) 1158 layerver = self.data.getVar("LAYERVERSION_%s" % dep, True)
@@ -1888,7 +1888,7 @@ class Feeder(multiprocessing.Process):
1888 while True: 1888 while True:
1889 try: 1889 try:
1890 quit = self.quit.get_nowait() 1890 quit = self.quit.get_nowait()
1891 except Queue.Empty: 1891 except queue.Empty:
1892 pass 1892 pass
1893 else: 1893 else:
1894 if quit == 'cancel': 1894 if quit == 'cancel':
@@ -1902,7 +1902,7 @@ class Feeder(multiprocessing.Process):
1902 1902
1903 try: 1903 try:
1904 self.to_parsers.put(job, timeout=0.5) 1904 self.to_parsers.put(job, timeout=0.5)
1905 except Queue.Full: 1905 except queue.Full:
1906 self.jobs.insert(0, job) 1906 self.jobs.insert(0, job)
1907 continue 1907 continue
1908 1908
@@ -1942,7 +1942,7 @@ class Parser(multiprocessing.Process):
1942 while True: 1942 while True:
1943 try: 1943 try:
1944 self.quit.get_nowait() 1944 self.quit.get_nowait()
1945 except Queue.Empty: 1945 except queue.Empty:
1946 pass 1946 pass
1947 else: 1947 else:
1948 self.results.cancel_join_thread() 1948 self.results.cancel_join_thread()
@@ -1953,7 +1953,7 @@ class Parser(multiprocessing.Process):
1953 else: 1953 else:
1954 try: 1954 try:
1955 job = self.jobs.get(timeout=0.25) 1955 job = self.jobs.get(timeout=0.25)
1956 except Queue.Empty: 1956 except queue.Empty:
1957 continue 1957 continue
1958 1958
1959 if job is None: 1959 if job is None:
@@ -1962,7 +1962,7 @@ class Parser(multiprocessing.Process):
1962 1962
1963 try: 1963 try:
1964 self.results.put(result, timeout=0.25) 1964 self.results.put(result, timeout=0.25)
1965 except Queue.Full: 1965 except queue.Full:
1966 pending.append(result) 1966 pending.append(result)
1967 1967
1968 def parse(self, filename, appends, caches_array): 1968 def parse(self, filename, appends, caches_array):
@@ -2115,7 +2115,7 @@ class CookerParser(object):
2115 2115
2116 try: 2116 try:
2117 result = self.result_queue.get(timeout=0.25) 2117 result = self.result_queue.get(timeout=0.25)
2118 except Queue.Empty: 2118 except queue.Empty:
2119 pass 2119 pass
2120 else: 2120 else:
2121 value = result[1] 2121 value = result[1]
@@ -2128,7 +2128,7 @@ class CookerParser(object):
2128 result = [] 2128 result = []
2129 parsed = None 2129 parsed = None
2130 try: 2130 try:
2131 parsed, result = self.results.next() 2131 parsed, result = next(self.results)
2132 except StopIteration: 2132 except StopIteration:
2133 self.shutdown() 2133 self.shutdown()
2134 return False 2134 return False