diff options
author | Yingke Liu <yingke.d.liu@intel.com> | 2014-08-28 13:53:34 +0000 |
---|---|---|
committer | yingke <yingke@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-08-28 13:53:34 +0000 |
commit | 97fa0ee9b1cffbb4b97ee35365afa7afcf50e174 (patch) | |
tree | e4d87275d1ef186373024863ddb6fa3a2ab913cf /BaseTools/Source/Python/Common/TargetTxtClassObject.py | |
parent | cb9ec399fe8f0ba0d79d788891ac5829c33abc84 (diff) | |
download | edk2-97fa0ee9b1cffbb4b97ee35365afa7afcf50e174.tar.gz edk2-97fa0ee9b1cffbb4b97ee35365afa7afcf50e174.tar.bz2 edk2-97fa0ee9b1cffbb4b97ee35365afa7afcf50e174.zip |
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
Diffstat (limited to 'BaseTools/Source/Python/Common/TargetTxtClassObject.py')
-rw-r--r-- | BaseTools/Source/Python/Common/TargetTxtClassObject.py | 34 |
1 files changed, 28 insertions, 6 deletions
diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py b/BaseTools/Source/Python/Common/TargetTxtClassObject.py index 89e3937086..387e515230 100644 --- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py +++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py @@ -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
##
|