## @file\r
# Global variables for GenFds\r
#\r
-# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
Source = SourceList[Index]\r
Index = Index + 1\r
\r
- if File.IsBinary and File == Source and Inf.Binaries != None and File in Inf.Binaries:\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
if not os.path.exists(Output):\r
return True\r
# always update "Output" if no "Input" given\r
- if Input == None or len(Input) == 0:\r
+ if Input is None or len(Input) == 0:\r
return True\r
\r
# if fdf file is changed after the 'Output" is generated, update the 'Output'\r
Cmd += ["-s", Type]\r
if CompressionType not in [None, '']:\r
Cmd += ["-c", CompressionType]\r
- if Guid != None:\r
+ if Guid is not None:\r
Cmd += ["-g", Guid]\r
- if DummyFile != None:\r
+ if DummyFile is not None:\r
Cmd += ["--dummy", DummyFile]\r
if GuidHdrLen not in [None, '']:\r
Cmd += ["-l", GuidHdrLen]\r
#Add each guided attribute\r
for Attr in GuidAttr:\r
Cmd += ["-r", Attr]\r
- if InputAlign != None:\r
+ if InputAlign is not None:\r
#Section Align is only for dummy section without section type\r
for SecAlign in InputAlign:\r
Cmd += ["--sectionalign", SecAlign]\r
if Ui not in [None, '']:\r
#Cmd += ["-n", '"' + Ui + '"']\r
if IsMakefile:\r
- Cmd += ["-n", "$(MODULE_NAME)"]\r
+ if Ui == "$(MODULE_NAME)":\r
+ Cmd += ['-n', Ui]\r
+ else:\r
+ Cmd += ["-n", '"' + Ui + '"']\r
Cmd += ["-o", Output]\r
- #SaveFileOnChange(CommandFile, ' '.join(Cmd), False)\r
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:\r
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())\r
else:\r
if IsMakefile:\r
if ' '.join(Cmd).strip() not in GenFdsGlobalVariable.SecCmdList:\r
GenFdsGlobalVariable.SecCmdList.append(' '.join(Cmd).strip())\r
- elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input)):\r
+ elif GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):\r
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input))\r
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate section")\r
if (os.path.getsize(Output) >= GenFdsGlobalVariable.LARGE_FILE_SIZE and\r
\r
@staticmethod\r
def GetAlignment (AlignString):\r
- if AlignString == None:\r
+ if AlignString is None:\r
return 0\r
if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K"):\r
return int (AlignString.rstrip('K')) * 1024\r
GenFdsGlobalVariable.SecCmdList = []\r
GenFdsGlobalVariable.CopyList = []\r
else:\r
- if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input)):\r
+ if not GenFdsGlobalVariable.NeedsUpdate(Output, list(Input) + [CommandFile]):\r
return\r
GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FFS")\r
\r
return\r
GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList))\r
\r
- if ClassCode != None:\r
+ if ClassCode is not None:\r
Cmd += ["-l", ClassCode]\r
- if Revision != None:\r
+ if Revision is not None:\r
Cmd += ["-r", Revision]\r
- if DeviceId != None:\r
+ if DeviceId is not None:\r
Cmd += ["-i", DeviceId]\r
- if VendorId != None:\r
+ if VendorId is not None:\r
Cmd += ["-f", VendorId]\r
\r
Cmd += ["-o", Output]\r
EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))\r
(out, error) = PopenObject.communicate()\r
\r
- while PopenObject.returncode == None :\r
+ while PopenObject.returncode is None :\r
PopenObject.wait()\r
if returnValue != [] and returnValue[0] != 0:\r
#get command return value\r
# @param MacroDict Dictionary that contains macro value pair\r
#\r
def MacroExtend (Str, MacroDict={}, Arch='COMMON'):\r
- if Str == None :\r
+ if Str is None :\r
return None\r
\r
Dict = {'$(WORKSPACE)' : GenFdsGlobalVariable.WorkSpaceDir,\r
\r
Dict['$(OUTPUT_DIRECTORY)'] = OutputDir\r
\r
- if MacroDict != None and len (MacroDict) != 0:\r
+ if MacroDict is not None and len (MacroDict) != 0:\r
Dict.update(MacroDict)\r
\r
for key in Dict.keys():\r
# @param PcdPattern pattern that labels a PCD.\r
#\r
def GetPcdValue (PcdPattern):\r
- if PcdPattern == None :\r
+ if PcdPattern is None :\r
return None\r
PcdPair = PcdPattern.lstrip('PCD(').rstrip(')').strip().split('.')\r
TokenSpace = PcdPair[0]\r