summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/parse/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/parse/__init__.py')
-rw-r--r--bitbake/lib/bb/parse/__init__.py20
1 files changed, 20 insertions, 0 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__={}
108def 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
107from bb.parse.parse_py import __version__, ConfHandler, BBHandler 127from bb.parse.parse_py import __version__, ConfHandler, BBHandler