diff options
author | Hess Chen <hesheng.chen@intel.com> | 2016-07-29 10:30:56 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2016-08-03 10:49:31 +0800 |
commit | 645a51287e9519eb4c6d27b4e4f11d0556a624e8 (patch) | |
tree | c45139eb17cd0bc7ce985ebd4aa40aa28d9c3258 /BaseTools/Source/Python/UPT/Parser | |
parent | 6cf9903481f07859cb0013598d2d13309d4e4644 (diff) | |
download | edk2-platforms-645a51287e9519eb4c6d27b4e4f11d0556a624e8.tar.xz |
BaseTool/Upt: Add support for Private
Support new syntax in package DEC file as below:
[Includes.Common.Private]
[Ppis.Common.Private]
[Guids.Common.Private]
[Protocols.Common.Private]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/UPT/Parser')
-rw-r--r-- | BaseTools/Source/Python/UPT/Parser/DecParser.py | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/BaseTools/Source/Python/UPT/Parser/DecParser.py b/BaseTools/Source/Python/UPT/Parser/DecParser.py index 23d1ed4dbb..5a2842a230 100644 --- a/BaseTools/Source/Python/UPT/Parser/DecParser.py +++ b/BaseTools/Source/Python/UPT/Parser/DecParser.py @@ -1,7 +1,7 @@ ## @file
# This file is used to parse DEC file. It will consumed by DecParser
#
-# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
@@ -742,7 +742,26 @@ class Dec(_DecBase, _DecComments): except BaseException:
Logger.Error(TOOL_NAME, FILE_OPEN_FAILURE, File=DecFile,
ExtraData=ST.ERR_DECPARSE_FILEOPEN % DecFile)
- RawData = FileContent(DecFile, Content)
+
+ #
+ # Pre-parser for Private section
+ #
+ self._Private = ''
+ __IsFoundPrivate = False
+ NewContent = []
+ for Line in Content:
+ Line = Line.strip()
+ if Line.startswith(DT.TAB_SECTION_START) and Line.endswith(DT.TAB_PRIVATE + DT.TAB_SECTION_END):
+ __IsFoundPrivate = True
+ if Line.startswith(DT.TAB_SECTION_START) and Line.endswith(DT.TAB_SECTION_END)\
+ and not Line.endswith(DT.TAB_PRIVATE + DT.TAB_SECTION_END):
+ __IsFoundPrivate = False
+ if __IsFoundPrivate:
+ self._Private += Line + '\r'
+ if not __IsFoundPrivate:
+ NewContent.append(Line + '\r')
+
+ RawData = FileContent(DecFile, NewContent)
_DecComments.__init__(self)
_DecBase.__init__(self, RawData)
@@ -1060,3 +1079,5 @@ class Dec(_DecBase, _DecComments): return self._Define.GetDataObject().GetPackageVersion()
def GetPackageUniFile(self):
return self._Define.GetDataObject().GetPackageUniFile()
+ def GetPrivateSections(self):
+ return self._Private
|