From 3eb2e6cf02155c3fce0a49bd967545cacfc08fb3 Mon Sep 17 00:00:00 2001 From: Chris Larson Date: Tue, 21 Jul 2009 16:22:30 -0700 Subject: bitbake: [parse] Move vars_from_file from bb.parse.BBHandler into bb.parse. (Bitbake rev: fda0707d772e0964a0185d4ec4d016522f6972f3) Signed-off-by: Chris Larson Signed-off-by: Richard Purdie --- bitbake/lib/bb/parse/__init__.py | 20 ++++++++++++++++++++ bitbake/lib/bb/parse/parse_py/BBHandler.py | 24 +++--------------------- 2 files changed, 23 insertions(+), 21 deletions(-) (limited to 'bitbake') diff --git a/bitbake/lib/bb/parse/__init__.py b/bitbake/lib/bb/parse/__init__.py index fe5d489b72..b1308b3b04 100644 --- a/bitbake/lib/bb/parse/__init__.py +++ b/bitbake/lib/bb/parse/__init__.py @@ -103,5 +103,25 @@ def resolve_file(fn, d): bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % abs_fn) return (f, abs_fn) +# Used by OpenEmbedded metadata +__pkgsplit_cache__={} +def vars_from_file(mypkg, d): + if not mypkg: + return (None, None, None) + if mypkg in __pkgsplit_cache__: + return __pkgsplit_cache__[mypkg] + + myfile = os.path.splitext(os.path.basename(mypkg)) + parts = myfile[0].split('_') + __pkgsplit_cache__[mypkg] = parts + if len(parts) > 3: + raise ParseError("Unable to generate default variables from the filename: %s (too many underscores)" % mypkg) + exp = 3 - len(parts) + tmplist = [] + while exp != 0: + exp -= 1 + tmplist.append(None) + parts.extend(tmplist) + return parts from bb.parse.parse_py import __version__, ConfHandler, BBHandler diff --git a/bitbake/lib/bb/parse/parse_py/BBHandler.py b/bitbake/lib/bb/parse/parse_py/BBHandler.py index 06b253899d..32e0901e25 100644 --- a/bitbake/lib/bb/parse/parse_py/BBHandler.py +++ b/bitbake/lib/bb/parse/parse_py/BBHandler.py @@ -32,6 +32,9 @@ from bb import data, fetch from ConfHandler import include, init from bb.parse import ParseError, resolve_file, ast +# For compatibility +from bb.parse import vars_from_file + __func_start_regexp__ = re.compile( r"(((?Ppython)|(?Pfakeroot))\s*)*(?P[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) __inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) __export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" ) @@ -230,27 +233,6 @@ def feeder(lineno, s, fn, root, d, statements): from bb.parse import ConfHandler return ConfHandler.feeder(lineno, s, fn, d, statements) -# Used by OpenEmbedded metadata -__pkgsplit_cache__={} -def vars_from_file(mypkg, d): - if not mypkg: - return (None, None, None) - if mypkg in __pkgsplit_cache__: - return __pkgsplit_cache__[mypkg] - - myfile = os.path.splitext(os.path.basename(mypkg)) - parts = myfile[0].split('_') - __pkgsplit_cache__[mypkg] = parts - if len(parts) > 3: - raise ParseError("Unable to generate default variables from the filename: %s (too many underscores)" % mypkg) - exp = 3 - len(parts) - tmplist = [] - while exp != 0: - exp -= 1 - tmplist.append(None) - parts.extend(tmplist) - return parts - # Add us to the handlers list from bb.parse import handlers handlers.append({'supports': supports, 'handle': handle, 'init': init}) -- cgit v1.2.3-54-g00ecf