diff options
| -rw-r--r-- | bitbake/lib/bb/compat.py | 10 | ||||
| -rw-r--r-- | bitbake/lib/bb/event.py | 16 | ||||
| -rw-r--r-- | bitbake/lib/bb/persist_data.py | 8 | ||||
| -rw-r--r-- | bitbake/lib/bb/tests/event.py | 17 |
4 files changed, 21 insertions, 30 deletions
diff --git a/bitbake/lib/bb/compat.py b/bitbake/lib/bb/compat.py deleted file mode 100644 index 49356681ab..0000000000 --- a/bitbake/lib/bb/compat.py +++ /dev/null | |||
| @@ -1,10 +0,0 @@ | |||
| 1 | # | ||
| 2 | # SPDX-License-Identifier: GPL-2.0-only | ||
| 3 | # | ||
| 4 | |||
| 5 | """Code pulled from future python versions, here for compatibility""" | ||
| 6 | |||
| 7 | from collections import MutableMapping, KeysView, ValuesView, ItemsView, OrderedDict | ||
| 8 | from functools import total_ordering | ||
| 9 | |||
| 10 | |||
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index d1359f0100..cb0b3b3345 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py | |||
| @@ -10,17 +10,17 @@ BitBake build tools. | |||
| 10 | # SPDX-License-Identifier: GPL-2.0-only | 10 | # SPDX-License-Identifier: GPL-2.0-only |
| 11 | # | 11 | # |
| 12 | 12 | ||
| 13 | import sys | ||
| 14 | import pickle | ||
| 15 | import logging | ||
| 16 | import atexit | ||
| 17 | import traceback | ||
| 18 | import ast | 13 | import ast |
| 14 | import atexit | ||
| 15 | import collections | ||
| 16 | import logging | ||
| 17 | import pickle | ||
| 18 | import sys | ||
| 19 | import threading | 19 | import threading |
| 20 | import traceback | ||
| 20 | 21 | ||
| 21 | import bb.utils | ||
| 22 | import bb.compat | ||
| 23 | import bb.exceptions | 22 | import bb.exceptions |
| 23 | import bb.utils | ||
| 24 | 24 | ||
| 25 | # This is the pid for which we should generate the event. This is set when | 25 | # This is the pid for which we should generate the event. This is set when |
| 26 | # the runqueue forks off. | 26 | # the runqueue forks off. |
| @@ -56,7 +56,7 @@ def set_class_handlers(h): | |||
| 56 | _handlers = h | 56 | _handlers = h |
| 57 | 57 | ||
| 58 | def clean_class_handlers(): | 58 | def clean_class_handlers(): |
| 59 | return bb.compat.OrderedDict() | 59 | return collections.OrderedDict() |
| 60 | 60 | ||
| 61 | # Internal | 61 | # Internal |
| 62 | _handlers = clean_class_handlers() | 62 | _handlers = clean_class_handlers() |
diff --git a/bitbake/lib/bb/persist_data.py b/bitbake/lib/bb/persist_data.py index 7357ab2d44..5f4fbe3508 100644 --- a/bitbake/lib/bb/persist_data.py +++ b/bitbake/lib/bb/persist_data.py | |||
| @@ -12,14 +12,14 @@ currently, providing a key/value store accessed by 'domain'. | |||
| 12 | # | 12 | # |
| 13 | 13 | ||
| 14 | import collections | 14 | import collections |
| 15 | import contextlib | ||
| 16 | import functools | ||
| 15 | import logging | 17 | import logging |
| 16 | import os.path | 18 | import os.path |
| 19 | import sqlite3 | ||
| 17 | import sys | 20 | import sys |
| 18 | import warnings | 21 | import warnings |
| 19 | from bb.compat import total_ordering | ||
| 20 | from collections import Mapping | 22 | from collections import Mapping |
| 21 | import sqlite3 | ||
| 22 | import contextlib | ||
| 23 | 23 | ||
| 24 | sqlversion = sqlite3.sqlite_version_info | 24 | sqlversion = sqlite3.sqlite_version_info |
| 25 | if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3): | 25 | if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3): |
| @@ -28,7 +28,7 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3): | |||
| 28 | 28 | ||
| 29 | logger = logging.getLogger("BitBake.PersistData") | 29 | logger = logging.getLogger("BitBake.PersistData") |
| 30 | 30 | ||
| 31 | @total_ordering | 31 | @functools.total_ordering |
| 32 | class SQLTable(collections.MutableMapping): | 32 | class SQLTable(collections.MutableMapping): |
| 33 | class _Decorators(object): | 33 | class _Decorators(object): |
| 34 | @staticmethod | 34 | @staticmethod |
diff --git a/bitbake/lib/bb/tests/event.py b/bitbake/lib/bb/tests/event.py index 9229b63d47..9ca7e9bc8e 100644 --- a/bitbake/lib/bb/tests/event.py +++ b/bitbake/lib/bb/tests/event.py | |||
| @@ -6,17 +6,18 @@ | |||
| 6 | # SPDX-License-Identifier: GPL-2.0-only | 6 | # SPDX-License-Identifier: GPL-2.0-only |
| 7 | # | 7 | # |
| 8 | 8 | ||
| 9 | import unittest | 9 | import collections |
| 10 | import bb | ||
| 11 | import logging | ||
| 12 | import bb.compat | ||
| 13 | import bb.event | ||
| 14 | import importlib | 10 | import importlib |
| 11 | import logging | ||
| 12 | import pickle | ||
| 15 | import threading | 13 | import threading |
| 16 | import time | 14 | import time |
| 17 | import pickle | 15 | import unittest |
| 18 | from unittest.mock import Mock | 16 | from unittest.mock import Mock |
| 19 | from unittest.mock import call | 17 | from unittest.mock import call |
| 18 | |||
| 19 | import bb | ||
| 20 | import bb.event | ||
| 20 | from bb.msg import BBLogFormatter | 21 | from bb.msg import BBLogFormatter |
| 21 | 22 | ||
| 22 | 23 | ||
| @@ -75,7 +76,7 @@ class EventHandlingTest(unittest.TestCase): | |||
| 75 | 76 | ||
| 76 | def _create_test_handlers(self): | 77 | def _create_test_handlers(self): |
| 77 | """ Method used to create a test handler ordered dictionary """ | 78 | """ Method used to create a test handler ordered dictionary """ |
| 78 | test_handlers = bb.compat.OrderedDict() | 79 | test_handlers = collections.OrderedDict() |
| 79 | test_handlers["handler1"] = self._test_process.handler1 | 80 | test_handlers["handler1"] = self._test_process.handler1 |
| 80 | test_handlers["handler2"] = self._test_process.handler2 | 81 | test_handlers["handler2"] = self._test_process.handler2 |
| 81 | return test_handlers | 82 | return test_handlers |
| @@ -96,7 +97,7 @@ class EventHandlingTest(unittest.TestCase): | |||
| 96 | 97 | ||
| 97 | def test_clean_class_handlers(self): | 98 | def test_clean_class_handlers(self): |
| 98 | """ Test clean_class_handlers method """ | 99 | """ Test clean_class_handlers method """ |
| 99 | cleanDict = bb.compat.OrderedDict() | 100 | cleanDict = collections.OrderedDict() |
| 100 | self.assertEqual(cleanDict, | 101 | self.assertEqual(cleanDict, |
| 101 | bb.event.clean_class_handlers()) | 102 | bb.event.clean_class_handlers()) |
| 102 | 103 | ||
