License header updated to match correct format.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yingke Liu <yingke.d.liu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15971 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -21,7 +21,7 @@ from BuildToolError import *
|
||||
import GlobalData
|
||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||
|
||||
gDefaultTargetTxtFile = "Conf/target.txt"
|
||||
gDefaultTargetTxtFile = "target.txt"
|
||||
|
||||
## TargetTxtClassObject
|
||||
#
|
||||
@ -44,6 +44,7 @@ class TargetTxtClassObject(object):
|
||||
DataType.TAB_TAT_DEFINES_TARGET_ARCH : [],
|
||||
DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF : '',
|
||||
}
|
||||
self.ConfDirectoryPath = ""
|
||||
if Filename != None:
|
||||
self.LoadTargetTxtFile(Filename)
|
||||
|
||||
@ -78,7 +79,8 @@ class TargetTxtClassObject(object):
|
||||
def ConvertTextFileToDict(self, FileName, CommentCharacter, KeySplitCharacter):
|
||||
F = None
|
||||
try:
|
||||
F = open(FileName,'r')
|
||||
F = open(FileName, 'r')
|
||||
self.ConfDirectoryPath = os.path.dirname(FileName)
|
||||
except:
|
||||
EdkLogger.error("build", FILE_OPEN_FAILURE, ExtraData=FileName)
|
||||
if F != None:
|
||||
@ -99,6 +101,26 @@ class TargetTxtClassObject(object):
|
||||
if Key in [DataType.TAB_TAT_DEFINES_ACTIVE_PLATFORM, DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF, \
|
||||
DataType.TAB_TAT_DEFINES_ACTIVE_MODULE, DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF]:
|
||||
self.TargetTxtDictionary[Key] = Value.replace('\\', '/')
|
||||
if Key == DataType.TAB_TAT_DEFINES_TOOL_CHAIN_CONF and self.TargetTxtDictionary[Key]:
|
||||
if self.TargetTxtDictionary[Key].startswith("Conf/"):
|
||||
Tools_Def = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
|
||||
if not os.path.exists(Tools_Def) or not os.path.isfile(Tools_Def):
|
||||
# If Conf/Conf does not exist, try just the Conf/ directory
|
||||
Tools_Def = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].replace("Conf/", "", 1).strip())
|
||||
else:
|
||||
# The File pointed to by TOOL_CHAIN_CONF is not in a Conf/ directory
|
||||
Tools_Def = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
|
||||
self.TargetTxtDictionary[Key] = Tools_Def
|
||||
if Key == DataType.TAB_TAT_DEFINES_BUILD_RULE_CONF and self.TargetTxtDictionary[Key]:
|
||||
if self.TargetTxtDictionary[Key].startswith("Conf/"):
|
||||
Build_Rule = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
|
||||
if not os.path.exists(Build_Rule) or not os.path.isfile(Build_Rule):
|
||||
# If Conf/Conf does not exist, try just the Conf/ directory
|
||||
Build_Rule = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].replace("Conf/", "", 1).strip())
|
||||
else:
|
||||
# The File pointed to by BUILD_RULE_CONF is not in a Conf/ directory
|
||||
Build_Rule = os.path.join(self.ConfDirectoryPath, self.TargetTxtDictionary[Key].strip())
|
||||
self.TargetTxtDictionary[Key] = Build_Rule
|
||||
elif Key in [DataType.TAB_TAT_DEFINES_TARGET, DataType.TAB_TAT_DEFINES_TARGET_ARCH, \
|
||||
DataType.TAB_TAT_DEFINES_TOOL_CHAIN_TAG]:
|
||||
self.TargetTxtDictionary[Key] = Value.split()
|
||||
@ -144,15 +166,15 @@ class TargetTxtClassObject(object):
|
||||
print Item
|
||||
## TargetTxtDict
|
||||
#
|
||||
# Load target.txt in input workspace dir
|
||||
# Load target.txt in input Conf dir
|
||||
#
|
||||
# @param WorkSpace: Workspace dir
|
||||
# @param ConfDir: Conf dir
|
||||
#
|
||||
# @retval Target An instance of TargetTxtClassObject() with loaded target.txt
|
||||
#
|
||||
def TargetTxtDict(WorkSpace):
|
||||
def TargetTxtDict(ConfDir):
|
||||
Target = TargetTxtClassObject()
|
||||
Target.LoadTargetTxtFile(os.path.normpath(os.path.join(WorkSpace, gDefaultTargetTxtFile)))
|
||||
Target.LoadTargetTxtFile(os.path.normpath(os.path.join(ConfDir, gDefaultTargetTxtFile)))
|
||||
return Target
|
||||
|
||||
##
|
||||
|
Reference in New Issue
Block a user