Skip to contentSkip to conversation

[1.50][PATCH 0/4] Backport fixes for python 3.10

DISCUSSION Jacob Kroon 2 participants 7 messages Nov 18, 2021 – Nov 19, 2021

lore
Share & tools
lore
#0 lore raw

Backport fixes for running bitbake on Fedora 35, which ships with python 3.10.

Alexander Kanavin (3):
bitbake: correct the collections vs collections.abc deprecation
bitbake: adjust parser error check for python 3.10 compatibility
bitbake: correct deprecation warning in process.py

Justin Bronder (1):
hashserv: let asyncio discover the running loop

 lib/bb/cache.py          | 3 ++-
 lib/bb/data_smart.py     | 4 ++--
 lib/bb/persist_data.py   | 5 +++--
 lib/bb/server/process.py | 2 +-
 lib/hashserv/server.py   | 4 ++--
 5 files changed, 10 insertions(+), 8 deletions(-)
#1 lore raw

[1.50][PATCH 1/4] bitbake: correct the collections vs collections.abc deprecation

From: Alexander Kanavin <[email protected]>

This becomes a hard error in python 3.10.

(cherry picked from commit ae219e1f7460077f4492b31ac91cef4cf9b17277)
---
 lib/bb/cache.py        | 3 ++-
 lib/bb/data_smart.py   | 2 +-
 lib/bb/persist_data.py | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)
lib/bb/cache.py +2 -1
index 27eb2717..5f9c0a77 100644
@@ -19,7 +19,8 @@
 import os
 import logging
 import pickle
-from collections import defaultdict, Mapping
+from collections import defaultdict
+from collections.abc import Mapping
 import bb.utils
 from bb import PrefixLoggerAdapter
 import re
lib/bb/data_smart.py +1 -1
index 8291ca65..aa9ac2c8 100644
@@ -17,7 +17,7 @@ BitBake build tools.
 # Based on functions from the base bb module, Copyright 2003 Holger Schurig
 
 import copy, re, sys, traceback
-from collections import MutableMapping
+from collections.abc import MutableMapping
 import logging
 import hashlib
 import bb, bb.codeparser
lib/bb/persist_data.py +3 -2
index c6a209fb..6f32d81a 100644
@@ -12,6 +12,7 @@ currently, providing a key/value store accessed by 'domain'.
 #
 
 import collections
+import collections.abc
 import contextlib
 import functools
 import logging
@@ -19,7 +20,7 @@ import os.path
 import sqlite3
 import sys
 import warnings
-from collections import Mapping
+from collections.abc import Mapping
 
 sqlversion = sqlite3.sqlite_version_info
 if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
@@ -29,7 +30,7 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3):
 logger = logging.getLogger("BitBake.PersistData")
 
 @functools.total_ordering
-class SQLTable(collections.MutableMapping):
+class SQLTable(collections.abc.MutableMapping):
     class _Decorators(object):
         @staticmethod
         def retry(*, reconnect=True):
#2 lore raw

[1.50][PATCH 2/4] hashserv: let asyncio discover the running loop

In reply to Jacob Kroon

From: Justin Bronder <[email protected]>

Quoted 1 line

From 3.10 documentation [1]:

Deprecated since version 3.8, removed in version 3.10: The loop parameter. This function has been implicitly getting the current running loop since 3.7

This is fixed in master as a side-effect of cf9bc0310b0092bf52b61057405aeb51c86ba137 which is more intrusive but likewise drops the loop parameter.

1. https://docs.python.org/3/library/asyncio-stream.html#asyncio.open_connection

(cherry picked from commit 74a1e71b1e677a482fdedc685a71a1798ad63920)
---
 lib/hashserv/server.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
lib/hashserv/server.py +2 -2
index a0dc0c17..df0fa0a0 100644
@@ -521,7 +521,7 @@ class Server(object):
 
     def start_tcp_server(self, host, port):
         self.server = self.loop.run_until_complete(
-            asyncio.start_server(self.handle_client, host, port, loop=self.loop)
+            asyncio.start_server(self.handle_client, host, port)
         )
 
         for s in self.server.sockets:
@@ -546,7 +546,7 @@ class Server(object):
             # Work around path length limits in AF_UNIX
             os.chdir(os.path.dirname(path))
             self.server = self.loop.run_until_complete(
-                asyncio.start_unix_server(self.handle_client, os.path.basename(path), loop=self.loop)
+                asyncio.start_unix_server(self.handle_client, os.path.basename(path))
             )
         finally:
             os.chdir(cwd)
#3 lore raw

[1.50][PATCH 3/4] bitbake: adjust parser error check for python 3.10 compatibility

In reply to Jacob Kroon

From: Alexander Kanavin <[email protected]>

The change was introduced in
https://github.com/python/cpython/commit/a698d52c3975c80b45b139b2f08402ec514dce75

(cherry picked from commit 8d3c6cbbe6ee734495713ae3b99c609527842506)
---
 lib/bb/data_smart.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/data_smart.py +1 -1
index aa9ac2c8..65857a9c 100644
@@ -403,7 +403,7 @@ class DataSmart(MutableMapping):
                     s = __expand_python_regexp__.sub(varparse.python_sub, s)
                 except SyntaxError as e:
                     # Likely unmatched brackets, just don't expand the expression
-                    if e.msg != "EOL while scanning string literal":
+                    if e.msg != "EOL while scanning string literal" and not e.msg.startswith("unterminated string literal"):
                         raise
                 if s == olds:
                     break
#4 lore raw

[1.50][PATCH 4/4] bitbake: correct deprecation warning in process.py

In reply to Jacob Kroon

From: Alexander Kanavin <[email protected]>

(cherry picked from commit aff52fe21a0b27f6302555c1e52a864550eb46ce)
---
 lib/bb/server/process.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/bb/server/process.py +1 -1
index 07bb785a..fcdce197 100644
@@ -659,7 +659,7 @@ class BBUIEventQueue:
         self.reader = ConnectionReader(readfd)
 
         self.t = threading.Thread()
-        self.t.setDaemon(True)
+        self.t.daemon = True
         self.t.run = self.startCallbackHandler
         self.t.start()
 
#5 lore raw
In reply to Jacob Kroon

Thanks, I already have these in my queue and would be sent as part of next merge request.

https://cgit.openembedded.org/bitbake-contrib/log/?h=anujm/1.50

Thanks,

Anuj

Quoted 23 lines

-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Jacob Kroon
Sent: Friday, November 19, 2021 12:26 AM
To: [email protected]
Subject: [bitbake-devel] [1.50][PATCH 0/4] Backport fixes for python 3.10

Backport fixes for running bitbake on Fedora 35, which ships with python 3.10.

Alexander Kanavin (3):
bitbake: correct the collections vs collections.abc deprecation
bitbake: adjust parser error check for python 3.10 compatibility
bitbake: correct deprecation warning in process.py

Justin Bronder (1):
hashserv: let asyncio discover the running loop

 lib/bb/cache.py          | 3 ++-
 lib/bb/data_smart.py     | 4 ++--
 lib/bb/persist_data.py   | 5 +++--
 lib/bb/server/process.py | 2 +-
 lib/hashserv/server.py   | 4 ++--
 5 files changed, 10 insertions(+), 8 deletions(-)
#6 lore raw
Quoted 8 lines · Anuj

Thanks, I already have these in my queue and would be sent as part of next merge request.

https://cgit.openembedded.org/bitbake-contrib/log/?h=anujm/1.50

Thanks,

Anuj

Super! Thanks Anuj

/Jacob

Quoted 24 lines
Quoted 23 lines

-----Original Message-----
From: [email protected] <bitbake- [email protected]> On Behalf Of Jacob Kroon
Sent: Friday, November 19, 2021 12:26 AM
To: [email protected]
Subject: [bitbake-devel] [1.50][PATCH 0/4] Backport fixes for python 3.10

Backport fixes for running bitbake on Fedora 35, which ships with python 3.10.

Alexander Kanavin (3):
bitbake: correct the collections vs collections.abc deprecation
bitbake: adjust parser error check for python 3.10 compatibility
bitbake: correct deprecation warning in process.py

Justin Bronder (1):
hashserv: let asyncio discover the running loop

  lib/bb/cache.py          | 3 ++-
  lib/bb/data_smart.py     | 4 ++--
  lib/bb/persist_data.py   | 5 +++--
  lib/bb/server/process.py | 2 +-
  lib/hashserv/server.py   | 4 ++--
  5 files changed, 10 insertions(+), 8 deletions(-)