summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorFrazer Clews <frazerleslieclews@gmail.com>2020-08-24 15:51:37 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-25 18:14:53 +0100
commitabc6f864b9c6fa9a47a218a8250e79dcfa367d4d (patch)
treee4dfa762398e1b2a8ae019e0039417be3e85d99c /bitbake/lib/bb
parentac3593f6ed8f2ffb0bb62df47220b598cc1781f6 (diff)
downloadpoky-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__.py2
-rw-r--r--bitbake/lib/bb/daemonize.py2
-rw-r--r--bitbake/lib/bb/data_smart.py2
-rw-r--r--bitbake/lib/bb/fetch2/osc.py3
-rw-r--r--bitbake/lib/bb/fetch2/ssh.py7
-rw-r--r--bitbake/lib/bb/msg.py1
-rw-r--r--bitbake/lib/bb/namedtuple_with_abc.py14
-rw-r--r--bitbake/lib/bb/process.py1
-rw-r--r--bitbake/lib/bb/server/process.py1
-rw-r--r--bitbake/lib/bb/tests/data.py1
-rw-r--r--bitbake/lib/bb/tinfoil.py2
-rw-r--r--bitbake/lib/bb/ui/knotty.py2
-rw-r--r--bitbake/lib/bb/ui/ncurses.py2
-rw-r--r--bitbake/lib/bb/ui/uievent.py6
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
99logging.LoggerAdapter = BBLoggerAdapter 99logging.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
14import io 14import io
15import traceback 15import traceback
16 16
17import bb
18
17def createDaemon(function, logfile): 19def 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
10import logging 10import logging
11import os
11import bb 12import bb
12from bb.fetch2 import FetchMethod 13from bb.fetch2 import FetchMethod
13from bb.fetch2 import FetchError 14from bb.fetch2 import FetchError
14from bb.fetch2 import MissingParameterError 15from bb.fetch2 import MissingParameterError
15from bb.fetch2 import runfetchcmd 16from bb.fetch2 import runfetchcmd
16 17
18logger = logging.getLogger(__name__)
19
17class Osc(FetchMethod): 20class 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
33import re, os 33import re, os
34from bb.fetch2 import FetchMethod 34from bb.fetch2 import check_network_access, FetchMethod, ParameterError, runfetchcmd
35from 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
14import copy 14import copy
15import logging 15import logging
16import logging.config 16import logging.config
17import os
17from itertools import groupby 18from itertools import groupby
18import bb 19import bb
19import bb.event 20import 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
64exec( 64class _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
7import subprocess 7import subprocess
8import errno 8import errno
9import select 9import select
10import bb
10 11
11logger = logging.getLogger('BitBake.Process') 12logger = 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
25import errno 25import errno
26import re 26import re
27import datetime 27import datetime
28import pickle
28import bb.server.xmlrpcserver 29import bb.server.xmlrpcserver
29from bb import daemonize 30from bb import daemonize
30from multiprocessing import queues 31from 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
12import bb.data 12import bb.data
13import bb.parse 13import bb.parse
14import logging 14import logging
15import os
15 16
16class LogRecord(): 17class 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
48import xmlrpc.client 48import xmlrpc.client
49from bb.ui import uihelper 49from bb.ui import uihelper
50 50
51logger = logging.getLogger(__name__)
52
51parsespin = itertools.cycle( r'|/-\\' ) 53parsespin = itertools.cycle( r'|/-\\' )
52 54
53X = 0 55X = 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
11client/server deadlocks. 11client/server deadlocks.
12""" 12"""
13 13
14import socket, threading, pickle, collections 14import collections, logging, pickle, socket, threading
15from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler 15from xmlrpc.server import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
16 16
17import bb
18
19logger = logging.getLogger(__name__)
20
17class BBUIEventQueue: 21class BBUIEventQueue:
18 def __init__(self, BBServer, clientinfo=("localhost, 0")): 22 def __init__(self, BBServer, clientinfo=("localhost, 0")):
19 23