##\r
# Import Modules\r
#\r
+from __future__ import print_function\r
import Common.LongFilePathOs as os\r
import sys\r
import subprocess\r
FdfFileTimeStamp = 0\r
FixedLoadAddress = False\r
PlatformName = ''\r
- \r
+\r
BuildRuleFamily = "MSFT"\r
ToolChainFamily = "MSFT"\r
__BuildRuleDatabase = None\r
CopyList = []\r
ModuleFile = ''\r
EnableGenfdsMultiThread = False\r
- \r
+\r
#\r
# The list whose element are flags to indicate if large FFS or SECTION files exist in FV.\r
# At the beginning of each generation of FV, false flag is appended to the list,\r
LARGE_FILE_SIZE = 0x1000000\r
\r
SectionHeader = struct.Struct("3B 1B")\r
- \r
+\r
## LoadBuildRule\r
#\r
@staticmethod\r
and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY] \\r
and ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]:\r
GenFdsGlobalVariable.BuildRuleFamily = ToolDefinition[DataType.TAB_TOD_DEFINES_BUILDRULEFAMILY][GenFdsGlobalVariable.ToolChainTag]\r
- \r
+\r
if DataType.TAB_TOD_DEFINES_FAMILY in ToolDefinition \\r
and GenFdsGlobalVariable.ToolChainTag in ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY] \\r
and ToolDefinition[DataType.TAB_TOD_DEFINES_FAMILY][GenFdsGlobalVariable.ToolChainTag]:\r
while Index < len(SourceList):\r
Source = SourceList[Index]\r
Index = Index + 1\r
- \r
+\r
if File.IsBinary and File == Source and Inf.Binaries is not None and File in Inf.Binaries:\r
# Skip all files that are not binary libraries\r
if not Inf.LibraryClass:\r
- continue \r
+ continue\r
RuleObject = BuildRules[DataType.TAB_DEFAULT_BINARY_FILE]\r
elif FileType in BuildRules:\r
RuleObject = BuildRules[FileType]\r
if LastTarget:\r
TargetList.add(str(LastTarget))\r
break\r
- \r
+\r
FileType = RuleObject.SourceFileType\r
- \r
+\r
# stop at STATIC_LIBRARY for library\r
if Inf.LibraryClass and FileType == DataType.TAB_STATIC_LIBRARY:\r
if LastTarget:\r
TargetList.add(str(LastTarget))\r
break\r
- \r
+\r
Target = RuleObject.Apply(Source)\r
if not Target:\r
if LastTarget:\r
elif not Target.Outputs:\r
# Only do build for target with outputs\r
TargetList.add(str(Target))\r
- \r
+\r
# to avoid cyclic rule\r
if FileType in RuleChain:\r
break\r
- \r
+\r
RuleChain.append(FileType)\r
SourceList.extend(Target.Outputs)\r
LastTarget = Target\r
for Arch in ArchList:\r
GenFdsGlobalVariable.OutputDirDict[Arch] = os.path.normpath(\r
os.path.join(GlobalData.gWorkspace,\r
- WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch,GlobalData.gGlobalDefines['TARGET'],\r
+ WorkSpace.Db.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GlobalData.gGlobalDefines['TARGET'],\r
GlobalData.gGlobalDefines['TOOLCHAIN']].OutputDirectory,\r
GlobalData.gGlobalDefines['TARGET'] +'_' + GlobalData.gGlobalDefines['TOOLCHAIN']))\r
GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = os.path.normpath(\r
\r
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))\r
if MakefilePath:\r
- if (tuple(Cmd),tuple(GenFdsGlobalVariable.SecCmdList),tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:\r
+ if (tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)) not in GenFdsGlobalVariable.FfsCmdDict:\r
GenFdsGlobalVariable.FfsCmdDict[tuple(Cmd), tuple(GenFdsGlobalVariable.SecCmdList), tuple(GenFdsGlobalVariable.CopyList)] = MakefilePath\r
GenFdsGlobalVariable.SecCmdList = []\r
GenFdsGlobalVariable.CopyList = []\r
@staticmethod\r
def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None,\r
Revision=None, DeviceId=None, VendorId=None, IsMakefile=False):\r
- InputList = [] \r
+ InputList = []\r
Cmd = ["EfiRom"]\r
if len(EfiInput) > 0:\r
- \r
+\r
if Compress:\r
Cmd.append("-ec")\r
else:\r
Cmd.append("-e")\r
- \r
+\r
for EfiFile in EfiInput:\r
Cmd.append(EfiFile)\r
InputList.append (EfiFile)\r
- \r
+\r
if len(BinaryInput) > 0:\r
Cmd.append("-b")\r
for BinFile in BinaryInput:\r
if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList) and not IsMakefile:\r
return\r
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))\r
- \r
+\r
if ClassCode is not None:\r
Cmd += ("-l", ClassCode)\r
if Revision is not None:\r
\r
try:\r
PopenObject = subprocess.Popen(' '.join(cmd), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)\r
- except Exception, X:\r
+ except Exception as X:\r
EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))\r
(out, error) = PopenObject.communicate()\r
\r
GenFdsGlobalVariable.InfLogger (out)\r
GenFdsGlobalVariable.InfLogger (error)\r
if PopenObject.returncode != 0:\r
- print "###", cmd\r
+ print("###", cmd)\r
EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)\r
\r
def VerboseLogger (msg):\r
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)\r
if PcdObj.DatumType != DataType.TAB_VOID:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)\r
- \r
+\r
PcdValue = PcdObj.DefaultValue\r
return PcdValue\r
\r
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not FixedAtBuild type." % PcdPattern)\r
if PcdObj.DatumType != DataType.TAB_VOID:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "%s is not VOID* datum type." % PcdPattern)\r
- \r
+\r
PcdValue = PcdObj.DefaultValue\r
return PcdValue\r
\r