diff options
Diffstat (limited to 'BaseTools/Source/Python/UPT')
-rw-r--r-- | BaseTools/Source/Python/UPT/BuildVersion.py | 3 | ||||
-rw-r--r-- | BaseTools/Source/Python/UPT/Library/Misc.py | 53 | ||||
-rw-r--r-- | BaseTools/Source/Python/UPT/Logger/StringTable.py | 1 | ||||
-rw-r--r-- | BaseTools/Source/Python/UPT/Makefile | 4 | ||||
-rw-r--r-- | BaseTools/Source/Python/UPT/Parser/InfParser.py | 18 | ||||
-rw-r--r-- | BaseTools/Source/Python/UPT/UPT.py | 2 |
6 files changed, 78 insertions, 3 deletions
diff --git a/BaseTools/Source/Python/UPT/BuildVersion.py b/BaseTools/Source/Python/UPT/BuildVersion.py new file mode 100644 index 0000000000..4bb9a8b521 --- /dev/null +++ b/BaseTools/Source/Python/UPT/BuildVersion.py @@ -0,0 +1,3 @@ +#This file is for build version number auto generation
+#
+gBUILD_VERSION = "Build 2423"
diff --git a/BaseTools/Source/Python/UPT/Library/Misc.py b/BaseTools/Source/Python/UPT/Library/Misc.py index 658c4e0cfb..b67cd102d1 100644 --- a/BaseTools/Source/Python/UPT/Library/Misc.py +++ b/BaseTools/Source/Python/UPT/Library/Misc.py @@ -834,6 +834,59 @@ def ProcessLineExtender(LineList): return NewList +## ProcessEdkComment +# +# Process EDK style comment in LineList: c style /* */ comment or cpp style // comment +# +# +# @param LineList The LineList need to be processed. +# +# @return LineList The LineList been processed. +# @return FirstPos Where Edk comment is first found, -1 if not found +# +def ProcessEdkComment(LineList): + FindEdkBlockComment = False + Count = 0 + StartPos = -1 + EndPos = -1 + FirstPos = -1 + + while(Count < len(LineList)): + Line = LineList[Count].strip() + if Line.startswith("/*"): + # + # handling c style comment + # + StartPos = Count + while Count < len(LineList): + Line = LineList[Count].strip() + if Line.endswith("*/"): + if (Count == StartPos) and Line.strip() == '/*/': + Count = Count + 1 + continue + EndPos = Count + FindEdkBlockComment = True + break + Count = Count + 1 + + if FindEdkBlockComment: + if FirstPos == -1: + FirstPos = StartPos + for Index in xrange(StartPos, EndPos+1): + LineList[Index] = '' + FindEdkBlockComment = False + elif Line.find("//") != -1: + # + # handling cpp style comment + # + LineList[Count] = Line.replace("//", '#') + if FirstPos == -1: + FirstPos = Count + + Count = Count + 1 + + return LineList, FirstPos + ## GetLibInstanceInfo # # Get the information from Library Instance INF file. diff --git a/BaseTools/Source/Python/UPT/Logger/StringTable.py b/BaseTools/Source/Python/UPT/Logger/StringTable.py index 230c659189..063ca52d2b 100644 --- a/BaseTools/Source/Python/UPT/Logger/StringTable.py +++ b/BaseTools/Source/Python/UPT/Logger/StringTable.py @@ -196,6 +196,7 @@ ERR_INF_PARSER_VER_EXIST_BOTH_NUM_STR = \ _("The INF file %s defines both VERSION_NUMBER and VERSION_STRING, "
"using VERSION_STRING")
ERR_INF_PARSER_NOT_SUPPORT_EDKI_INF = _("EDKI INF is not supported")
+ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII = _("The EDKI style comment is not supported in EDKII modules")
ERR_INF_PARSER_FEATUREPCD_USAGE_INVALID = _("The usage for FeaturePcd can only"
" be type of \"CONSUMES\".")
diff --git a/BaseTools/Source/Python/UPT/Makefile b/BaseTools/Source/Python/UPT/Makefile index a6e3a6dd41..d4eef45196 100644 --- a/BaseTools/Source/Python/UPT/Makefile +++ b/BaseTools/Source/Python/UPT/Makefile @@ -24,14 +24,14 @@ SOURCES_PATH = . APPLICATIONS=$(BIN_DIR)\UPT.exe
-COMMON_PYTHON=$(SOURCES_PATH)\UPT.py
+UPT_BUILDVERSION_PYTHON=$(SOURCES_PATH)\BuildVersion.py
all: SetPythonPath $(APPLICATIONS)
SetPythonPath:
set PYTHONPATH= $(SOURCES_PATH)
-$(BIN_DIR)\UPT.exe: $(SOURCES_PATH)\UPT.py $(COMMON_PYTHON)
+$(BIN_DIR)\UPT.exe: $(SOURCES_PATH)\UPT.py $(UPT_BUILDVERSION_PYTHON)
@pushd . & @cd build & @$(FREEZE) --include-modules=$(MODULES) --install-dir=$(BIN_DIR) UPT.py & @popd
@pushd . & @copy .\Dll\sqlite3.dll .\Bin\Sqlite3.dll & @popd
clean:
diff --git a/BaseTools/Source/Python/UPT/Parser/InfParser.py b/BaseTools/Source/Python/UPT/Parser/InfParser.py index aa44e8038d..79f71448ee 100644 --- a/BaseTools/Source/Python/UPT/Parser/InfParser.py +++ b/BaseTools/Source/Python/UPT/Parser/InfParser.py @@ -26,6 +26,7 @@ from copy import deepcopy from Library.String import GetSplitValueList
from Library.String import ConvertSpecialChar
from Library.Misc import ProcessLineExtender
+from Library.Misc import ProcessEdkComment
from Library.Parsing import NormPath
from Library.ParserValidate import IsValidInfMoudleTypeList
from Library.ParserValidate import IsValidArch
@@ -165,6 +166,12 @@ class InfParser(InfSectionParser): FileLinesList = ProcessLineExtender(FileLinesList)
#
+ # Process EdkI INF style comment if found
+ #
+ OrigLines = [Line for Line in FileLinesList]
+ FileLinesList, EdkCommentStartPos = ProcessEdkComment(FileLinesList)
+
+ #
# Judge whether the INF file is Binary INF or not
#
if IsBinaryInf(FileLinesList):
@@ -339,6 +346,17 @@ class InfParser(InfSectionParser): File=self.FullPath)
#
+ # EDKII INF should not have EDKI style comment
+ #
+ if EdkCommentStartPos != -1:
+ Logger.Error("InfParser",
+ FORMAT_INVALID,
+ ST.ERR_INF_PARSER_EDKI_COMMENT_IN_EDKII,
+ File=self.FullPath,
+ Line=EdkCommentStartPos + 1,
+ ExtraData=OrigLines[EdkCommentStartPos])
+
+ #
# extract [Event] [Hob] [BootMode] sections
#
self._ExtractEventHobBootMod(FileLinesList)
diff --git a/BaseTools/Source/Python/UPT/UPT.py b/BaseTools/Source/Python/UPT/UPT.py index a9066a259a..b168a51daa 100644 --- a/BaseTools/Source/Python/UPT/UPT.py +++ b/BaseTools/Source/Python/UPT/UPT.py @@ -43,7 +43,7 @@ import RmPkg from Library.Misc import CheckEnvVariable
from Library import GlobalData
from Core.IpiDb import IpiDatabase
-from Common.BuildVersion import gBUILD_VERSION
+from BuildVersion import gBUILD_VERSION
##
# Version and Copyright
|