bitbake: bitbake: Drop older python version compatibility code

cooker: We can call multiprocessing close() unconditionally and tweak a
comment give 3.8 is now the minimum version.

lib/bb: We can drop the logger addition code only needed before 3.6

asyncrpc/hashserv: Since the minimum version is 3.8, we can drop the
conditional code.

(Bitbake rev: 16f4386400f88ba50605307961c248bef09895c1)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Richard Purdie 2024-05-30 10:37:45 +01:00
parent 277e07d1cc
commit 2ff7af74bc
5 changed files with 6 additions and 32 deletions

View File

@ -104,26 +104,6 @@ class BBLoggerAdapter(logging.LoggerAdapter, BBLoggerMixin):
self.setup_bblogger(logger.name)
super().__init__(logger, *args, **kwargs)
if sys.version_info < (3, 6):
# These properties were added in Python 3.6. Add them in older versions
# for compatibility
@property
def manager(self):
return self.logger.manager
@manager.setter
def manager(self, value):
self.logger.manager = value
@property
def name(self):
return self.logger.name
def __repr__(self):
logger = self.logger
level = logger.getLevelName(logger.getEffectiveLevel())
return '<%s %s (%s)>' % (self.__class__.__name__, logger.name, level)
logging.LoggerAdapter = BBLoggerAdapter
logger = logging.getLogger("BitBake")

View File

@ -249,8 +249,7 @@ class Client(object):
def close(self):
if self.loop:
self.loop.run_until_complete(self.client.close())
if sys.version_info >= (3, 6):
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
self.loop.close()
self.loop = None

View File

@ -388,8 +388,7 @@ class AsyncServer(object):
self._serve_forever(tasks)
if sys.version_info >= (3, 6):
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
self.loop.run_until_complete(self.loop.shutdown_asyncgens())
self.loop.close()
queue = multiprocessing.Queue()

View File

@ -1812,8 +1812,8 @@ class CookerCollectFiles(object):
bb.event.fire(CookerExit(), eventdata)
# We need to track where we look so that we can know when the cache is invalid. There
# is no nice way to do this, this is horrid. We intercept the os.listdir()
# (or os.scandir() for python 3.6+) calls while we run glob().
# is no nice way to do this, this is horrid. We intercept the os.listdir() and os.scandir()
# calls while we run glob().
origlistdir = os.listdir
if hasattr(os, 'scandir'):
origscandir = os.scandir
@ -2224,9 +2224,8 @@ class CookerParser(object):
for process in self.processes:
process.join()
# Added in 3.7, cleans up zombies
if hasattr(process, "close"):
process.close()
# clean up zombies
process.close()
bb.codeparser.parser_cache_save()
bb.codeparser.parser_cache_savemerge()

View File

@ -94,9 +94,6 @@ class HashEquivalenceTestSetup(object):
return self.start_client(self.auth_server_address, user["username"], user["token"])
def setUp(self):
if sys.version_info < (3, 5, 0):
self.skipTest('Python 3.5 or later required')
self.temp_dir = tempfile.TemporaryDirectory(prefix='bb-hashserv')
self.addCleanup(self.temp_dir.cleanup)