X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FCommon%2FMultipleWorkspace.py;h=2a76d49cc627ad6cd96ceef1818cb2a7d215f184;hb=05a32984ab799a564e2eeb7dff128fe0992910d8;hp=8088404f30eb2941e50409946f71123225cd3aea;hpb=05cc51ad5894c8904d0fe5cdcf3f4d0a07dab85d;p=mirror_edk2.git
diff --git a/BaseTools/Source/Python/Common/MultipleWorkspace.py b/BaseTools/Source/Python/Common/MultipleWorkspace.py
index 8088404f30..2a76d49cc6 100644
--- a/BaseTools/Source/Python/Common/MultipleWorkspace.py
+++ b/BaseTools/Source/Python/Common/MultipleWorkspace.py
@@ -4,7 +4,7 @@
# This file is required to make Python interpreter treat the directory
# as containing package.
#
-# Copyright (c) 2015, Intel Corporation. All rights reserved.
+# Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -41,7 +41,7 @@ class MultipleWorkspace(object):
@classmethod
def convertPackagePath(cls, Ws, Path):
if str(os.path.normcase (Path)).startswith(Ws):
- return os.path.join(Ws, Path[len(Ws) + 1:])
+ return os.path.join(Ws, os.path.relpath(Path, Ws))
return Path
## setWs()
@@ -128,12 +128,20 @@ class MultipleWorkspace(object):
@classmethod
def handleWsMacro(cls, PathStr):
if TAB_WORKSPACE in PathStr:
- Path = PathStr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()
- if not os.path.exists(Path):
- for Pkg in cls.PACKAGES_PATH:
- Path = PathStr.replace(TAB_WORKSPACE, Pkg).strip()
- if os.path.exists(Path):
- return Path
+ PathList = PathStr.split()
+ if PathList:
+ for i, str in enumerate(PathList):
+ MacroStartPos = str.find(TAB_WORKSPACE)
+ if MacroStartPos != -1:
+ Substr = str[MacroStartPos:]
+ Path = Substr.replace(TAB_WORKSPACE, cls.WORKSPACE).strip()
+ if not os.path.exists(Path):
+ for Pkg in cls.PACKAGES_PATH:
+ Path = Substr.replace(TAB_WORKSPACE, Pkg).strip()
+ if os.path.exists(Path):
+ break
+ PathList[i] = str[0:MacroStartPos] + Path
+ PathStr = ' '.join(PathList)
return PathStr
## getPkgPath()