diff options
author | Frazer Clews <frazerleslieclews@gmail.com> | 2020-08-24 15:51:37 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-08-25 18:14:46 +0100 |
commit | b0c807be5c2170c9481c1a04d4c11972135d7dc5 (patch) | |
tree | 9f5f673f8d88baa82120d0dbf7284d148fb04219 /lib/layerindexlib | |
parent | 4bb71b627767297269e762b414443e15e28bfac4 (diff) | |
download | bitbake-b0c807be5c2170c9481c1a04d4c11972135d7dc5.tar.gz |
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.
Signed-off-by: Frazer Clews <frazerleslieclews@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/layerindexlib')
-rw-r--r-- | lib/layerindexlib/__init__.py | 15 | ||||
-rw-r--r-- | lib/layerindexlib/cooker.py | 7 | ||||
-rw-r--r-- | lib/layerindexlib/restapi.py | 6 | ||||
-rw-r--r-- | lib/layerindexlib/tests/restapi.py | 2 |
4 files changed, 18 insertions, 12 deletions
diff --git a/lib/layerindexlib/__init__.py b/lib/layerindexlib/__init__.py index 77196b408..45157b668 100644 --- a/lib/layerindexlib/__init__.py +++ b/lib/layerindexlib/__init__.py @@ -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 diff --git a/lib/layerindexlib/cooker.py b/lib/layerindexlib/cooker.py index 65b23d087..21ec438a2 100644 --- a/lib/layerindexlib/cooker.py +++ b/lib/layerindexlib/cooker.py @@ -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) diff --git a/lib/layerindexlib/restapi.py b/lib/layerindexlib/restapi.py index 21fd14414..7023f42f2 100644 --- a/lib/layerindexlib/restapi.py +++ b/lib/layerindexlib/restapi.py @@ -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 diff --git a/lib/layerindexlib/tests/restapi.py b/lib/layerindexlib/tests/restapi.py index e5ccafe5c..4646d01f9 100644 --- a/lib/layerindexlib/tests/restapi.py +++ b/lib/layerindexlib/tests/restapi.py @@ -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 |