from Common.MultipleWorkspace import MultipleWorkspace as mws\r
from Common.BuildToolError import *\r
from Common.Misc import *\r
-from Common.String import *\r
+from Common.StringUtils import *\r
from BuildEngine import *\r
import Common.GlobalData as GlobalData\r
+from collections import OrderedDict\r
\r
## Regular expression for finding header file inclusions\r
gIncludePattern = re.compile(r"^[ \t]*#?[ \t]*include(?:[ \t]*(?:\\(?:\r\n|\r|\n))*[ \t]*)*(?:\(?[\"<]?[ \t]*)([-\w.\\/() \t]+)(?:[ \t]*[\">]?\)?)", re.MULTILINE | re.UNICODE | re.IGNORECASE)\r
self.ResultFileList = []\r
self.IntermediateDirectoryList = ["$(DEBUG_DIR)", "$(OUTPUT_DIR)"]\r
\r
- self.SourceFileDatabase = {} # {file type : file path}\r
- self.DestFileDatabase = {} # {file type : file path}\r
self.FileBuildTargetList = [] # [(src, target string)]\r
self.BuildTargetList = [] # [target string]\r
self.PendingBuildTargetList = [] # [FileBuildRule objects]\r
self.LibraryMakefileList = []\r
self.LibraryBuildDirectoryList = []\r
self.SystemLibraryList = []\r
- self.Macros = sdict()\r
+ self.Macros = OrderedDict()\r
self.Macros["OUTPUT_DIR" ] = self._AutoGenObject.Macros["OUTPUT_DIR"]\r
self.Macros["DEBUG_DIR" ] = self._AutoGenObject.Macros["DEBUG_DIR"]\r
self.Macros["MODULE_BUILD_DIR"] = self._AutoGenObject.Macros["MODULE_BUILD_DIR"]\r
ImageEntryPoint = "_ModuleEntryPoint"\r
\r
for k, v in self._AutoGenObject.Module.Defines.iteritems():\r
- if k not in self._AutoGenObject.Macros.keys():\r
+ if k not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros[k] = v\r
\r
- if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ if 'MODULE_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros['MODULE_ENTRY_POINT'] = ModuleEntryPoint\r
- if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ if 'ARCH_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros['ARCH_ENTRY_POINT'] = ArchEntryPoint\r
- if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros.keys():\r
+ if 'IMAGE_ENTRY_POINT' not in self._AutoGenObject.Macros:\r
self._AutoGenObject.Macros['IMAGE_ENTRY_POINT'] = ImageEntryPoint\r
\r
PCI_COMPRESS_Flag = False\r
RespFileList = os.path.join(self._AutoGenObject.OutputDir, 'respfilelist.txt')\r
if RespDict:\r
RespFileListContent = ''\r
- for Resp in RespDict.keys():\r
+ for Resp in RespDict:\r
RespFile = os.path.join(self._AutoGenObject.OutputDir, str(Resp).lower() + '.txt')\r
StrList = RespDict[Resp].split(' ')\r
UnexpandMacro = []\r
SingleCommandLength = len(SingleCommand)\r
SingleCommandList = SingleCommand.split()\r
if len(SingleCommandList) > 0:\r
- for Flag in FlagDict.keys():\r
+ for Flag in FlagDict:\r
if '$('+ Flag +')' in SingleCommandList[0]:\r
Tool = Flag\r
break\r
if 'FLAGS' not in self._AutoGenObject._BuildOption[Tool]:\r
EdkLogger.error("build", AUTOGEN_ERROR, "%s_FLAGS doesn't exist in %s ToolChain and %s Arch." %(Tool, self._AutoGenObject.ToolChain, self._AutoGenObject.Arch), ExtraData="[%s]" % str(self._AutoGenObject))\r
Str = self._AutoGenObject._BuildOption[Tool]['FLAGS']\r
- for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Option in self._AutoGenObject.BuildOption:\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Str.find(Option + '_' + Attr) != -1:\r
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
- for macro in self._AutoGenObject.Macros.keys():\r
+ for macro in self._AutoGenObject.Macros:\r
MacroName = '$('+ macro + ')'\r
if (Str.find(MacroName) != -1):\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
SingleCommandLength += self._AutoGenObject.IncludePathLength + len(IncPrefix) * len(self._AutoGenObject._IncludePathList)\r
elif item.find('$(') != -1:\r
Str = item\r
- for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Option in self._AutoGenObject.BuildOption:\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Str.find(Option + '_' + Attr) != -1:\r
Str = Str.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while(Str.find('$(') != -1):\r
- for macro in self._AutoGenObject.Macros.keys():\r
+ for macro in self._AutoGenObject.Macros:\r
MacroName = '$('+ macro + ')'\r
if (Str.find(MacroName) != -1):\r
Str = Str.replace(MacroName, self._AutoGenObject.Macros[macro])\r
FlagDict[Tool]['Value'] = True\r
\r
# generate the response file content by combine the FLAGS and INC\r
- for Flag in FlagDict.keys():\r
+ for Flag in FlagDict:\r
if FlagDict[Flag]['Value']:\r
Key = Flag + '_RESP'\r
RespMacro = FlagDict[Flag]['Macro'].replace('FLAGS', 'RESP')\r
Value = self._AutoGenObject.BuildOption[Flag]['FLAGS']\r
for inc in self._AutoGenObject._IncludePathList:\r
Value += ' ' + IncPrefix + inc\r
- for Option in self._AutoGenObject.BuildOption.keys():\r
+ for Option in self._AutoGenObject.BuildOption:\r
for Attr in self._AutoGenObject.BuildOption[Option]:\r
if Value.find(Option + '_' + Attr) != -1:\r
Value = Value.replace('$(' + Option + '_' + Attr + ')', self._AutoGenObject.BuildOption[Option][Attr])\r
while (Value.find('$(') != -1):\r
- for macro in self._AutoGenObject.Macros.keys():\r
+ for macro in self._AutoGenObject.Macros:\r
MacroName = '$('+ macro + ')'\r
if (Value.find(MacroName) != -1):\r
Value = Value.replace(MacroName, self._AutoGenObject.Macros[macro])\r
# skip non-C files\r
if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":\r
continue\r
- elif DepSet == None:\r
+ elif DepSet is None:\r
DepSet = set(self.FileDependency[File])\r
else:\r
DepSet &= set(self.FileDependency[File])\r
# in case nothing in SourceFileList\r
- if DepSet == None:\r
+ if DepSet is None:\r
DepSet = set()\r
#\r
# Extract common files list in the dependency files\r
\r
# TRICK: for not generating GenFds call in makefile if no FDF file\r
MacroList = []\r
- if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":\r
+ if PlatformInfo.FdfFile is not None and PlatformInfo.FdfFile != "":\r
FdfFileList = [PlatformInfo.FdfFile]\r
# macros passed to GenFds\r
MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource.replace('\\', '\\\\')))\r