summaryrefslogtreecommitdiff
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/__init__.py3
-rw-r--r--bitbake/lib/bb/build.py1
-rw-r--r--bitbake/lib/bb/cache.py7
-rw-r--r--bitbake/lib/bb/cooker.py7
-rw-r--r--bitbake/lib/bb/data_smart.py5
-rw-r--r--bitbake/lib/bb/event.py2
-rw-r--r--bitbake/lib/bb/fetch/repo.py3
-rw-r--r--bitbake/lib/bb/msg.py7
-rw-r--r--bitbake/lib/bb/parse/ast.py1
-rw-r--r--bitbake/lib/bb/parse/parse_py/BBHandler.py6
-rw-r--r--bitbake/lib/bb/parse/parse_py/ConfHandler.py2
-rw-r--r--bitbake/lib/bb/runqueue.py2
-rw-r--r--bitbake/lib/bb/shell.py4
-rw-r--r--bitbake/lib/bb/utils.py23
14 files changed, 33 insertions, 40 deletions
diff --git a/bitbake/lib/bb/__init__.py b/bitbake/lib/bb/__init__.py
index 3ba6beb2c..7e2933eb8 100644
--- a/bitbake/lib/bb/__init__.py
+++ b/bitbake/lib/bb/__init__.py
@@ -53,7 +53,8 @@ __all__ = [
"providers",
]
-import sys, os, types, re, string
+import os
+import bb.msg
if "BBDEBUG" in os.environ:
level = int(os.environ["BBDEBUG"])
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 7ca1663b7..1882733a5 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -200,7 +200,6 @@ def exec_func(func, d, dirs = None):
def exec_func_python(func, d, runfile, logfile):
"""Execute a python BB 'function'"""
- import re, os
bbfile = bb.data.getVar('FILE', d, 1)
tmp = "def " + func + "(d):\n%s" % data.getVar(func, d)
diff --git a/bitbake/lib/bb/cache.py b/bitbake/lib/bb/cache.py
index 300acc5fc..0d165aec2 100644
--- a/bitbake/lib/bb/cache.py
+++ b/bitbake/lib/bb/cache.py
@@ -28,7 +28,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import os, re
+import os
import bb.data
import bb.utils
@@ -452,14 +452,13 @@ class Cache:
Return the data and whether parsing resulted in the file being skipped
"""
- import bb
- from bb import utils, data, parse, debug, event, fatal
+ from bb import data, parse
# expand tmpdir to include this topdir
data.setVar('TMPDIR', data.getVar('TMPDIR', config, 1) or "", config)
bbfile_loc = os.path.abspath(os.path.dirname(bbfile))
oldpath = os.path.abspath(os.getcwd())
- if bb.parse.cached_mtime_noerror(bbfile_loc):
+ if parse.cached_mtime_noerror(bbfile_loc):
os.chdir(bbfile_loc)
bb_data = data.init_db(config)
try:
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index 743e4be06..6090efcad 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -22,11 +22,10 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import sys, os, getopt, glob, copy, os.path, re, time
+import sys, os, glob, os.path, re, time
import bb
-from bb import utils, data, parse, event, cache, providers, taskdata, runqueue
-from bb import command
-import itertools, sre_constants
+from bb import utils, data, parse, event, cache, providers, taskdata, command, runqueue
+import sre_constants
class MultipleMatches(Exception):
"""
diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 5ff0b37bf..7f46b4abb 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -28,11 +28,10 @@ BitBake build tools.
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# Based on functions from the base bb module, Copyright 2003 Holger Schurig
-import copy, os, re, sys, time, types
+import copy, re, sys, types
import bb
-from bb import utils, methodpool
+from bb import utils
from bb.COW import COWDictBase
-from new import classobj
__setvar_keyword__ = ["_append", "_prepend"]
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 456b89caf..f0690b4f2 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -22,7 +22,7 @@ BitBake build tools.
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import os, re, sys
+import os, sys
import warnings
import bb.utils
import pickle
diff --git a/bitbake/lib/bb/fetch/repo.py b/bitbake/lib/bb/fetch/repo.py
index 34c32fe0b..883310b01 100644
--- a/bitbake/lib/bb/fetch/repo.py
+++ b/bitbake/lib/bb/fetch/repo.py
@@ -23,11 +23,10 @@ BitBake "Fetch" repo (git) implementation
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import os, re
+import os
import bb
from bb import data
from bb.fetch import Fetch
-from bb.fetch import FetchError
from bb.fetch import runfetchcmd
class Repo(Fetch):
diff --git a/bitbake/lib/bb/msg.py b/bitbake/lib/bb/msg.py
index 17d1a0852..788e1dddf 100644
--- a/bitbake/lib/bb/msg.py
+++ b/bitbake/lib/bb/msg.py
@@ -22,9 +22,10 @@ Message handling infrastructure for bitbake
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import sys, bb
+import sys
import collections
-from bb import event
+import bb
+import bb.event
debug_level = collections.defaultdict(lambda: 0)
verbose = False
@@ -54,7 +55,7 @@ class MsgBase(bb.event.Event):
def __init__(self, msg):
self._message = msg
- event.Event.__init__(self)
+ bb.event.Event.__init__(self)
class MsgDebug(MsgBase):
"""Debug Message"""
diff --git a/bitbake/lib/bb/parse/ast.py b/bitbake/lib/bb/parse/ast.py
index 6d4f28562..a586c5cde 100644
--- a/bitbake/lib/bb/parse/ast.py
+++ b/bitbake/lib/bb/parse/ast.py
@@ -22,6 +22,7 @@
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
import bb, re, string
+from bb import methodpool
from itertools import chain
__word__ = re.compile(r"\S+")
diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py
index f9f185ff7..c053b5bfd 100644
--- a/bitbake/lib/bb/parse/parse_py/BBHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py
@@ -25,12 +25,12 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import re, bb, os, sys, time, string
+import re, bb, os
import bb.fetch, bb.build, bb.utils
-from bb import data, fetch
+from bb import data
from ConfHandler import include, init
-from bb.parse import ParseError, resolve_file, ast
+from bb.parse import resolve_file, ast
# For compatibility
from bb.parse import vars_from_file
diff --git a/bitbake/lib/bb/parse/parse_py/ConfHandler.py b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
index e50acbe5e..8e17182ba 100644
--- a/bitbake/lib/bb/parse/parse_py/ConfHandler.py
+++ b/bitbake/lib/bb/parse/parse_py/ConfHandler.py
@@ -24,7 +24,7 @@
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import re, bb.data, os, sys
+import re, bb.data, os
import bb.utils
from bb.parse import ParseError, resolve_file, ast
diff --git a/bitbake/lib/bb/runqueue.py b/bitbake/lib/bb/runqueue.py
index 2ecfd0946..9881315b9 100644
--- a/bitbake/lib/bb/runqueue.py
+++ b/bitbake/lib/bb/runqueue.py
@@ -22,8 +22,8 @@ Handles preparation and execution of a queue of tasks
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-from bb import msg, data, event, mkdirhier, utils
import bb, os, sys
+from bb import msg, data, event
import signal
import stat
import fcntl
diff --git a/bitbake/lib/bb/shell.py b/bitbake/lib/bb/shell.py
index 512bcbf07..71dd599ed 100644
--- a/bitbake/lib/bb/shell.py
+++ b/bitbake/lib/bb/shell.py
@@ -56,8 +56,8 @@ try:
set
except NameError:
from sets import Set as set
-import sys, os, readline, socket, httplib, urllib, commands, popen2, copy, shlex, Queue, fnmatch
-from bb import data, parse, build, fatal, cache, taskdata, runqueue, providers as Providers
+import sys, os, readline, socket, httplib, urllib, commands, popen2, shlex, Queue, fnmatch
+from bb import data, parse, build, cache, taskdata, runqueue, providers as Providers
__version__ = "0.5.3.1"
__credits__ = """BitBake Shell Version %s (C) 2005 Michael 'Mickey' Lauer <mickey@Vanille.de>
diff --git a/bitbake/lib/bb/utils.py b/bitbake/lib/bb/utils.py
index 93c158c60..132d5e56b 100644
--- a/bitbake/lib/bb/utils.py
+++ b/bitbake/lib/bb/utils.py
@@ -19,7 +19,11 @@ BitBake Utility Functions
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-import re, fcntl, os, types, bb, string, stat, shutil, time
+import re, fcntl, os, types, string, stat, shutil, time
+import sys
+import bb
+import errno
+import bb.msg
from commands import getstatusoutput
# Version comparison
@@ -287,8 +291,6 @@ def _print_trace(body, line):
"""
Print the Environment of a Text Body
"""
- import bb
-
# print the environment of the method
bb.msg.error(bb.msg.domain.Util, "Printing the environment of the function")
min_line = max(1, line-4)
@@ -305,8 +307,6 @@ def better_compile(text, file, realfile, mode = "exec"):
try:
return compile(text, file, mode)
except Exception, e:
- import bb, sys
-
# split the text into lines again
body = text.split('\n')
bb.msg.error(bb.msg.domain.Util, "Error in compiling python function in: ", realfile)
@@ -324,7 +324,7 @@ def better_exec(code, context, text, realfile):
print the lines that are responsible for the
error.
"""
- import bb, sys
+ import bb.parse
try:
exec code in _context, context
except:
@@ -361,7 +361,6 @@ def lockfile(name):
"""
path = os.path.dirname(name)
if not os.path.isdir(path):
- import bb, sys
bb.msg.error(bb.msg.domain.Util, "Error, lockfile path does not exist!: %s" % path)
sys.exit(1)
@@ -467,8 +466,6 @@ def filter_environment(good_vars):
are not known and may influence the build in a negative way.
"""
- import bb
-
removed_vars = []
for key in os.environ.keys():
if key in good_vars:
@@ -509,7 +506,7 @@ def build_environment(d):
"""
Build an environment from all exported variables.
"""
- import bb
+ import bb.data
for var in bb.data.keys(d):
export = bb.data.getVarFlag(var, "export", d)
if export:
@@ -550,9 +547,8 @@ def mkdirhier(dir):
os.makedirs(dir)
bb.msg.debug(2, bb.msg.domain.Util, "created " + dir)
except OSError, e:
- if e.errno != 17: raise e
-
-import stat
+ if e.errno != errno.EEXIST:
+ raise e
def movefile(src, dest, newmtime = None, sstat = None):
"""Moves a file from src to dest, preserving all permissions and
@@ -603,7 +599,6 @@ def movefile(src, dest, newmtime = None, sstat = None):
ret = os.rename(src, dest)
renamefailed = 0
except Exception, e:
- import errno
if e[0] != errno.EXDEV:
# Some random error.
print "movefile: Failed to move", src, "to", dest, e