diff options
Diffstat (limited to 'bitbake/lib/layerindexlib/__init__.py')
-rw-r--r-- | bitbake/lib/layerindexlib/__init__.py | 51 |
1 files changed, 25 insertions, 26 deletions
diff --git a/bitbake/lib/layerindexlib/__init__.py b/bitbake/lib/layerindexlib/__init__.py index 74f3e2e93e..cb79cb37d7 100644 --- a/bitbake/lib/layerindexlib/__init__.py +++ b/bitbake/lib/layerindexlib/__init__.py | |||
@@ -448,7 +448,7 @@ layerBranches set. If not, they are effectively blank.''' | |||
448 | This function is used to implement debugging and provide the user info. | 448 | This function is used to implement debugging and provide the user info. |
449 | ''' | 449 | ''' |
450 | for lix in self.indexes: | 450 | for lix in self.indexes: |
451 | if object not in lix: | 451 | if not hasattr(lix, object): |
452 | continue | 452 | continue |
453 | 453 | ||
454 | logger.plain ('') | 454 | logger.plain ('') |
@@ -1046,15 +1046,15 @@ class LayerBranch(LayerIndexItemObj): | |||
1046 | self.id = id | 1046 | self.id = id |
1047 | self.collection = collection | 1047 | self.collection = collection |
1048 | self.version = version | 1048 | self.version = version |
1049 | if type(layer) != type(LayerItem): | 1049 | if isinstance(layer, LayerItem): |
1050 | self.layer_id = layer | ||
1051 | else: | ||
1052 | self.layer = layer | 1050 | self.layer = layer |
1053 | |||
1054 | if type(branch) != type(Branch): | ||
1055 | self.branch_id = branch | ||
1056 | else: | 1051 | else: |
1052 | self.layer_id = layer | ||
1053 | |||
1054 | if isinstance(branch, Branch): | ||
1057 | self.branch = branch | 1055 | self.branch = branch |
1056 | else: | ||
1057 | self.branch_id = branch | ||
1058 | 1058 | ||
1059 | self.vcs_subdir = vcs_subdir | 1059 | self.vcs_subdir = vcs_subdir |
1060 | self.vcs_last_fetch = vcs_last_fetch | 1060 | self.vcs_last_fetch = vcs_last_fetch |
@@ -1088,7 +1088,7 @@ class LayerBranch(LayerIndexItemObj): | |||
1088 | 1088 | ||
1089 | @layer.setter | 1089 | @layer.setter |
1090 | def layer(self, value): | 1090 | def layer(self, value): |
1091 | if type(value) != type(LayerItem): | 1091 | if not isinstance(value, LayerItem): |
1092 | raise TypeError('value is not a LayerItem') | 1092 | raise TypeError('value is not a LayerItem') |
1093 | if self.index != value.index: | 1093 | if self.index != value.index: |
1094 | raise AttributeError('Object and value do not share the same index and thus key set.') | 1094 | raise AttributeError('Object and value do not share the same index and thus key set.') |
@@ -1122,7 +1122,7 @@ class LayerBranch(LayerIndexItemObj): | |||
1122 | 1122 | ||
1123 | @branch.setter | 1123 | @branch.setter |
1124 | def branch(self, value): | 1124 | def branch(self, value): |
1125 | if type(value) != type(LayerItem): | 1125 | if not isinstance(value, LayerItem): |
1126 | raise TypeError('value is not a LayerItem') | 1126 | raise TypeError('value is not a LayerItem') |
1127 | if self.index != value.index: | 1127 | if self.index != value.index: |
1128 | raise AttributeError('Object and value do not share the same index and thus key set.') | 1128 | raise AttributeError('Object and value do not share the same index and thus key set.') |
@@ -1181,7 +1181,7 @@ class LayerIndexItemObj_LayerBranch(LayerIndexItemObj): | |||
1181 | 1181 | ||
1182 | @layerbranch.setter | 1182 | @layerbranch.setter |
1183 | def layerbranch(self, value): | 1183 | def layerbranch(self, value): |
1184 | if type(value) != type(LayerBranch): | 1184 | if not isinstance(value, LayerBranch): |
1185 | raise TypeError('value (%s) is not a layerBranch' % type(value)) | 1185 | raise TypeError('value (%s) is not a layerBranch' % type(value)) |
1186 | if self.index != value.index: | 1186 | if self.index != value.index: |
1187 | raise AttributeError('Object and value do not share the same index and thus key set.') | 1187 | raise AttributeError('Object and value do not share the same index and thus key set.') |
@@ -1207,14 +1207,14 @@ class LayerIndexItemObj_LayerBranch(LayerIndexItemObj): | |||
1207 | class LayerDependency(LayerIndexItemObj_LayerBranch): | 1207 | class LayerDependency(LayerIndexItemObj_LayerBranch): |
1208 | def define_data(self, id, layerbranch, dependency, required=True): | 1208 | def define_data(self, id, layerbranch, dependency, required=True): |
1209 | self.id = id | 1209 | self.id = id |
1210 | if type(layerbranch) != type(LayerBranch): | 1210 | if isinstance(layerbranch, LayerBranch): |
1211 | self.layerbranch_id = layerbranch | ||
1212 | else: | ||
1213 | self.layerbranch = layerbranch | 1211 | self.layerbranch = layerbranch |
1214 | if type(dependency) != type(LayerDependency): | ||
1215 | self.dependency_id = dependency | ||
1216 | else: | 1212 | else: |
1213 | self.layerbranch_id = layerbranch | ||
1214 | if isinstance(dependency, LayerDependency): | ||
1217 | self.dependency = dependency | 1215 | self.dependency = dependency |
1216 | else: | ||
1217 | self.dependency_id = dependency | ||
1218 | self.required = required | 1218 | self.required = required |
1219 | 1219 | ||
1220 | @property | 1220 | @property |
@@ -1240,7 +1240,7 @@ class LayerDependency(LayerIndexItemObj_LayerBranch): | |||
1240 | 1240 | ||
1241 | @dependency.setter | 1241 | @dependency.setter |
1242 | def dependency(self, value): | 1242 | def dependency(self, value): |
1243 | if type(value) != type(LayerDependency): | 1243 | if not isinstance(value, LayerDependency): |
1244 | raise TypeError('value (%s) is not a dependency' % type(value)) | 1244 | raise TypeError('value (%s) is not a dependency' % type(value)) |
1245 | if self.index != value.index: | 1245 | if self.index != value.index: |
1246 | raise AttributeError('Object and value do not share the same index and thus key set.') | 1246 | raise AttributeError('Object and value do not share the same index and thus key set.') |
@@ -1288,10 +1288,10 @@ class Recipe(LayerIndexItemObj_LayerBranch): | |||
1288 | self.inherits = inherits | 1288 | self.inherits = inherits |
1289 | self.updated = updated or datetime.datetime.today().isoformat() | 1289 | self.updated = updated or datetime.datetime.today().isoformat() |
1290 | self.blacklisted = blacklisted | 1290 | self.blacklisted = blacklisted |
1291 | if type(layerbranch) != type(LayerBranch): | 1291 | if isinstance(layerbranch, LayerBranch): |
1292 | self.layerbranch_id = layerbranch | ||
1293 | else: | ||
1294 | self.layerbranch = layerbranch | 1292 | self.layerbranch = layerbranch |
1293 | else: | ||
1294 | self.layerbranch_id = layerbranch | ||
1295 | 1295 | ||
1296 | @property | 1296 | @property |
1297 | def fullpath(self): | 1297 | def fullpath(self): |
@@ -1324,10 +1324,10 @@ class Machine(LayerIndexItemObj_LayerBranch): | |||
1324 | self.id = id | 1324 | self.id = id |
1325 | self.name = name | 1325 | self.name = name |
1326 | self.description = description | 1326 | self.description = description |
1327 | if type(layerbranch) != type(LayerBranch): | 1327 | if isinstance(layerbranch, LayerBranch): |
1328 | self.layerbranch_id = layerbranch | ||
1329 | else: | ||
1330 | self.layerbranch = layerbranch | 1328 | self.layerbranch = layerbranch |
1329 | else: | ||
1330 | self.layerbranch_id = layerbranch | ||
1331 | self.updated = updated or datetime.datetime.today().isoformat() | 1331 | self.updated = updated or datetime.datetime.today().isoformat() |
1332 | 1332 | ||
1333 | class Distro(LayerIndexItemObj_LayerBranch): | 1333 | class Distro(LayerIndexItemObj_LayerBranch): |
@@ -1337,13 +1337,12 @@ class Distro(LayerIndexItemObj_LayerBranch): | |||
1337 | self.id = id | 1337 | self.id = id |
1338 | self.name = name | 1338 | self.name = name |
1339 | self.description = description | 1339 | self.description = description |
1340 | if type(layerbranch) != type(LayerBranch): | 1340 | if isinstance(layerbranch, LayerBranch): |
1341 | self.layerbranch_id = layerbranch | ||
1342 | else: | ||
1343 | self.layerbranch = layerbranch | 1341 | self.layerbranch = layerbranch |
1342 | else: | ||
1343 | self.layerbranch_id = layerbranch | ||
1344 | self.updated = updated or datetime.datetime.today().isoformat() | 1344 | self.updated = updated or datetime.datetime.today().isoformat() |
1345 | 1345 | ||
1346 | |||
1347 | # When performing certain actions, we may need to sort the data. | 1346 | # When performing certain actions, we may need to sort the data. |
1348 | # This will allow us to keep it consistent from run to run. | 1347 | # This will allow us to keep it consistent from run to run. |
1349 | def sort_entry(item): | 1348 | def sort_entry(item): |