+\r
+## Check if two arches matched?\r
+#\r
+# @param Arch1\r
+# @param Arch2\r
+#\r
+def IsMatchArch(Arch1, Arch2):\r
+ if 'COMMON' in Arch1 or 'COMMON' in Arch2:\r
+ return True\r
+ if isinstance(Arch1, basestring) and isinstance(Arch2, basestring):\r
+ if Arch1 == Arch2:\r
+ return True\r
+\r
+ if isinstance(Arch1, basestring) and isinstance(Arch2, list):\r
+ return Arch1 in Arch2\r
+\r
+ if isinstance(Arch2, basestring) and isinstance(Arch1, list):\r
+ return Arch2 in Arch1\r
+\r
+ if isinstance(Arch1, list) and isinstance(Arch2, list):\r
+ for Item1 in Arch1:\r
+ for Item2 in Arch2:\r
+ if Item1 == Item2:\r
+ return True\r
+\r
+ return False\r
+\r
+# Search all files in FilePath to find the FileName with the largest index\r
+# Return the FileName with index +1 under the FilePath\r
+#\r
+def GetUniFileName(FilePath, FileName):\r
+ Files = os.listdir(FilePath)\r
+ LargestIndex = -1\r
+ for File in Files:\r
+ if File.upper().startswith(FileName.upper()) and File.upper().endswith('.UNI'):\r
+ Index = File.upper().replace(FileName.upper(), '').replace('.UNI', '')\r
+ if Index:\r
+ try:\r
+ Index = int(Index)\r
+ except Exception:\r
+ Index = -1\r
+ else:\r
+ Index = 0\r
+ if Index > LargestIndex:\r
+ LargestIndex = Index + 1\r
+\r
+ if LargestIndex > -1:\r
+ return os.path.normpath(os.path.join(FilePath, FileName + str(LargestIndex) + '.uni'))\r
+ else:\r
+ return os.path.normpath(os.path.join(FilePath, FileName + '.uni'))\r