bitbake-devel.lists.openembedded.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/7] bitbake: enable python warnings at the first opportunity
@ 2021-09-16 20:22 Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 2/7] bitbake: drop old rules for python warnings Alexander Kanavin
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

We really do want to see those, as they tend to turn into
hard errors eventually, as what happened with collections
vs collections.abc in python 3.10.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/bin/bitbake             | 2 ++
 bitbake/bin/bitbake-diffsigs    | 1 +
 bitbake/bin/bitbake-getvar      | 2 ++
 bitbake/bin/bitbake-hashclient  | 2 ++
 bitbake/bin/bitbake-hashserv    | 2 ++
 bitbake/bin/bitbake-layers      | 2 ++
 bitbake/bin/bitbake-prserv      | 2 ++
 bitbake/bin/bitbake-selftest    | 2 ++
 bitbake/bin/bitbake-server      | 1 +
 bitbake/bin/bitbake-worker      | 1 +
 bitbake/bin/git-make-shallow    | 2 ++
 bitbake/bin/toaster-eventreplay | 2 ++
 12 files changed, 21 insertions(+)

diff --git a/bitbake/bin/bitbake b/bitbake/bin/bitbake
index dc1873af69c..d3ee8e9464b 100755
--- a/bitbake/bin/bitbake
+++ b/bitbake/bin/bitbake
@@ -12,6 +12,8 @@
 
 import os
 import sys
+import warnings
+warnings.simplefilter("default")
 
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),
                                 'lib'))
diff --git a/bitbake/bin/bitbake-diffsigs b/bitbake/bin/bitbake-diffsigs
index 19420a2df69..6646dccdfa2 100755
--- a/bitbake/bin/bitbake-diffsigs
+++ b/bitbake/bin/bitbake-diffsigs
@@ -11,6 +11,7 @@
 import os
 import sys
 import warnings
+warnings.simplefilter("default")
 import argparse
 import logging
 import pickle
diff --git a/bitbake/bin/bitbake-getvar b/bitbake/bin/bitbake-getvar
index 94232192531..5435a8d7978 100755
--- a/bitbake/bin/bitbake-getvar
+++ b/bitbake/bin/bitbake-getvar
@@ -9,6 +9,8 @@ import argparse
 import io
 import os
 import sys
+import warnings
+warnings.simplefilter("default")
 
 bindir = os.path.dirname(__file__)
 topdir = os.path.dirname(bindir)
diff --git a/bitbake/bin/bitbake-hashclient b/bitbake/bin/bitbake-hashclient
index a89290217b0..494f17592ac 100755
--- a/bitbake/bin/bitbake-hashclient
+++ b/bitbake/bin/bitbake-hashclient
@@ -13,6 +13,8 @@ import pprint
 import sys
 import threading
 import time
+import warnings
+warnings.simplefilter("default")
 
 try:
     import tqdm
diff --git a/bitbake/bin/bitbake-hashserv b/bitbake/bin/bitbake-hashserv
index 153f65a3787..00af76b2d11 100755
--- a/bitbake/bin/bitbake-hashserv
+++ b/bitbake/bin/bitbake-hashserv
@@ -10,6 +10,8 @@ import sys
 import logging
 import argparse
 import sqlite3
+import warnings
+warnings.simplefilter("default")
 
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
 
diff --git a/bitbake/bin/bitbake-layers b/bitbake/bin/bitbake-layers
index ff085d67442..449434d468e 100755
--- a/bitbake/bin/bitbake-layers
+++ b/bitbake/bin/bitbake-layers
@@ -14,6 +14,8 @@ import logging
 import os
 import sys
 import argparse
+import warnings
+warnings.simplefilter("default")
 
 bindir = os.path.dirname(__file__)
 topdir = os.path.dirname(bindir)
diff --git a/bitbake/bin/bitbake-prserv b/bitbake/bin/bitbake-prserv
index bef5ef68978..323df66dd06 100755
--- a/bitbake/bin/bitbake-prserv
+++ b/bitbake/bin/bitbake-prserv
@@ -6,6 +6,8 @@
 import os
 import sys,logging
 import optparse
+import warnings
+warnings.simplefilter("default")
 
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)),'lib'))
 
diff --git a/bitbake/bin/bitbake-selftest b/bitbake/bin/bitbake-selftest
index aec47069216..f25f23b1ae7 100755
--- a/bitbake/bin/bitbake-selftest
+++ b/bitbake/bin/bitbake-selftest
@@ -7,6 +7,8 @@
 
 import os
 import sys, logging
+import warnings
+warnings.simplefilter("default")
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(__file__)), 'lib'))
 
 import unittest
diff --git a/bitbake/bin/bitbake-server b/bitbake/bin/bitbake-server
index 8e539473614..f53f88b6b0d 100755
--- a/bitbake/bin/bitbake-server
+++ b/bitbake/bin/bitbake-server
@@ -8,6 +8,7 @@
 import os
 import sys
 import warnings
+warnings.simplefilter("default")
 import logging
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
 
diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker
index 3ca8c1853bb..6ead2da6d1e 100755
--- a/bitbake/bin/bitbake-worker
+++ b/bitbake/bin/bitbake-worker
@@ -6,6 +6,7 @@
 import os
 import sys
 import warnings
+warnings.simplefilter("default")
 sys.path.insert(0, os.path.join(os.path.dirname(os.path.dirname(sys.argv[0])), 'lib'))
 from bb import fetch2
 import logging
diff --git a/bitbake/bin/git-make-shallow b/bitbake/bin/git-make-shallow
index 57069f7edf7..1d00fbf1838 100755
--- a/bitbake/bin/git-make-shallow
+++ b/bitbake/bin/git-make-shallow
@@ -16,6 +16,8 @@ import itertools
 import os
 import subprocess
 import sys
+import warnings
+warnings.simplefilter("default")
 
 version = 1.0
 
diff --git a/bitbake/bin/toaster-eventreplay b/bitbake/bin/toaster-eventreplay
index 8fa4ab7116b..404b61f5162 100755
--- a/bitbake/bin/toaster-eventreplay
+++ b/bitbake/bin/toaster-eventreplay
@@ -19,6 +19,8 @@ import sys
 import json
 import pickle
 import codecs
+import warnings
+warnings.simplefilter("default")
 
 from collections import namedtuple
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/7] bitbake: drop old rules for python warnings
  2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
@ 2021-09-16 20:22 ` Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 3/7] bitbake: correct the collections vs collections.abc deprecation Alexander Kanavin
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

These no longer even work, and it's much better to just see all warnings
and fix them as they happen.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bb/main.py | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/bitbake/lib/bb/main.py b/bitbake/lib/bb/main.py
index 06bad495acf..639fc1885db 100755
--- a/bitbake/lib/bb/main.py
+++ b/bitbake/lib/bb/main.py
@@ -112,13 +112,6 @@ def _showwarning(message, category, filename, lineno, file=None, line=None):
         warnlog.warning(s)
 
 warnings.showwarning = _showwarning
-warnings.filterwarnings("ignore")
-warnings.filterwarnings("default", module="(<string>$|(oe|bb)\.)")
-warnings.filterwarnings("ignore", category=PendingDeprecationWarning)
-warnings.filterwarnings("ignore", category=ImportWarning)
-warnings.filterwarnings("ignore", category=DeprecationWarning, module="<string>$")
-warnings.filterwarnings("ignore", message="With-statements now directly support multiple context managers")
-
 
 def create_bitbake_parser():
     parser = optparse.OptionParser(
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 3/7] bitbake: correct the collections vs collections.abc deprecation
  2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 2/7] bitbake: drop old rules for python warnings Alexander Kanavin
@ 2021-09-16 20:22 ` Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 4/7] bitbake: fix regexp deprecation warnings Alexander Kanavin
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

This becomes a hard error in python 3.10.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bb/cache.py        | 3 ++-
 bitbake/lib/bb/data_smart.py   | 2 +-
 bitbake/lib/bb/persist_data.py | 5 +++--
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 73bc6e96656..4e08c100ab2 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -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
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index e4afac64b20..73e33ee10ec 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -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
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py
index 286cc0a99d1..49c9a0d5109 100644
--- a/bitbake/lib/bb/persist_data.py
+++ b/bitbake/lib/bb/persist_data.py
@@ -12,13 +12,14 @@ currently, providing a key/value store accessed by 'domain'.
 #
 
 import collections
+import collections.abc
 import contextlib
 import functools
 import logging
 import os.path
 import sqlite3
 import sys
-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):
@@ -28,7 +29,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.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 4/7] bitbake: fix regexp deprecation warnings
  2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 2/7] bitbake: drop old rules for python warnings Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 3/7] bitbake: correct the collections vs collections.abc deprecation Alexander Kanavin
@ 2021-09-16 20:22 ` Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 5/7] bitbake: do not import imp in layerindexlib Alexander Kanavin
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

See here for details:
https://docs.python.org/3/library/re.html

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bblayers/query.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/bitbake/lib/bblayers/query.py b/bitbake/lib/bblayers/query.py
index 6e94c83076c..525d4f0d476 100644
--- a/bitbake/lib/bblayers/query.py
+++ b/bitbake/lib/bblayers/query.py
@@ -441,10 +441,10 @@ NOTE: .bbappend files can impact the dependencies.
                     line = fnfile.readline()
 
         # The "require/include xxx" in conf/machine/*.conf, .inc and .bbclass
-        conf_re = re.compile(".*/conf/machine/[^\/]*\.conf$")
-        inc_re = re.compile(".*\.inc$")
+        conf_re = re.compile(r".*/conf/machine/[^\/]*\.conf$")
+        inc_re = re.compile(r".*\.inc$")
         # The "inherit xxx" in .bbclass
-        bbclass_re = re.compile(".*\.bbclass$")
+        bbclass_re = re.compile(r".*\.bbclass$")
         for layerdir in self.bblayers:
             layername = self.get_layer_name(layerdir)
             for dirpath, dirnames, filenames in os.walk(layerdir):
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 5/7] bitbake: do not import imp in layerindexlib
  2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
                   ` (2 preceding siblings ...)
  2021-09-16 20:22 ` [PATCH 4/7] bitbake: fix regexp deprecation warnings Alexander Kanavin
@ 2021-09-16 20:22 ` Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 6/7] bitbake: adjust parser error check for python 3.10 compatibility Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 7/7] bitbake: correct deprecation warning in process.py Alexander Kanavin
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

The module is deprecated and unused.

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/layerindexlib/__init__.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/bitbake/lib/layerindexlib/__init__.py b/bitbake/lib/layerindexlib/__init__.py
index 9ca127b9df0..3159bf2f668 100644
--- a/bitbake/lib/layerindexlib/__init__.py
+++ b/bitbake/lib/layerindexlib/__init__.py
@@ -6,7 +6,6 @@
 import datetime
 
 import logging
-import imp
 import os
 
 from collections import OrderedDict
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 6/7] bitbake: adjust parser error check for python 3.10 compatibility
  2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
                   ` (3 preceding siblings ...)
  2021-09-16 20:22 ` [PATCH 5/7] bitbake: do not import imp in layerindexlib Alexander Kanavin
@ 2021-09-16 20:22 ` Alexander Kanavin
  2021-09-16 20:22 ` [PATCH 7/7] bitbake: correct deprecation warning in process.py Alexander Kanavin
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

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

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bb/data_smart.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 73e33ee10ec..ec7bb561ccd 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -409,7 +409,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
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 7/7] bitbake: correct deprecation warning in process.py
  2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
                   ` (4 preceding siblings ...)
  2021-09-16 20:22 ` [PATCH 6/7] bitbake: adjust parser error check for python 3.10 compatibility Alexander Kanavin
@ 2021-09-16 20:22 ` Alexander Kanavin
  5 siblings, 0 replies; 7+ messages in thread
From: Alexander Kanavin @ 2021-09-16 20:22 UTC (permalink / raw)
  To: bitbake-devel; +Cc: Alexander Kanavin

Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
 bitbake/lib/bb/server/process.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bitbake/lib/bb/server/process.py b/bitbake/lib/bb/server/process.py
index b593830cc74..8fdcc66dc77 100644
--- a/bitbake/lib/bb/server/process.py
+++ b/bitbake/lib/bb/server/process.py
@@ -661,7 +661,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()
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2021-09-16 20:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-16 20:22 [PATCH 1/7] bitbake: enable python warnings at the first opportunity Alexander Kanavin
2021-09-16 20:22 ` [PATCH 2/7] bitbake: drop old rules for python warnings Alexander Kanavin
2021-09-16 20:22 ` [PATCH 3/7] bitbake: correct the collections vs collections.abc deprecation Alexander Kanavin
2021-09-16 20:22 ` [PATCH 4/7] bitbake: fix regexp deprecation warnings Alexander Kanavin
2021-09-16 20:22 ` [PATCH 5/7] bitbake: do not import imp in layerindexlib Alexander Kanavin
2021-09-16 20:22 ` [PATCH 6/7] bitbake: adjust parser error check for python 3.10 compatibility Alexander Kanavin
2021-09-16 20:22 ` [PATCH 7/7] bitbake: correct deprecation warning in process.py Alexander Kanavin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).