1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-30 12:29:55 +00:00

bitbake: lib: fix most undefined code picked up by pylint

Correctly import, and inherit functions, and variables.
Also fix some typos and remove some Python 2 code that isn't recognised.

(Bitbake rev: b0c807be5c2170c9481c1a04d4c11972135d7dc5)

Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Frazer Clews
2020-08-24 15:51:37 +01:00
committed by Richard Purdie
parent ac3593f6ed
commit abc6f864b9
22 changed files with 51 additions and 42 deletions
+8 -7
View File
@@ -7,6 +7,7 @@ import datetime
import logging
import imp
import os
from collections import OrderedDict
from layerindexlib.plugin import LayerIndexPluginUrlError
@@ -70,7 +71,7 @@ class LayerIndex():
if self.__class__ != newIndex.__class__ or \
other.__class__ != newIndex.__class__:
raise TypeException("Can not add different types.")
raise TypeError("Can not add different types.")
for indexEnt in self.indexes:
newIndex.indexes.append(indexEnt)
@@ -266,8 +267,8 @@ will write out the individual elements split by layer and related components.
logger.debug(1, "Store not implemented in %s" % plugin.type)
pass
else:
logger.debug(1, "No plugins support %s" % url)
raise LayerIndexException("No plugins support %s" % url)
logger.debug(1, "No plugins support %s" % indexURI)
raise LayerIndexException("No plugins support %s" % indexURI)
def is_empty(self):
@@ -657,7 +658,7 @@ class LayerIndexObj():
if obj.id in self._index[indexname]:
if self._index[indexname][obj.id] == obj:
continue
raise LayerIndexError('Conflict adding object %s(%s) to index' % (indexname, obj.id))
raise LayerIndexException('Conflict adding object %s(%s) to index' % (indexname, obj.id))
self._index[indexname][obj.id] = obj
def add_raw_element(self, indexname, objtype, rawobjs):
@@ -842,11 +843,11 @@ class LayerIndexObj():
def _resolve_dependencies(layerbranches, ignores, dependencies, invalid):
for layerbranch in layerbranches:
if ignores and layerBranch.layer.name in ignores:
if ignores and layerbranch.layer.name in ignores:
continue
for layerdependency in layerbranch.index.layerDependencies_layerBranchId[layerBranch.id]:
deplayerbranch = layerDependency.dependency_layerBranch
for layerdependency in layerbranch.index.layerDependencies_layerBranchId[layerbranch.id]:
deplayerbranch = layerdependency.dependency_layerBranch
if ignores and deplayerbranch.layer.name in ignores:
continue
+4 -3
View File
@@ -4,6 +4,7 @@
#
import logging
import os
from collections import defaultdict
@@ -73,7 +74,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
d = self.layerindex.data
if not branches:
raise LayerIndexFetchError("No branches specified for _load_bblayers!")
raise layerindexlib.LayerIndexFetchError("No branches specified for _load_bblayers!")
index = layerindexlib.LayerIndexObj()
@@ -202,7 +203,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
try:
depDict = bb.utils.explode_dep_versions2(deps)
except bb.utils.VersionStringException as vse:
bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (c, str(vse)))
bb.fatal('Error parsing LAYERDEPENDS_%s: %s' % (collection, str(vse)))
for dep, oplist in list(depDict.items()):
# We need to search ourselves, so use the _ version...
@@ -268,7 +269,7 @@ class CookerPlugin(layerindexlib.plugin.IndexPlugin):
layer = bb.utils.get_file_layer(realfn[0], self.config_data)
depBranchId = collection_layerbranch[layer]
depBranchId = collection[layer]
recipeId += 1
recipe = layerindexlib.Recipe(index, None)
+5 -1
View File
@@ -5,9 +5,13 @@
import logging
import json
import os
from urllib.parse import unquote
from urllib.parse import urlparse
import bb
import layerindexlib
import layerindexlib.plugin
@@ -163,7 +167,7 @@ class RestApiPlugin(layerindexlib.plugin.IndexPlugin):
parsed = _get_json_response(apiurl=up_stripped.geturl(), username=username, password=password, retry=False)
logger.debug(1, "%s: retry successful.")
else:
raise LayerIndexFetchError('%s: Connection reset by peer. Is there a firewall blocking your connection?' % apiurl)
raise layerindexlib.LayerIndexFetchError('%s: Connection reset by peer. Is there a firewall blocking your connection?' % apiurl)
return parsed
+1 -1
View File
@@ -112,7 +112,7 @@ class LayerIndexWebRestApiTest(LayersTest):
break
else:
self.logger.debug(1, "meta-python was not found")
self.assetTrue(False)
raise self.failureException
# Only check the first element...
break