]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/UPT/Library/String.py
Sync BaseTool trunk (version r2670) into EDKII BaseTools.
[mirror_edk2.git] / BaseTools / Source / Python / UPT / Library / String.py
index 0953e47cb1db74541aa059cf22e719fb8de11602..f709ff1bce098437679e5a803075ed18ece003f9 100644 (file)
@@ -2,7 +2,7 @@
 # This file is used to define common string related functions used in parsing \r
 # process\r
 #\r
-# Copyright (c) 2011 - 2012, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2011 - 2014, Intel Corporation. All rights reserved.<BR>\r
 #\r
 # This program and the accompanying materials are licensed and made available \r
 # under the terms and conditions of the BSD License which accompanies this \r
@@ -937,3 +937,29 @@ def SplitPcdEntry(String):
             return ['', '', ''], False\r
         \r
     return ['', '', ''], False\r
+\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