]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/Misc.py
BaseTools: Clean up source files
[mirror_edk2.git] / BaseTools / Source / Python / Common / Misc.py
index 044ef8d62bfe62ea4573fb3b94c7eb6c567d5296..b56ddd5324711d5e8412be5a0f391cf0256fc555 100644 (file)
@@ -63,11 +63,11 @@ gDependencyDatabase = {}    # arch : {file path : [dependent files list]}
 _TempInfs = []\r
 \r
 def GetVariableOffset(mapfilepath, efifilepath, varnames):\r
-    """ Parse map file to get variable offset in current EFI file \r
+    """ Parse map file to get variable offset in current EFI file\r
     @param mapfilepath    Map file absolution path\r
     @param efifilepath:   EFI binary file full path\r
     @param varnames       iteratable container whose elements are variable names to be searched\r
-    \r
+\r
     @return List whos elements are tuple with variable name and raw offset\r
     """\r
     lines = []\r
@@ -77,7 +77,7 @@ def GetVariableOffset(mapfilepath, efifilepath, varnames):
         f.close()\r
     except:\r
         return None\r
-    \r
+\r
     if len(lines) == 0: return None\r
     firstline = lines[0].strip()\r
     if (firstline.startswith("Archive member included ") and\r
@@ -177,7 +177,7 @@ def _parseGeneral(lines, efifilepath, varnames):
             continue\r
         if line.startswith("entry point at"):\r
             status = 3\r
-            continue        \r
+            continue\r
         if status == 1 and len(line) != 0:\r
             m =  secReGeneral.match(line)\r
             assert m is not None, "Fail to parse the section in map file , line is %s" % line\r
@@ -257,7 +257,7 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
     #\r
     # A temporary INF is copied to database path which must have write permission\r
     # The temporary will be removed at the end of build\r
-    # In case of name conflict, the file name is \r
+    # In case of name conflict, the file name is\r
     # FILE_GUIDBaseName (0D1B936F-68F3-4589-AFCC-FB8B7AEBC836module.inf)\r
     #\r
     TempFullPath = os.path.join(DbDir,\r
@@ -268,7 +268,7 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
     #\r
     # To build same module more than once, the module path with FILE_GUID overridden has\r
     # the file name FILE_GUIDmodule.inf, but the relative path (self.MetaFile.File) is the real path\r
-    # in DSC which is used as relative path by C files and other files in INF. \r
+    # in DSC which is used as relative path by C files and other files in INF.\r
     # A trick was used: all module paths are PathClass instances, after the initialization\r
     # of PathClass, the PathClass.Path is overridden by the temporary INF path.\r
     #\r
@@ -287,7 +287,7 @@ def ProcessDuplicatedInf(Path, BaseName, Workspace):
     # If file exists, compare contents\r
     #\r
     if os.path.exists(TempFullPath):\r
-        with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2: \r
+        with open(str(Path), 'rb') as f1, open(TempFullPath, 'rb') as f2:\r
             if f1.read() == f2.read():\r
                 return RtPath\r
     _TempInfs.append(TempFullPath)\r
@@ -1545,29 +1545,29 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
 #  Used to avoid split issue while the value string contain "|" character\r
 #\r
 #  @param[in] Setting:  A String contain value/datum type/token number information;\r
-#  \r
-#  @retval   ValueList: A List contain value, datum type and toke number. \r
+#\r
+#  @retval   ValueList: A List contain value, datum type and toke number.\r
 #\r
 def AnalyzePcdData(Setting):\r
     ValueList = ['', '', '']\r
 \r
     ValueRe = re.compile(r'^\s*L?\".*\|.*\"')\r
     PtrValue = ValueRe.findall(Setting)\r
-    \r
+\r
     ValueUpdateFlag = False\r
-    \r
+\r
     if len(PtrValue) >= 1:\r
         Setting = re.sub(ValueRe, '', Setting)\r
         ValueUpdateFlag = True\r
 \r
     TokenList = Setting.split(TAB_VALUE_SPLIT)\r
     ValueList[0:len(TokenList)] = TokenList\r
-    \r
+\r
     if ValueUpdateFlag:\r
         ValueList[0] = PtrValue[0]\r
-        \r
-    return ValueList   \r
\r
+\r
+    return ValueList\r
+\r
 ## check format of PCD value against its the datum type\r
 #\r
 # For PCD value setting\r
@@ -1770,7 +1770,7 @@ class PathClass(object):
             OtherKey = Other.Path\r
         else:\r
             OtherKey = str(Other)\r
-            \r
+\r
         SelfKey = self.Path\r
         if SelfKey == OtherKey:\r
             return 0\r
@@ -1908,7 +1908,7 @@ class PeImageClass():
     def _ByteListToStr(self, ByteList):\r
         String = ''\r
         for index in range(len(ByteList)):\r
-            if ByteList[index] == 0: \r
+            if ByteList[index] == 0:\r
                 break\r
             String += chr(ByteList[index])\r
         return String\r
@@ -1945,11 +1945,11 @@ class DefaultStore():
             if sid == minid:\r
                 return name\r
 class SkuClass():\r
-    \r
+\r
     DEFAULT = 0\r
     SINGLE = 1\r
     MULTIPLE =2\r
-    \r
+\r
     def __init__(self,SkuIdentifier='', SkuIds=None):\r
         if SkuIds is None:\r
             SkuIds = {}\r
@@ -1961,7 +1961,7 @@ class SkuClass():
                 EdkLogger.error("build", PARAMETER_INVALID,\r
                             ExtraData = "SKU-ID [%s] value %s exceeds the max value of UINT64"\r
                                       % (SkuName, SkuId))\r
-        \r
+\r
         self.AvailableSkuIds = sdict()\r
         self.SkuIdSet = []\r
         self.SkuIdNumberSet = []\r
@@ -1975,10 +1975,10 @@ class SkuClass():
             self.SkuIdSet = SkuIds.keys()\r
             self.SkuIdNumberSet = [num[0].strip() + 'U' for num in SkuIds.values()]\r
         else:\r
-            r = SkuIdentifier.split('|') \r
+            r = SkuIdentifier.split('|')\r
             self.SkuIdSet=[(r[k].strip()).upper() for k in range(len(r))]\r
             k = None\r
-            try: \r
+            try:\r
                 self.SkuIdNumberSet = [SkuIds[k][0].strip() + 'U' for k in self.SkuIdSet]\r
             except Exception:\r
                 EdkLogger.error("build", PARAMETER_INVALID,\r
@@ -2027,7 +2027,7 @@ class SkuClass():
         skuorderset = []\r
         for skuname in self.SkuIdSet:\r
             skuorderset.append(self.GetSkuChain(skuname))\r
-        \r
+\r
         skuorder = []\r
         for index in range(max(len(item) for item in skuorderset)):\r
             for subset in skuorderset:\r
@@ -2039,8 +2039,8 @@ class SkuClass():
 \r
         return skuorder\r
 \r
-    def __SkuUsageType(self): \r
-        \r
+    def __SkuUsageType(self):\r
+\r
         if self.__SkuIdentifier.upper() == "ALL":\r
             return SkuClass.MULTIPLE\r
 \r
@@ -2073,7 +2073,7 @@ class SkuClass():
         return ArrayStr\r
     def __GetAvailableSkuIds(self):\r
         return self.AvailableSkuIds\r
-    \r
+\r
     def __GetSystemSkuID(self):\r
         if self.__SkuUsageType() == SkuClass.SINGLE:\r
             if len(self.SkuIdSet) == 1:\r