bitbake: enable python warnings at the first opportunity
PATCH 1/7 bitbake: enable python warnings at the first opportunity
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.
--- 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(+)
bitbake/bin/bitbake +2 -0
@@ -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'))
bitbake/bin/bitbake-diffsigs +1 -0
@@ -11,6 +11,7 @@ import os import sys import warnings +warnings.simplefilter("default") import argparse import logging import pickle
bitbake/bin/bitbake-getvar +2 -0
@@ -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)
bitbake/bin/bitbake-hashclient +2 -0
@@ -13,6 +13,8 @@ import pprint import sys import threading import time +import warnings +warnings.simplefilter("default") try: import tqdm
bitbake/bin/bitbake-hashserv +2 -0
@@ -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'))
bitbake/bin/bitbake-layers +2 -0
@@ -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)
bitbake/bin/bitbake-prserv +2 -0
@@ -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'))
bitbake/bin/bitbake-selftest +2 -0
@@ -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
bitbake/bin/bitbake-server +1 -0
@@ -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'))
bitbake/bin/bitbake-worker +1 -0
@@ -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
bitbake/bin/git-make-shallow +2 -0
@@ -16,6 +16,8 @@ import itertools import os import subprocess import sys +import warnings +warnings.simplefilter("default") version = 1.0
bitbake/bin/toaster-eventreplay +2 -0
@@ -19,6 +19,8 @@ import sys import json import pickle import codecs +import warnings +warnings.simplefilter("default") from collections import namedtuple
Signature · 1 line
2.20.1
PATCH 2/7 bitbake: drop old rules for python warnings
These no longer even work, and it's much better to just see all warnings and fix them as they happen.
--- bitbake/lib/bb/main.py | 7 ------- 1 file changed, 7 deletions(-)
bitbake/lib/bb/main.py +0 -7
@@ -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(
Signature · 1 line
2.20.1
PATCH 3/7 bitbake: correct the collections vs collections.abc deprecation
In reply to Alexander KanavinThis becomes a hard error in python 3.10.
--- 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(-)
bitbake/lib/bb/cache.py +2 -1
@@ -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
bitbake/lib/bb/data_smart.py +1 -1
@@ -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
bitbake/lib/bb/persist_data.py +3 -2
@@ -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):
Signature · 1 line
2.20.1
PATCH 4/7 bitbake: fix regexp deprecation warnings
In reply to Alexander KanavinSee here for details:
https://docs.python.org/3/library/re.html
--- bitbake/lib/bblayers/query.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
bitbake/lib/bblayers/query.py +3 -3
@@ -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):
Signature · 1 line
2.20.1
PATCH 5/7 bitbake: do not import imp in layerindexlib
In reply to Alexander KanavinThe module is deprecated and unused.
--- bitbake/lib/layerindexlib/__init__.py | 1 - 1 file changed, 1 deletion(-)
bitbake/lib/layerindexlib/__init__.py +0 -1
@@ -6,7 +6,6 @@ import datetime import logging -import imp import os from collections import OrderedDict
Signature · 1 line
2.20.1
PATCH 6/7 bitbake: adjust parser error check for python 3.10 compatibility
In reply to Alexander KanavinThe change was introduced in
https://github.com/python/cpython/commit/a698d52c3975c80b45b139b2f08402ec514dce75
--- bitbake/lib/bb/data_smart.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/data_smart.py +1 -1
@@ -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
Signature · 1 line
2.20.1
PATCH 7/7 bitbake: correct deprecation warning in process.py
In reply to Alexander Kanavin--- bitbake/lib/bb/server/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
bitbake/lib/bb/server/process.py +1 -1
@@ -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()
Signature · 1 line
2.20.1