summaryrefslogtreecommitdiffstats
path: root/BaseTools
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-11-09 07:43:07 +0000
committeryzhu52 <yzhu52@Edk2>2015-11-09 07:43:07 +0000
commit3ab1434a6ede4e006ef0b001108c354f4fa6d91e (patch)
treea5ecdd9219b8e1508d342ca1b87290868be9a520 /BaseTools
parentac4588532d17a2f3cac3e7dde7c85ed59dab319b (diff)
downloadedk2-3ab1434a6ede4e006ef0b001108c354f4fa6d91e.tar.gz
edk2-3ab1434a6ede4e006ef0b001108c354f4fa6d91e.tar.bz2
edk2-3ab1434a6ede4e006ef0b001108c354f4fa6d91e.zip
BaseTools: Allow decimal values in the EDK II meta-data file
Because the EDK II meta-data specifications already allow using decimal values in the EDK II Meta-data file [Defines] section, this patch update code to allow this usage. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18746 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Source/Python/Workspace/MetaFileParser.py11
-rw-r--r--BaseTools/Source/Python/Workspace/WorkspaceDatabase.py8
2 files changed, 15 insertions, 4 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)
diff --git a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
index c84d19243c..46eb5d3a8c 100644
--- a/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
+++ b/BaseTools/Source/Python/Workspace/WorkspaceDatabase.py
@@ -1955,7 +1955,13 @@ class InfBuildData(ModuleBuildClassObject):
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
for Record in RecordList:
if Record[1] == TAB_INF_DEFINES_INF_VERSION:
- self._AutoGenVersion = int(Record[2], 0)
+ if '.' in Record[2]:
+ ValueList = Record[2].split('.')
+ Major = '%04o' % int(ValueList[0], 0)
+ Minor = '%04o' % int(ValueList[1], 0)
+ self._AutoGenVersion = int('0x' + Major + Minor, 0)
+ else:
+ self._AutoGenVersion = int(Record[2], 0)
break
if self._AutoGenVersion == None:
self._AutoGenVersion = 0x00010000