]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/Common/MultipleWorkspace.py
BaseTools: Replace StandardError with Expression
[mirror_edk2.git] / BaseTools / Source / Python / Common / MultipleWorkspace.py
index feb1f8d5ebe6e67706045c31b5c459d6936b1008..2a76d49cc627ad6cd96ceef1818cb2a7d215f184 100644 (file)
@@ -4,7 +4,7 @@
 # This file is required to make Python interpreter treat the directory\r
 # as containing package.\r
 #\r
-# Copyright (c) 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -128,12 +128,20 @@ class MultipleWorkspace(object):
     @classmethod\r
     def handleWsMacro(cls, PathStr):\r
         if TAB_WORKSPACE in PathStr:\r
-            Path = PathStr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()\r
-            if not os.path.exists(Path):\r
-                for Pkg in cls.PACKAGES_PATH:\r
-                    Path = PathStr.replace(TAB_WORKSPACE, Pkg).strip()\r
-                    if os.path.exists(Path):\r
-                        return Path\r
+            PathList = PathStr.split()\r
+            if PathList:\r
+                for i, str in enumerate(PathList):\r
+                    MacroStartPos = str.find(TAB_WORKSPACE)\r
+                    if MacroStartPos != -1:\r
+                        Substr = str[MacroStartPos:]\r
+                        Path = Substr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()\r
+                        if not os.path.exists(Path):\r
+                            for Pkg in cls.PACKAGES_PATH:\r
+                                Path = Substr.replace(TAB_WORKSPACE, Pkg).strip()\r
+                                if os.path.exists(Path):\r
+                                    break\r
+                        PathList[i] = str[0:MacroStartPos] + Path\r
+            PathStr = ' '.join(PathList)\r
         return PathStr\r
     \r
     ## getPkgPath()\r