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:53 +0100 |
commit | abc6f864b9c6fa9a47a218a8250e79dcfa367d4d (patch) | |
tree | e4dfa762398e1b2a8ae019e0039417be3e85d99c /bitbake/lib/bb | |
parent | ac3593f6ed8f2ffb0bb62df47220b598cc1781f6 (diff) | |
download | poky-abc6f864b9c6fa9a47a218a8250e79dcfa367d4d.tar.gz |
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>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/__init__.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/daemonize.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/data_smart.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/osc.py | 3 | ||||
-rw-r--r-- | bitbake/lib/bb/fetch2/ssh.py | 7 | ||||
-rw-r--r-- | bitbake/lib/bb/msg.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/namedtuple_with_abc.py | 14 | ||||
-rw-r--r-- | bitbake/lib/bb/process.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/server/process.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/tests/data.py | 1 | ||||
-rw-r--r-- | bitbake/lib/bb/tinfoil.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/knotty.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/ncurses.py | 2 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/uievent.py | 6 |
14 files changed, 26 insertions, 20 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py index 2c94e10c80..888dd5ccc6 100644 --- a/bitbake/lib/bb/__init__.py +++ b/bitbake/lib/bb/__init__.py | |||
@@ -93,7 +93,7 @@ class BBLoggerAdapter(logging.LoggerAdapter, BBLoggerMixin): | |||
93 | 93 | ||
94 | def __repr__(self): | 94 | def __repr__(self): |
95 | logger = self.logger | 95 | logger = self.logger |
96 | level = getLevelName(logger.getEffectiveLevel()) | 96 | level = logger.getLevelName(logger.getEffectiveLevel()) |
97 | return '<%s %s (%s)>' % (self.__class__.__name__, logger.name, level) | 97 | return '<%s %s (%s)>' % (self.__class__.__name__, logger.name, level) |
98 | 98 | ||
99 | logging.LoggerAdapter = BBLoggerAdapter | 99 | logging.LoggerAdapter = BBLoggerAdapter |
diff --git a/bitbake/lib/bb/daemonize.py b/bitbake/lib/bb/daemonize.py index f01e6ec7cc..c187fcfc6c 100644 --- a/bitbake/lib/bb/daemonize.py +++ b/bitbake/lib/bb/daemonize.py | |||
@@ -14,6 +14,8 @@ import sys | |||
14 | import io | 14 | import io |
15 | import traceback | 15 | import traceback |
16 | 16 | ||
17 | import bb | ||
18 | |||
17 | def createDaemon(function, logfile): | 19 | def createDaemon(function, logfile): |
18 | """ | 20 | """ |
19 | Detach a process from the controlling terminal and run it in the | 21 | Detach a process from the controlling terminal and run it in the |
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py index 7f1b6dcb4f..c559102cf5 100644 --- a/bitbake/lib/bb/data_smart.py +++ b/bitbake/lib/bb/data_smart.py | |||
@@ -189,7 +189,7 @@ class IncludeHistory(object): | |||
189 | if self.current.parent: | 189 | if self.current.parent: |
190 | self.current = self.current.parent | 190 | self.current = self.current.parent |
191 | else: | 191 | else: |
192 | bb.warn("Include log: Tried to finish '%s' at top level." % filename) | 192 | bb.warn("Include log: Tried to finish '%s' at top level." % self.filename) |
193 | return False | 193 | return False |
194 | 194 | ||
195 | def emit(self, o, level = 0): | 195 | def emit(self, o, level = 0): |
diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index 8f091efd02..3a6cd29510 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py | |||
@@ -8,12 +8,15 @@ Based on the svn "Fetch" implementation. | |||
8 | """ | 8 | """ |
9 | 9 | ||
10 | import logging | 10 | import logging |
11 | import os | ||
11 | import bb | 12 | import bb |
12 | from bb.fetch2 import FetchMethod | 13 | from bb.fetch2 import FetchMethod |
13 | from bb.fetch2 import FetchError | 14 | from bb.fetch2 import FetchError |
14 | from bb.fetch2 import MissingParameterError | 15 | from bb.fetch2 import MissingParameterError |
15 | from bb.fetch2 import runfetchcmd | 16 | from bb.fetch2 import runfetchcmd |
16 | 17 | ||
18 | logger = logging.getLogger(__name__) | ||
19 | |||
17 | class Osc(FetchMethod): | 20 | class Osc(FetchMethod): |
18 | """Class to fetch a module or modules from Opensuse build server | 21 | """Class to fetch a module or modules from Opensuse build server |
19 | repositories.""" | 22 | repositories.""" |
diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index 5e982ecf38..2c8557e1f8 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py | |||
@@ -31,8 +31,7 @@ IETF secsh internet draft: | |||
31 | # | 31 | # |
32 | 32 | ||
33 | import re, os | 33 | import re, os |
34 | from bb.fetch2 import FetchMethod | 34 | from bb.fetch2 import check_network_access, FetchMethod, ParameterError, runfetchcmd |
35 | from bb.fetch2 import runfetchcmd | ||
36 | 35 | ||
37 | 36 | ||
38 | __pattern__ = re.compile(r''' | 37 | __pattern__ = re.compile(r''' |
@@ -65,7 +64,7 @@ class SSH(FetchMethod): | |||
65 | 64 | ||
66 | def urldata_init(self, urldata, d): | 65 | def urldata_init(self, urldata, d): |
67 | if 'protocol' in urldata.parm and urldata.parm['protocol'] == 'git': | 66 | if 'protocol' in urldata.parm and urldata.parm['protocol'] == 'git': |
68 | raise bb.fetch2.ParameterError( | 67 | raise ParameterError( |
69 | "Invalid protocol - if you wish to fetch from a git " + | 68 | "Invalid protocol - if you wish to fetch from a git " + |
70 | "repository using ssh, you need to use " + | 69 | "repository using ssh, you need to use " + |
71 | "git:// prefix with protocol=ssh", urldata.url) | 70 | "git:// prefix with protocol=ssh", urldata.url) |
@@ -105,7 +104,7 @@ class SSH(FetchMethod): | |||
105 | dldir | 104 | dldir |
106 | ) | 105 | ) |
107 | 106 | ||
108 | bb.fetch2.check_network_access(d, cmd, urldata.url) | 107 | check_network_access(d, cmd, urldata.url) |
109 | 108 | ||
110 | runfetchcmd(cmd, d) | 109 | runfetchcmd(cmd, d) |
111 | 110 | ||
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index 1b1a23bb50..6f17b6acc7 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py | |||
@@ -14,6 +14,7 @@ import sys | |||
14 | import copy | 14 | import copy |
15 | import logging | 15 | import logging |
16 | import logging.config | 16 | import logging.config |
17 | import os | ||
17 | from itertools import groupby | 18 | from itertools import groupby |
18 | import bb | 19 | import bb |
19 | import bb.event | 20 | import bb.event |
diff --git a/bitbake/lib/bb/namedtuple_with_abc.py b/bitbake/lib/bb/namedtuple_with_abc.py index 646aed6ffd..e46dbf0849 100644 --- a/bitbake/lib/bb/namedtuple_with_abc.py +++ b/bitbake/lib/bb/namedtuple_with_abc.py | |||
@@ -61,17 +61,9 @@ class _NamedTupleABCMeta(ABCMeta): | |||
61 | return ABCMeta.__new__(mcls, name, bases, namespace) | 61 | return ABCMeta.__new__(mcls, name, bases, namespace) |
62 | 62 | ||
63 | 63 | ||
64 | exec( | 64 | class _NamedTupleABC(metaclass=_NamedTupleABCMeta): |
65 | # Python 2.x metaclass declaration syntax | 65 | '''The abstract base class + mix-in for named tuples.''' |
66 | """class _NamedTupleABC(object): | 66 | _fields = abstractproperty() |
67 | '''The abstract base class + mix-in for named tuples.''' | ||
68 | __metaclass__ = _NamedTupleABCMeta | ||
69 | _fields = abstractproperty()""" if version_info[0] < 3 else | ||
70 | # Python 3.x metaclass declaration syntax | ||
71 | """class _NamedTupleABC(metaclass=_NamedTupleABCMeta): | ||
72 | '''The abstract base class + mix-in for named tuples.''' | ||
73 | _fields = abstractproperty()""" | ||
74 | ) | ||
75 | 67 | ||
76 | 68 | ||
77 | _namedtuple.abc = _NamedTupleABC | 69 | _namedtuple.abc = _NamedTupleABC |
diff --git a/bitbake/lib/bb/process.py b/bitbake/lib/bb/process.py index f36c929d25..7c3995cce5 100644 --- a/bitbake/lib/bb/process.py +++ b/bitbake/lib/bb/process.py | |||
@@ -7,6 +7,7 @@ import signal | |||
7 | import subprocess | 7 | import subprocess |
8 | import errno | 8 | import errno |
9 | import select | 9 | import select |
10 | import bb | ||
10 | 11 | ||
11 | logger = logging.getLogger('BitBake.Process') | 12 | logger = logging.getLogger('BitBake.Process') |
12 | 13 | ||
diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py index 005ac34775..74cdd3f3ea 100644 --- a/bitbake/lib/bb/server/process.py +++ b/bitbake/lib/bb/server/process.py | |||
@@ -25,6 +25,7 @@ import subprocess | |||
25 | import errno | 25 | import errno |
26 | import re | 26 | import re |
27 | import datetime | 27 | import datetime |
28 | import pickle | ||
28 | import bb.server.xmlrpcserver | 29 | import bb.server.xmlrpcserver |
29 | from bb import daemonize | 30 | from bb import daemonize |
30 | from multiprocessing import queues | 31 | from multiprocessing import queues |
diff --git a/bitbake/lib/bb/tests/data.py b/bitbake/lib/bb/tests/data.py index 5f195047de..1d4a64b109 100644 --- a/bitbake/lib/bb/tests/data.py +++ b/bitbake/lib/bb/tests/data.py | |||
@@ -12,6 +12,7 @@ import bb | |||
12 | import bb.data | 12 | import bb.data |
13 | import bb.parse | 13 | import bb.parse |
14 | import logging | 14 | import logging |
15 | import os | ||
15 | 16 | ||
16 | class LogRecord(): | 17 | class LogRecord(): |
17 | def __enter__(self): | 18 | def __enter__(self): |
diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index e19d9cff04..5755e5a346 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py | |||
@@ -732,7 +732,7 @@ class Tinfoil: | |||
732 | continue | 732 | continue |
733 | if helper.eventHandler(event): | 733 | if helper.eventHandler(event): |
734 | if isinstance(event, bb.build.TaskFailedSilent): | 734 | if isinstance(event, bb.build.TaskFailedSilent): |
735 | logger.warning("Logfile for failed setscene task is %s" % event.logfile) | 735 | self.logger.warning("Logfile for failed setscene task is %s" % event.logfile) |
736 | elif isinstance(event, bb.build.TaskFailed): | 736 | elif isinstance(event, bb.build.TaskFailed): |
737 | bb.ui.knotty.print_event_log(event, includelogs, loglines, termfilter) | 737 | bb.ui.knotty.print_event_log(event, includelogs, loglines, termfilter) |
738 | continue | 738 | continue |
diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index 87e873d644..a3507afb7c 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py | |||
@@ -144,7 +144,7 @@ class TerminalFilter(object): | |||
144 | pass | 144 | pass |
145 | if not cr: | 145 | if not cr: |
146 | try: | 146 | try: |
147 | cr = (env['LINES'], env['COLUMNS']) | 147 | cr = (os.environ['LINES'], os.environ['COLUMNS']) |
148 | except: | 148 | except: |
149 | cr = (25, 80) | 149 | cr = (25, 80) |
150 | return cr | 150 | return cr |
diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index da4fbeabb6..cf1c876a51 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py | |||
@@ -48,6 +48,8 @@ import bb | |||
48 | import xmlrpc.client | 48 | import xmlrpc.client |
49 | from bb.ui import uihelper | 49 | from bb.ui import uihelper |
50 | 50 | ||
51 | logger = logging.getLogger(__name__) | ||
52 | |||
51 | parsespin = itertools.cycle( r'|/-\\' ) | 53 | parsespin = itertools.cycle( r'|/-\\' ) |
52 | 54 | ||
53 | X = 0 | 55 | X = 0 |
diff --git a/bitbake/lib/bb/ui/uievent.py b/bitbake/lib/bb/ui/uievent.py index 13d0d4a04c..8607d0523b 100644 --- a/bitbake/lib/bb/ui/uievent.py +++ b/bitbake/lib/bb/ui/uievent.py | |||
@@ -11,9 +11,13 @@ server and queue them for the UI to process. This process must be used to avoid | |||
11 | client/server deadlocks. | 11 | client/server deadlocks. |
12 | """ | 12 | """ |
13 | 13 | ||
14 | import socket, threading, pickle, collections | 14 | import collections, logging, pickle, socket, threading |
15 | from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler | 15 | from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler |
16 | 16 | ||
17 | import bb | ||
18 | |||
19 | logger = logging.getLogger(__name__) | ||
20 | |||
17 | class BBUIEventQueue: | 21 | class BBUIEventQueue: |
18 | def __init__(self, BBServer, clientinfo=("localhost, 0")): | 22 | def __init__(self, BBServer, clientinfo=("localhost, 0")): |
19 | 23 | ||