diff options
author | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-03-04 05:29:52 +0000 |
---|---|---|
committer | lgao4 <lgao4@6f19259b-4bc3-4df7-8a09-765794883524> | 2010-03-04 05:29:52 +0000 |
commit | d5d56f1bc5e7bcebd08ad55e940fb907ea0af365 (patch) | |
tree | be511cd484b00b289ca068370c305521d422afc5 /BaseTools/Source/Python/GenFds | |
parent | 545312ad92b51501777df57d595f1725170f8940 (diff) | |
download | edk2-platforms-d5d56f1bc5e7bcebd08ad55e940fb907ea0af365.tar.xz |
Sync EDKII BaseTools to BaseTools project r1911.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10177 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r-- | BaseTools/Source/Python/GenFds/FdfParser.py | 38 | ||||
-rw-r--r-- | BaseTools/Source/Python/GenFds/GenFds.py | 6 |
2 files changed, 22 insertions, 22 deletions
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 4ce2761243..92d6ab64ba 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1,7 +1,7 @@ ## @file
# parse FDF file
#
-# Copyright (c) 2007, Intel Corporation
+# Copyright (c) 2007 - 2010, Intel Corporation
#
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
@@ -415,6 +415,21 @@ class FdfParser: Offset += 1
+ def __GetMacroName(self):
+ if not self.__GetNextToken():
+ raise Warning("expected Macro name", self.FileName, self.CurrentLineNumber)
+ MacroName = self.__Token
+ NotFlag = False
+ if MacroName.startswith('!'):
+ NotFlag = True
+ MacroName = MacroName[1:].strip()
+
+ if not MacroName.startswith('$(') or not MacroName.endswith(')'):
+ raise Warning("Macro name expected(Please use '$(%(Token)s)' if '%(Token)s' is a macro.)" % {"Token" : MacroName},
+ self.FileName, self.CurrentLineNumber)
+ MacroName = MacroName[2:-1]
+ return MacroName, NotFlag
+
## PreprocessFile() method
#
# Preprocess file contents, replace comments with spaces.
@@ -545,6 +560,7 @@ class FdfParser: self.Rewind()
+
## PreprocessIncludeFile() method
#
# Preprocess file contents, replace !include statements with file contents.
@@ -583,15 +599,8 @@ class FdfParser: IfStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))
IfList.append([IfStartPos, None, None])
CondLabel = self.__Token
-
- if not self.__GetNextToken():
- raise Warning("expected Macro name", self.FileName, self.CurrentLineNumber)
- MacroName = self.__Token
- NotFlag = False
- if MacroName.startswith('!'):
- NotFlag = True
- MacroName = MacroName[1:]
-
+
+ MacroName, NotFlag = self.__GetMacroName()
NotDefineFlag = False
if CondLabel == '!ifndef':
NotDefineFlag = True
@@ -645,14 +654,7 @@ class FdfParser: self.__WipeOffArea.append((IfList[-1][0], ElseStartPos))
IfList[-1] = [ElseStartPos, True, IfList[-1][2]]
if self.__Token == '!elseif':
- if not self.__GetNextToken():
- raise Warning("expected Macro name", self.FileName, self.CurrentLineNumber)
- MacroName = self.__Token
- NotFlag = False
- if MacroName.startswith('!'):
- NotFlag = True
- MacroName = MacroName[1:]
-
+ MacroName, NotFlag = self.__GetMacroName()
if not self.__GetNextOp():
raise Warning("expected !endif", self.FileName, self.CurrentLineNumber)
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py index 1285103f5e..d586346168 100644 --- a/BaseTools/Source/Python/GenFds/GenFds.py +++ b/BaseTools/Source/Python/GenFds/GenFds.py @@ -196,10 +196,8 @@ def main(): if (Options.outputDir): OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(Options.outputDir) - if not os.path.isabs (Options.outputDir): - Options.outputDir = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, Options.outputDir) - if os.path.normcase (Options.outputDir).find(Workspace) != 0: - EdkLogger.error("GenFds", FILE_NOT_FOUND, "OutputDir doesn't exist in Workspace!") + if not os.path.isabs (OutputDirFromCommandLine): + OutputDirFromCommandLine = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, OutputDirFromCommandLine) for Arch in ArchList: GenFdsGlobalVariable.OutputDirDict[Arch] = OutputDirFromCommandLine else: |