diff options
author | Chris Larson <clarson@mvista.com> | 2009-07-21 16:22:30 -0700 |
---|---|---|
committer | Richard Purdie <rpurdie@linux.intel.com> | 2010-02-15 17:07:50 +0000 |
commit | 3eb2e6cf02155c3fce0a49bd967545cacfc08fb3 (patch) | |
tree | c88266cf31a750abec6e60cd15516b3eb8edbc2d /bitbake | |
parent | 6f52a1521ea2b13339222f677766714d053e1712 (diff) | |
download | poky-3eb2e6cf02155c3fce0a49bd967545cacfc08fb3.tar.gz |
bitbake: [parse] Move vars_from_file from bb.parse.BBHandler into bb.parse.
(Bitbake rev: fda0707d772e0964a0185d4ec4d016522f6972f3)
Signed-off-by: Chris Larson <clarson@mvista.com>
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/parse/__init__.py | 20 | ||||
-rw-r--r-- | bitbake/lib/bb/parse/parse_py/BBHandler.py | 24 |
2 files changed, 23 insertions, 21 deletions
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): | |||
103 | bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % abs_fn) | 103 | bb.msg.debug(2, bb.msg.domain.Parsing, "LOAD %s" % abs_fn) |
104 | return (f, abs_fn) | 104 | return (f, abs_fn) |
105 | 105 | ||
106 | # Used by OpenEmbedded metadata | ||
107 | __pkgsplit_cache__={} | ||
108 | def vars_from_file(mypkg, d): | ||
109 | if not mypkg: | ||
110 | return (None, None, None) | ||
111 | if mypkg in __pkgsplit_cache__: | ||
112 | return __pkgsplit_cache__[mypkg] | ||
113 | |||
114 | myfile = os.path.splitext(os.path.basename(mypkg)) | ||
115 | parts = myfile[0].split('_') | ||
116 | __pkgsplit_cache__[mypkg] = parts | ||
117 | if len(parts) > 3: | ||
118 | raise ParseError("Unable to generate default variables from the filename: %s (too many underscores)" % mypkg) | ||
119 | exp = 3 - len(parts) | ||
120 | tmplist = [] | ||
121 | while exp != 0: | ||
122 | exp -= 1 | ||
123 | tmplist.append(None) | ||
124 | parts.extend(tmplist) | ||
125 | return parts | ||
106 | 126 | ||
107 | from bb.parse.parse_py import __version__, ConfHandler, BBHandler | 127 | 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 | |||
32 | from ConfHandler import include, init | 32 | from ConfHandler import include, init |
33 | from bb.parse import ParseError, resolve_file, ast | 33 | from bb.parse import ParseError, resolve_file, ast |
34 | 34 | ||
35 | # For compatibility | ||
36 | from bb.parse import vars_from_file | ||
37 | |||
35 | __func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) | 38 | __func_start_regexp__ = re.compile( r"(((?P<py>python)|(?P<fr>fakeroot))\s*)*(?P<func>[\w\.\-\+\{\}\$]+)?\s*\(\s*\)\s*{$" ) |
36 | __inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) | 39 | __inherit_regexp__ = re.compile( r"inherit\s+(.+)" ) |
37 | __export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" ) | 40 | __export_func_regexp__ = re.compile( r"EXPORT_FUNCTIONS\s+(.+)" ) |
@@ -230,27 +233,6 @@ def feeder(lineno, s, fn, root, d, statements): | |||
230 | from bb.parse import ConfHandler | 233 | from bb.parse import ConfHandler |
231 | return ConfHandler.feeder(lineno, s, fn, d, statements) | 234 | return ConfHandler.feeder(lineno, s, fn, d, statements) |
232 | 235 | ||
233 | # Used by OpenEmbedded metadata | ||
234 | __pkgsplit_cache__={} | ||
235 | def vars_from_file(mypkg, d): | ||
236 | if not mypkg: | ||
237 | return (None, None, None) | ||
238 | if mypkg in __pkgsplit_cache__: | ||
239 | return __pkgsplit_cache__[mypkg] | ||
240 | |||
241 | myfile = os.path.splitext(os.path.basename(mypkg)) | ||
242 | parts = myfile[0].split('_') | ||
243 | __pkgsplit_cache__[mypkg] = parts | ||
244 | if len(parts) > 3: | ||
245 | raise ParseError("Unable to generate default variables from the filename: %s (too many underscores)" % mypkg) | ||
246 | exp = 3 - len(parts) | ||
247 | tmplist = [] | ||
248 | while exp != 0: | ||
249 | exp -= 1 | ||
250 | tmplist.append(None) | ||
251 | parts.extend(tmplist) | ||
252 | return parts | ||
253 | |||
254 | # Add us to the handlers list | 236 | # Add us to the handlers list |
255 | from bb.parse import handlers | 237 | from bb.parse import handlers |
256 | handlers.append({'supports': supports, 'handle': handle, 'init': init}) | 238 | handlers.append({'supports': supports, 'handle': handle, 'init': init}) |