From 0ac5174c7d39a3e49893df0d517d47bec1935555 Mon Sep 17 00:00:00 2001 From: Frazer Clews Date: Thu, 16 Jan 2020 16:55:18 +0000 Subject: bitbake: lib: remove unused imports removed unused imports which made the code harder to read, and slightly but less efficient (Bitbake rev: 4367692a932ac135c5aa4f9f2a4e4f0150f76697) Signed-off-by: Frazer Clews Signed-off-by: Richard Purdie --- bitbake/lib/bb/COW.py | 1 - bitbake/lib/bb/build.py | 1 - bitbake/lib/bb/cache.py | 1 - bitbake/lib/bb/checksum.py | 1 - bitbake/lib/bb/codeparser.py | 26 ++------------------------ bitbake/lib/bb/cooker.py | 4 ---- bitbake/lib/bb/event.py | 3 +-- bitbake/lib/bb/fetch2/bzr.py | 2 -- bitbake/lib/bb/fetch2/clearcase.py | 1 - bitbake/lib/bb/fetch2/cvs.py | 1 - bitbake/lib/bb/fetch2/gitannex.py | 2 -- bitbake/lib/bb/fetch2/gitsm.py | 1 - bitbake/lib/bb/fetch2/hg.py | 2 -- bitbake/lib/bb/fetch2/npm.py | 1 - bitbake/lib/bb/fetch2/osc.py | 2 -- bitbake/lib/bb/fetch2/perforce.py | 1 - bitbake/lib/bb/fetch2/ssh.py | 2 -- bitbake/lib/bb/fetch2/svn.py | 2 -- bitbake/lib/bb/fetch2/wget.py | 3 --- bitbake/lib/bb/monitordisk.py | 2 +- bitbake/lib/bb/msg.py | 2 -- bitbake/lib/bb/parse/ast.py | 4 ---- bitbake/lib/bb/parse/parse_py/BBHandler.py | 2 -- bitbake/lib/bb/progress.py | 1 - bitbake/lib/bb/runqueue.py | 4 +--- bitbake/lib/bb/server/xmlrpcclient.py | 3 --- bitbake/lib/bb/server/xmlrpcserver.py | 3 --- bitbake/lib/bb/tests/cooker.py | 1 - bitbake/lib/bb/tests/cow.py | 2 +- bitbake/lib/bb/tests/fetch.py | 1 - bitbake/lib/bb/tests/runqueue.py | 1 - bitbake/lib/bb/tinfoil.py | 4 ++-- bitbake/lib/bb/ui/knotty.py | 1 - bitbake/lib/bb/ui/ncurses.py | 3 +-- bitbake/lib/bb/ui/taskexp.py | 2 -- bitbake/lib/bb/utils.py | 1 - 36 files changed, 9 insertions(+), 85 deletions(-) (limited to 'bitbake/lib/bb') diff --git a/bitbake/lib/bb/COW.py b/bitbake/lib/bb/COW.py index d26e981951..bc20ce38e2 100644 --- a/bitbake/lib/bb/COW.py +++ b/bitbake/lib/bb/COW.py @@ -10,7 +10,6 @@ import copy -import types ImmutableTypes = ( bool, complex, diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index 3d9cc10c8c..b6d23e6805 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py @@ -15,7 +15,6 @@ import os import sys import logging -import shlex import glob import time import stat diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py index ead8abc5d8..a5aaf3b999 100644 --- a/bitbake/lib/bb/cache.py +++ b/bitbake/lib/bb/cache.py @@ -17,7 +17,6 @@ # import os -import sys import logging import pickle from collections import defaultdict diff --git a/bitbake/lib/bb/checksum.py b/bitbake/lib/bb/checksum.py index 677020f497..1d50a26426 100644 --- a/bitbake/lib/bb/checksum.py +++ b/bitbake/lib/bb/checksum.py @@ -9,7 +9,6 @@ import glob import operator import os import stat -import pickle import bb.utils import logging from bb.cache import MultiProcessCache diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py index fd2c4734f0..25a7ac69d3 100644 --- a/bitbake/lib/bb/codeparser.py +++ b/bitbake/lib/bb/codeparser.py @@ -25,13 +25,11 @@ import ast import sys import codegen import logging -import pickle import bb.pysh as pysh -import os.path import bb.utils, bb.data import hashlib from itertools import chain -from bb.pysh import pyshyacc, pyshlex, sherrors +from bb.pysh import pyshyacc, pyshlex from bb.cache import MultiProcessCache logger = logging.getLogger('BitBake.CodeParser') @@ -58,30 +56,10 @@ def check_indent(codestr): return codestr - -# Basically pickle, in python 2.7.3 at least, does badly with data duplication -# upon pickling and unpickling. Combine this with duplicate objects and things -# are a mess. -# -# When the sets are originally created, python calls intern() on the set keys -# which significantly improves memory usage. Sadly the pickle/unpickle process -# doesn't call intern() on the keys and results in the same strings being duplicated -# in memory. This also means pickle will save the same string multiple times in -# the cache file. -# -# By having shell and python cacheline objects with setstate/getstate, we force -# the object creation through our own routine where we can call intern (via internSet). -# -# We also use hashable frozensets and ensure we use references to these so that -# duplicates can be removed, both in memory and in the resulting pickled data. -# -# By playing these games, the size of the cache file shrinks dramatically -# meaning faster load times and the reloaded cache files also consume much less -# memory. Smaller cache files, faster load times and lower memory usage is good. -# # A custom getstate/setstate using tuples is actually worth 15% cachesize by # avoiding duplication of the attribute names! + class SetCache(object): def __init__(self): self.setcache = {} diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index b74affa7ec..3d65b0cb74 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -10,7 +10,6 @@ # import sys, os, glob, os.path, re, time -import atexit import itertools import logging import multiprocessing @@ -18,14 +17,11 @@ import sre_constants import threading from io import StringIO, UnsupportedOperation from contextlib import closing -from functools import wraps from collections import defaultdict, namedtuple import bb, bb.exceptions, bb.command from bb import utils, data, parse, event, cache, providers, taskdata, runqueue, build import queue import signal -import subprocess -import errno import prserv.serv import pyinotify import json diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index d44621edf4..42143e7407 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -10,8 +10,7 @@ BitBake build tools. # SPDX-License-Identifier: GPL-2.0-only # -import os, sys -import warnings +import sys import pickle import logging import atexit diff --git a/bitbake/lib/bb/fetch2/bzr.py b/bitbake/lib/bb/fetch2/bzr.py index c56d875300..566ace9f05 100644 --- a/bitbake/lib/bb/fetch2/bzr.py +++ b/bitbake/lib/bb/fetch2/bzr.py @@ -14,8 +14,6 @@ BitBake 'Fetch' implementation for bzr. # import os -import sys -import logging import bb from bb.fetch2 import FetchMethod from bb.fetch2 import FetchError diff --git a/bitbake/lib/bb/fetch2/clearcase.py b/bitbake/lib/bb/fetch2/clearcase.py index ad2f3edc74..49d7ae1b09 100644 --- a/bitbake/lib/bb/fetch2/clearcase.py +++ b/bitbake/lib/bb/fetch2/clearcase.py @@ -49,7 +49,6 @@ User credentials: # import os -import sys import shutil import bb from bb.fetch2 import FetchMethod diff --git a/bitbake/lib/bb/fetch2/cvs.py b/bitbake/lib/bb/fetch2/cvs.py index 1b35ba4cf0..29123a483c 100644 --- a/bitbake/lib/bb/fetch2/cvs.py +++ b/bitbake/lib/bb/fetch2/cvs.py @@ -14,7 +14,6 @@ BitBake build tools. # import os -import logging import bb from bb.fetch2 import FetchMethod, FetchError, MissingParameterError, logger from bb.fetch2 import runfetchcmd diff --git a/bitbake/lib/bb/fetch2/gitannex.py b/bitbake/lib/bb/fetch2/gitannex.py index 1d497dcb0f..80a808d88f 100644 --- a/bitbake/lib/bb/fetch2/gitannex.py +++ b/bitbake/lib/bb/fetch2/gitannex.py @@ -8,11 +8,9 @@ BitBake 'Fetch' git annex implementation # SPDX-License-Identifier: GPL-2.0-only # -import os import bb from bb.fetch2.git import Git from bb.fetch2 import runfetchcmd -from bb.fetch2 import logger class GitANNEX(Git): def supports(self, ud, d): diff --git a/bitbake/lib/bb/fetch2/gitsm.py b/bitbake/lib/bb/fetch2/gitsm.py index c622771d21..aa121cbee1 100644 --- a/bitbake/lib/bb/fetch2/gitsm.py +++ b/bitbake/lib/bb/fetch2/gitsm.py @@ -24,7 +24,6 @@ from bb.fetch2.git import Git from bb.fetch2 import runfetchcmd from bb.fetch2 import logger from bb.fetch2 import Fetch -from bb.fetch2 import BBFetchException class GitSM(Git): def supports(self, ud, d): diff --git a/bitbake/lib/bb/fetch2/hg.py b/bitbake/lib/bb/fetch2/hg.py index e21115debf..8f503701ed 100644 --- a/bitbake/lib/bb/fetch2/hg.py +++ b/bitbake/lib/bb/fetch2/hg.py @@ -13,8 +13,6 @@ BitBake 'Fetch' implementation for mercurial DRCS (hg). # import os -import sys -import logging import bb import errno from bb.fetch2 import FetchMethod diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py index 9700e61029..be21399e59 100644 --- a/bitbake/lib/bb/fetch2/npm.py +++ b/bitbake/lib/bb/fetch2/npm.py @@ -20,7 +20,6 @@ Usage in the recipe: """ import os -import sys import urllib.request, urllib.parse, urllib.error import json import subprocess diff --git a/bitbake/lib/bb/fetch2/osc.py b/bitbake/lib/bb/fetch2/osc.py index 3e567155dc..f55db6f791 100644 --- a/bitbake/lib/bb/fetch2/osc.py +++ b/bitbake/lib/bb/fetch2/osc.py @@ -7,8 +7,6 @@ Based on the svn "Fetch" implementation. """ -import os -import sys import logging import bb from bb.fetch2 import FetchMethod diff --git a/bitbake/lib/bb/fetch2/perforce.py b/bitbake/lib/bb/fetch2/perforce.py index 54d001ec81..b2ac11ecab 100644 --- a/bitbake/lib/bb/fetch2/perforce.py +++ b/bitbake/lib/bb/fetch2/perforce.py @@ -11,7 +11,6 @@ BitBake 'Fetch' implementation for perforce # Based on functions from the base bb module, Copyright 2003 Holger Schurig import os -import logging import bb from bb.fetch2 import FetchMethod from bb.fetch2 import FetchError diff --git a/bitbake/lib/bb/fetch2/ssh.py b/bitbake/lib/bb/fetch2/ssh.py index f5be060c43..34debe399b 100644 --- a/bitbake/lib/bb/fetch2/ssh.py +++ b/bitbake/lib/bb/fetch2/ssh.py @@ -32,8 +32,6 @@ IETF secsh internet draft: import re, os from bb.fetch2 import FetchMethod -from bb.fetch2 import FetchError -from bb.fetch2 import logger from bb.fetch2 import runfetchcmd diff --git a/bitbake/lib/bb/fetch2/svn.py b/bitbake/lib/bb/fetch2/svn.py index 96d666ba33..6c8caf5fb9 100644 --- a/bitbake/lib/bb/fetch2/svn.py +++ b/bitbake/lib/bb/fetch2/svn.py @@ -11,8 +11,6 @@ BitBake 'Fetch' implementation for svn. # Based on functions from the base bb module, Copyright 2003 Holger Schurig import os -import sys -import logging import bb import re from bb.fetch2 import FetchMethod diff --git a/bitbake/lib/bb/fetch2/wget.py b/bitbake/lib/bb/fetch2/wget.py index 725586d2b5..72bc6c8f4d 100644 --- a/bitbake/lib/bb/fetch2/wget.py +++ b/bitbake/lib/bb/fetch2/wget.py @@ -14,9 +14,7 @@ BitBake build tools. import re import tempfile -import subprocess import os -import logging import errno import bb import bb.progress @@ -27,7 +25,6 @@ from bb.fetch2 import FetchMethod from bb.fetch2 import FetchError from bb.fetch2 import logger from bb.fetch2 import runfetchcmd -from bb.fetch2 import FetchConnectionCache from bb.utils import export_proxies from bs4 import BeautifulSoup from bs4 import SoupStrainer diff --git a/bitbake/lib/bb/monitordisk.py b/bitbake/lib/bb/monitordisk.py index 1a25b0041f..e7c07264a8 100644 --- a/bitbake/lib/bb/monitordisk.py +++ b/bitbake/lib/bb/monitordisk.py @@ -4,7 +4,7 @@ # SPDX-License-Identifier: GPL-2.0-only # -import os, logging, re, sys +import os, logging, re import bb logger = logging.getLogger("BitBake.Monitor") diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py index 6216eb3bc4..33c0e2fa19 100644 --- a/bitbake/lib/bb/msg.py +++ b/bitbake/lib/bb/msg.py @@ -13,9 +13,7 @@ Message handling infrastructure for bitbake import sys import copy import logging -import collections from itertools import groupby -import warnings import bb import bb.event diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py index f0911e6fb7..362c1a39ce 100644 --- a/bitbake/lib/bb/parse/ast.py +++ b/bitbake/lib/bb/parse/ast.py @@ -9,11 +9,7 @@ # SPDX-License-Identifier: GPL-2.0-only # -import re -import string -import logging import bb -import itertools from bb import methodpool from bb.parse import logger diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 6f7cf82b25..6e216effb8 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -13,9 +13,7 @@ # import re, bb, os -import logging import bb.build, bb.utils -from bb import data from . import ConfHandler from .. import resolve_file, ast, logger, ParseError diff --git a/bitbake/lib/bb/progress.py b/bitbake/lib/bb/progress.py index 4022caa717..9c755b7f73 100644 --- a/bitbake/lib/bb/progress.py +++ b/bitbake/lib/bb/progress.py @@ -7,7 +7,6 @@ BitBake progress handling code # SPDX-License-Identifier: GPL-2.0-only # -import sys import re import time import inspect diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py index d7186e8516..71108eeed7 100644 --- a/bitbake/lib/bb/runqueue.py +++ b/bitbake/lib/bb/runqueue.py @@ -12,14 +12,12 @@ Handles preparation and execution of a queue of tasks import copy import os import sys -import signal import stat -import fcntl import errno import logging import re import bb -from bb import msg, data, event +from bb import msg, event from bb import monitordisk import subprocess import pickle diff --git a/bitbake/lib/bb/server/xmlrpcclient.py b/bitbake/lib/bb/server/xmlrpcclient.py index c054c3c89d..442ea7b264 100644 --- a/bitbake/lib/bb/server/xmlrpcclient.py +++ b/bitbake/lib/bb/server/xmlrpcclient.py @@ -7,9 +7,6 @@ # SPDX-License-Identifier: GPL-2.0-only # -import os -import sys - import socket import http.client import xmlrpc.client diff --git a/bitbake/lib/bb/server/xmlrpcserver.py b/bitbake/lib/bb/server/xmlrpcserver.py index 54fa32f573..2fa71be667 100644 --- a/bitbake/lib/bb/server/xmlrpcserver.py +++ b/bitbake/lib/bb/server/xmlrpcserver.py @@ -7,9 +7,6 @@ # SPDX-License-Identifier: GPL-2.0-only # -import os -import sys - import hashlib import time import inspect diff --git a/bitbake/lib/bb/tests/cooker.py b/bitbake/lib/bb/tests/cooker.py index 090916e949..74c903f010 100644 --- a/bitbake/lib/bb/tests/cooker.py +++ b/bitbake/lib/bb/tests/cooker.py @@ -5,7 +5,6 @@ # import unittest -import tempfile import os import bb, bb.cooker import re diff --git a/bitbake/lib/bb/tests/cow.py b/bitbake/lib/bb/tests/cow.py index b4af4bbcbf..bf6e79fcee 100644 --- a/bitbake/lib/bb/tests/cow.py +++ b/bitbake/lib/bb/tests/cow.py @@ -7,7 +7,7 @@ # import unittest -import os + class COWTestCase(unittest.TestCase): """ diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 83fad3ff0d..4d347dead7 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py @@ -9,7 +9,6 @@ import unittest import hashlib import tempfile -import subprocess import collections import os from bb.fetch2 import URI diff --git a/bitbake/lib/bb/tests/runqueue.py b/bitbake/lib/bb/tests/runqueue.py index 20c88ac3d5..4ba12a0772 100644 --- a/bitbake/lib/bb/tests/runqueue.py +++ b/bitbake/lib/bb/tests/runqueue.py @@ -7,7 +7,6 @@ # import unittest -import bb import os import tempfile import subprocess diff --git a/bitbake/lib/bb/tinfoil.py b/bitbake/lib/bb/tinfoil.py index 0a1b913055..0bd7836323 100644 --- a/bitbake/lib/bb/tinfoil.py +++ b/bitbake/lib/bb/tinfoil.py @@ -21,8 +21,8 @@ import bb.taskdata import bb.utils import bb.command import bb.remotedata -from bb.cookerdata import CookerConfiguration, ConfigParameters -from bb.main import setup_bitbake, BitBakeConfigParameters, BBMainException +from bb.cookerdata import CookerConfiguration +from bb.main import setup_bitbake, BitBakeConfigParameters import bb.fetch2 diff --git a/bitbake/lib/bb/ui/knotty.py b/bitbake/lib/bb/ui/knotty.py index c6abb2a114..19008a4ead 100644 --- a/bitbake/lib/bb/ui/knotty.py +++ b/bitbake/lib/bb/ui/knotty.py @@ -12,7 +12,6 @@ from __future__ import division import os import sys -import xmlrpc.client as xmlrpclib import logging import progressbar import signal diff --git a/bitbake/lib/bb/ui/ncurses.py b/bitbake/lib/bb/ui/ncurses.py index c422732b26..49569e375b 100644 --- a/bitbake/lib/bb/ui/ncurses.py +++ b/bitbake/lib/bb/ui/ncurses.py @@ -37,7 +37,7 @@ import logging -import os, sys, itertools, time, subprocess +import os, sys, itertools, time try: import curses @@ -46,7 +46,6 @@ except ImportError: import bb import xmlrpc.client -from bb import ui from bb.ui import uihelper parsespin = itertools.cycle( r'|/-\\' ) diff --git a/bitbake/lib/bb/ui/taskexp.py b/bitbake/lib/bb/ui/taskexp.py index 50a943cd05..7895102b95 100644 --- a/bitbake/lib/bb/ui/taskexp.py +++ b/bitbake/lib/bb/ui/taskexp.py @@ -11,10 +11,8 @@ import sys import gi gi.require_version('Gtk', '3.0') from gi.repository import Gtk, Gdk, GObject -from multiprocessing import Queue import threading from xmlrpc import client -import time import bb import bb.event diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py index d65265c461..06c8819d26 100644 --- a/bitbake/lib/bb/utils.py +++ b/bitbake/lib/bb/utils.py @@ -24,7 +24,6 @@ import fnmatch import traceback import errno import signal -import ast import collections import copy from subprocess import getstatusoutput -- cgit v1.2.3-54-g00ecf