diff options
author | Jeff Fan <jeff.fan@intel.com> | 2015-11-16 05:29:49 +0000 |
---|---|---|
committer | vanjeff <vanjeff@Edk2> | 2015-11-16 05:29:49 +0000 |
commit | af7fca3649779f0e55220a7acda9bd11bc660fc3 (patch) | |
tree | 02585c606e356ce06fefa9ff80bc4529fcde256e /BaseTools/Source/Python/Common | |
parent | 59fd15c5a2174a6a6fc4133964e6d5b520b58663 (diff) | |
download | edk2-platforms-af7fca3649779f0e55220a7acda9bd11bc660fc3.tar.xz |
Update BaseTools from main trunk r18767.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@18784 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/Common')
-rw-r--r-- | BaseTools/Source/Python/Common/EdkIIWorkspace.py | 3 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/FdfParserLite.py | 6 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/LongFilePathOsPath.py | 2 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/Misc.py | 7 | ||||
-rw-r--r-- | BaseTools/Source/Python/Common/String.py | 8 |
5 files changed, 21 insertions, 5 deletions
diff --git a/BaseTools/Source/Python/Common/EdkIIWorkspace.py b/BaseTools/Source/Python/Common/EdkIIWorkspace.py index 84d89b6c2e..401efeef3c 100644 --- a/BaseTools/Source/Python/Common/EdkIIWorkspace.py +++ b/BaseTools/Source/Python/Common/EdkIIWorkspace.py @@ -17,6 +17,7 @@ import Common.LongFilePathOs as os, sys, time
from DataType import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## EdkIIWorkspace
#
@@ -112,7 +113,7 @@ class EdkIIWorkspace: # @retval string The full path filename
#
def WorkspaceFile(self, FileName):
- return os.path.realpath(os.path.join(self.WorkspaceDir,FileName))
+ return os.path.realpath(mws.join(self.WorkspaceDir,FileName))
## Convert to a real path filename
#
diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py index 54a60a7e8f..a0ee249748 100644 --- a/BaseTools/Source/Python/Common/FdfParserLite.py +++ b/BaseTools/Source/Python/Common/FdfParserLite.py @@ -20,6 +20,7 @@ import Common.LongFilePathOs as os import CommonDataClass.FdfClass
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
##define T_CHAR_SPACE ' '
##define T_CHAR_NULL '\0'
@@ -485,7 +486,8 @@ class FdfParser(object): IncFileName = self.__Token
if not os.path.isabs(IncFileName):
if IncFileName.startswith('$(WORKSPACE)'):
- Str = IncFileName.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))
+ Str = mws.handleWsMacro(IncFileName)
+ Str = Str.replace('$(WORKSPACE)', os.environ.get('WORKSPACE'))
if os.path.exists(Str):
if not os.path.isabs(Str):
Str = os.path.abspath(Str)
@@ -494,7 +496,7 @@ class FdfParser(object): # file is in the same dir with FDF file
FullFdf = self.FileName
if not os.path.isabs(self.FileName):
- FullFdf = os.path.join(os.environ.get('WORKSPACE'), self.FileName)
+ FullFdf = mws.join(os.environ.get('WORKSPACE'), self.FileName)
IncFileName = os.path.join(os.path.dirname(FullFdf), IncFileName)
diff --git a/BaseTools/Source/Python/Common/LongFilePathOsPath.py b/BaseTools/Source/Python/Common/LongFilePathOsPath.py index cb89b1b813..0bba446419 100644 --- a/BaseTools/Source/Python/Common/LongFilePathOsPath.py +++ b/BaseTools/Source/Python/Common/LongFilePathOsPath.py @@ -49,3 +49,5 @@ dirname = os.path.dirname islink = os.path.islink
isabs = os.path.isabs
realpath = os.path.realpath
+relpath = os.path.relpath
+pardir = os.path.pardir
diff --git a/BaseTools/Source/Python/Common/Misc.py b/BaseTools/Source/Python/Common/Misc.py index 8ba5819cc1..0eedddc861 100644 --- a/BaseTools/Source/Python/Common/Misc.py +++ b/BaseTools/Source/Python/Common/Misc.py @@ -35,6 +35,7 @@ from BuildToolError import * from CommonDataClass.DataClass import *
from Parsing import GetSplitValueList
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
## Regular expression used to find out place holders in string template
gPlaceholderPattern = re.compile("\$\{([^$()\s]+)\}", re.MULTILINE|re.UNICODE)
@@ -1728,6 +1729,7 @@ class PathClass(object): # Remove any '.' and '..' in path
if self.Root:
+ self.Root = mws.getWs(self.Root, self.File)
self.Path = os.path.normpath(os.path.join(self.Root, self.File))
self.Root = os.path.normpath(CommonPath([self.Root, self.Path]))
# eliminate the side-effect of 'C:'
@@ -1838,7 +1840,10 @@ class PathClass(object): RealFile = os.path.join(self.AlterRoot, self.File)
elif self.Root:
RealFile = os.path.join(self.Root, self.File)
- return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
+ if len (mws.getPkgPath()) == 0:
+ return FILE_NOT_FOUND, os.path.join(self.AlterRoot, RealFile)
+ else:
+ return FILE_NOT_FOUND, "%s is not found in packages path:\n\t%s" % (self.File, '\n\t'.join(mws.getPkgPath()))
ErrorCode = 0
ErrorInfo = ''
diff --git a/BaseTools/Source/Python/Common/String.py b/BaseTools/Source/Python/Common/String.py index 6c9671d514..5c8d1e0ded 100644 --- a/BaseTools/Source/Python/Common/String.py +++ b/BaseTools/Source/Python/Common/String.py @@ -24,6 +24,7 @@ import GlobalData from BuildToolError import *
from CommonDataClass.Exceptions import *
from Common.LongFilePathSupport import OpenLongFilePath as open
+from Common.MultipleWorkspace import MultipleWorkspace as mws
gHexVerPatt = re.compile('0x[a-f0-9]{4}[a-f0-9]{4}$', re.IGNORECASE)
gHumanReadableVerPatt = re.compile(r'([1-9][0-9]*|0)\.[0-9]{1,2}$')
@@ -305,6 +306,11 @@ def NormPath(Path, Defines={}): # To local path format
#
Path = os.path.normpath(Path)
+ if Path.startswith(GlobalData.gWorkspace) and not os.path.exists(Path):
+ Path = Path[len (GlobalData.gWorkspace):]
+ if Path[0] == os.path.sep:
+ Path = Path[1:]
+ Path = mws.join(GlobalData.gWorkspace, Path)
if IsRelativePath and Path[0] != '.':
Path = os.path.join('.', Path)
@@ -702,7 +708,7 @@ def RaiseParserError(Line, Section, File, Format='', LineNo= -1): # @retval string A full path
#
def WorkspaceFile(WorkspaceDir, Filename):
- return os.path.join(NormPath(WorkspaceDir), NormPath(Filename))
+ return mws.join(NormPath(WorkspaceDir), NormPath(Filename))
## Split string
#
|