summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/Workspace/MetaFileParser.py
diff options
context:
space:
mode:
authorJeff Fan <jeff.fan@intel.com>2015-11-16 05:29:49 +0000
committervanjeff <vanjeff@Edk2>2015-11-16 05:29:49 +0000
commitaf7fca3649779f0e55220a7acda9bd11bc660fc3 (patch)
tree02585c606e356ce06fefa9ff80bc4529fcde256e /BaseTools/Source/Python/Workspace/MetaFileParser.py
parent59fd15c5a2174a6a6fc4133964e6d5b520b58663 (diff)
downloadedk2-platforms-af7fca3649779f0e55220a7acda9bd11bc660fc3.tar.xz
Update BaseTools from main trunk r18767.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jeff Fan <jeff.fan@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18784 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Workspace/MetaFileParser.py')
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index fe1f7fd6f6..e7d6df6595 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -343,9 +343,14 @@ class MetaFileParser(object):
Name, Value = self._ValueList[1], self._ValueList[2]
# Sometimes, we need to make differences between EDK and EDK2 modules
if Name == 'INF_VERSION':
- try:
- self._Version = int(Value, 0)
- except:
+ if re.match(r'0[xX][\da-f-A-F]{5,8}', Value):
+ self._Version = int(Value, 0)
+ elif re.match(r'\d+\.\d+', Value):
+ ValueList = Value.split('.')
+ Major = '%04o' % int(ValueList[0], 0)
+ Minor = '%04o' % int(ValueList[1], 0)
+ self._Version = int('0x' + Major + Minor, 0)
+ else:
EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version number",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)