[oe-commits] Richard Purdie : base.bbclass: Drop import bb and import os as no longer needed
git version control
git at git.openembedded.org
Mon Nov 9 12:14:01 UTC 2009
Module: openembedded.git
Branch: rpurdie/work-in-progress
Commit: 25600181dad048ed981a17b145256d5bfd1509cb
URL: http://gitweb.openembedded.net/?p=openembedded.git&a=commit;h=25600181dad048ed981a17b145256d5bfd1509cb
Author: Richard Purdie <rpurdie at linux.intel.com>
Date: Sun Nov 8 20:54:00 2009 +0000
base.bbclass: Drop import bb and import os as no longer needed
Signed-off-by: Richard Purdie <rpurdie at linux.intel.com>
---
classes/base.bbclass | 28 +++++-----------------------
1 files changed, 5 insertions(+), 23 deletions(-)
diff --git a/classes/base.bbclass b/classes/base.bbclass
index 84a8cc9..cf0da7b 100644
--- a/classes/base.bbclass
+++ b/classes/base.bbclass
@@ -49,7 +49,7 @@ def base_path_out(path, d):
# for MD5/SHA handling
def base_chk_load_parser(config_paths):
- import ConfigParser, os, bb
+ import ConfigParser
parser = ConfigParser.ConfigParser()
if len(parser.read(config_paths)) < 1:
raise ValueError("no ini files could be found")
@@ -57,7 +57,6 @@ def base_chk_load_parser(config_paths):
return parser
def base_chk_file(parser, pn, pv, src_uri, localpath, data):
- import os, bb
no_checksum = False
# Try PN-PV-SRC_URI first and then try PN-SRC_URI
# we rely on the get method to create errors
@@ -128,7 +127,6 @@ def base_chk_file(parser, pn, pv, src_uri, localpath, data):
def base_dep_prepend(d):
- import bb
#
# Ideally this will check a flag so we will operate properly in
# the case where host == build == target, for now we don't work in
@@ -150,7 +148,6 @@ def base_dep_prepend(d):
return deps
def base_read_file(filename):
- import bb
try:
f = file( filename, "r" )
except IOError, reason:
@@ -166,21 +163,18 @@ def base_ifelse(condition, iftrue = True, iffalse = False):
return iffalse
def base_conditional(variable, checkvalue, truevalue, falsevalue, d):
- import bb
if bb.data.getVar(variable,d,1) == checkvalue:
return truevalue
else:
return falsevalue
def base_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
- import bb
if float(bb.data.getVar(variable,d,1)) <= float(checkvalue):
return truevalue
else:
return falsevalue
def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
- import bb
result = bb.vercmp(bb.data.getVar(variable,d,True), checkvalue)
if result <= 0:
return truevalue
@@ -188,7 +182,6 @@ def base_version_less_or_equal(variable, checkvalue, truevalue, falsevalue, d):
return falsevalue
def base_contains(variable, checkvalues, truevalue, falsevalue, d):
- import bb
matches = 0
if type(checkvalues).__name__ == "str":
checkvalues = [checkvalues]
@@ -200,7 +193,6 @@ def base_contains(variable, checkvalues, truevalue, falsevalue, d):
return falsevalue
def base_both_contain(variable1, variable2, checkvalue, d):
- import bb
if bb.data.getVar(variable1,d,1).find(checkvalue) != -1 and bb.data.getVar(variable2,d,1).find(checkvalue) != -1:
return checkvalue
else:
@@ -211,8 +203,6 @@ DEPENDS_prepend="${@base_dep_prepend(d)} "
# Returns PN with various suffixes removed
# or PN if no matching suffix was found.
def base_package_name(d):
- import bb;
-
pn = bb.data.getVar('PN', d, 1)
if pn.endswith("-native"):
pn = pn[0:-7]
@@ -229,7 +219,6 @@ def base_package_name(d):
return pn
def base_set_filespath(path, d):
- import os, bb
bb.note("base_set_filespath usage is deprecated, %s should be fixed" % d.getVar("P", 1))
filespath = []
# The ":" ensures we have an 'empty' override
@@ -448,7 +437,6 @@ oe_libinstall() {
}
def package_stagefile(file, d):
- import bb, os
if bb.data.getVar('PSTAGING_ACTIVE', d, True) == "1":
destfile = file.replace(bb.data.getVar("TMPDIR", d, 1), bb.data.getVar("PSTAGE_TMPDIR_STAGE", d, 1))
@@ -553,7 +541,6 @@ do_distclean[dirs] = "${TOPDIR}"
do_distclean[nostamp] = "1"
python base_do_distclean() {
"""clear downloaded sources, build and temp directories"""
- import os
bb.build.exec_func('do_clean', d)
@@ -731,7 +718,7 @@ def subprocess_setup():
signal.signal(signal.SIGPIPE, signal.SIG_DFL)
def oe_unpack_file(file, data, url = None):
- import bb, os, subprocess
+ import subprocess
if not url:
url = "file://%s" % file
dots = file.split(".")
@@ -809,7 +796,7 @@ def oe_unpack_file(file, data, url = None):
addtask unpack after do_fetch
do_unpack[dirs] = "${WORKDIR}"
python base_do_unpack() {
- import re, os
+ import re
localdata = bb.data.createCopy(d)
bb.data.update_data(localdata)
@@ -836,7 +823,6 @@ METADATA_REVISION = "${@base_get_scm_revision(d)}"
METADATA_BRANCH = "${@base_get_scm_branch(d)}"
def base_get_scm(d):
- import os
from bb import which
baserepo = os.path.dirname(os.path.dirname(which(d.getVar("BBPATH", 1), "classes/base.bbclass")))
for (scm, scmpath) in {"svn": ".svn",
@@ -897,7 +883,6 @@ def base_get_metadata_svn_revision(path, d):
return revision
def base_get_metadata_git_branch(path, d):
- import os
branch = os.popen('cd %s; PATH=%s git symbolic-ref HEAD 2>/dev/null' % (path, d.getVar("PATH", 1))).read().rstrip()
if len(branch) != 0:
@@ -905,7 +890,6 @@ def base_get_metadata_git_branch(path, d):
return "<unknown>"
def base_get_metadata_git_revision(path, d):
- import os
rev = os.popen("cd %s; PATH=%s git show-ref HEAD 2>/dev/null" % (path, d.getVar("PATH", 1))).read().split(" ")[0].rstrip()
if len(rev) != 0:
return rev
@@ -916,7 +900,7 @@ addhandler base_eventhandler
python base_eventhandler() {
from bb import note, error, data
from bb.event import Handled, NotHandled, getName
- import os
+
name = getName(e)
if name == "TaskCompleted":
@@ -1052,7 +1036,6 @@ sysroot_stage_all() {
}
def is_legacy_staging(d):
- import bb
stagefunc = bb.data.getVar('do_stage', d, True)
legacy = True
if stagefunc is None:
@@ -1186,7 +1169,7 @@ DISTRO[unexport] = "1"
def base_after_parse(d):
- import bb, os, exceptions
+ import exceptions
source_mirror_fetch = bb.data.getVar('SOURCE_MIRROR_FETCH', d, 0)
if not source_mirror_fetch:
@@ -1269,7 +1252,6 @@ def base_after_parse(d):
bb.data.setVar('MULTIMACH_ARCH', multiarch, d)
python () {
- import bb
base_after_parse(d)
if is_legacy_staging(d):
More information about the Openembedded-commits
mailing list