diff options
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/template.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/template.py | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/template.py b/bitbake/lib/bb/ui/crumbs/template.py index cbed2708de..7309bb6467 100644 --- a/bitbake/lib/bb/ui/crumbs/template.py +++ b/bitbake/lib/bb/ui/crumbs/template.py | |||
@@ -101,7 +101,19 @@ class HobTemplateFile(ConfigFile): | |||
101 | return self.dictionary[var] | 101 | return self.dictionary[var] |
102 | else: | 102 | else: |
103 | return "" | 103 | return "" |
104 | 104 | ||
105 | def getVersion(self): | ||
106 | contents = ConfigFile.readFile(self) | ||
107 | |||
108 | pattern = "^\s*(\S+)\s*=\s*(\".*?\")" | ||
109 | |||
110 | for line in contents: | ||
111 | match = re.search(pattern, line) | ||
112 | if match: | ||
113 | if match.group(1) == "VERSION": | ||
114 | return match.group(2).strip('"') | ||
115 | return None | ||
116 | |||
105 | def load(self): | 117 | def load(self): |
106 | contents = ConfigFile.readFile(self) | 118 | contents = ConfigFile.readFile(self) |
107 | self.dictionary.clear() | 119 | self.dictionary.clear() |
@@ -174,6 +186,9 @@ class TemplateMgr(gobject.GObject): | |||
174 | self.image_bb.save() | 186 | self.image_bb.save() |
175 | self.template_hob.save() | 187 | self.template_hob.save() |
176 | 188 | ||
189 | def getVersion(self, path): | ||
190 | return HobTemplateFile(path).getVersion() | ||
191 | |||
177 | def load(self, path): | 192 | def load(self, path): |
178 | self.template_hob = HobTemplateFile(path) | 193 | self.template_hob = HobTemplateFile(path) |
179 | self.dictionary = self.template_hob.load() | 194 | self.dictionary = self.template_hob.load() |