BaseTools: Update UPT tool to support multiple workspaces
Update UPT to refer MultipleWorkspace class to convert the file path from WORKSPACE and PACKAGES_PATH. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Hesheng Chen <hesheng.chen@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@18580 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -19,6 +19,7 @@ GlobalData
|
||||
# The workspace directory
|
||||
#
|
||||
gWORKSPACE = '.'
|
||||
gPACKAGE_PATH = None
|
||||
|
||||
#
|
||||
# INF module directory
|
||||
@@ -107,4 +108,4 @@ gPackageDict = {}
|
||||
# Used by Library instance parser
|
||||
# {FilePath: FileObj}
|
||||
#
|
||||
gLIBINSTANCEDICT = {}
|
||||
gLIBINSTANCEDICT = {}
|
||||
|
@@ -50,6 +50,7 @@ from Library.ParserValidate import IsValidHexVersion
|
||||
from Library.ParserValidate import IsValidPath
|
||||
from Object.POM.CommonObject import TextObject
|
||||
from Core.FileHook import __FileHookOpen__
|
||||
from CommonDataClass.CommonClass import MultipleWorkspace as mws
|
||||
|
||||
## Convert GUID string in xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx style to C
|
||||
# structure style
|
||||
@@ -592,7 +593,11 @@ def GetWorkspace():
|
||||
|
||||
if WorkspaceDir[-1] == ':':
|
||||
WorkspaceDir += os.sep
|
||||
return WorkspaceDir
|
||||
|
||||
PackagesPath = os.environ.get("PACKAGES_PATH")
|
||||
mws.setWs(WorkspaceDir, PackagesPath)
|
||||
|
||||
return WorkspaceDir, mws.PACKAGES_PATH
|
||||
|
||||
## Get relative path
|
||||
#
|
||||
|
@@ -27,6 +27,7 @@ from Library.DataType import TAB_SPACE_SPLIT
|
||||
from Library.String import GetSplitValueList
|
||||
from Library.ExpressionValidate import IsValidBareCString
|
||||
from Library.ExpressionValidate import IsValidFeatureFlagExp
|
||||
from CommonDataClass.CommonClass import MultipleWorkspace as mws
|
||||
|
||||
## __HexDigit() method
|
||||
#
|
||||
@@ -236,7 +237,7 @@ def IsValidPath(Path, Root):
|
||||
|
||||
Path = os.path.normpath(Path).replace('\\', '/')
|
||||
Root = os.path.normpath(Root).replace('\\', '/')
|
||||
FullPath = os.path.normpath(os.path.join(Root, Path)).replace('\\', '/')
|
||||
FullPath = mws.join(Root, Path)
|
||||
|
||||
if not os.path.exists(FullPath):
|
||||
return False
|
||||
|
@@ -827,21 +827,23 @@ def GetPkgInfoFromDec(Path):
|
||||
def GetWorkspacePackage():
|
||||
DecFileList = []
|
||||
WorkspaceDir = GlobalData.gWORKSPACE
|
||||
for Root, Dirs, Files in os.walk(WorkspaceDir):
|
||||
if 'CVS' in Dirs:
|
||||
Dirs.remove('CVS')
|
||||
if '.svn' in Dirs:
|
||||
Dirs.remove('.svn')
|
||||
for Dir in Dirs:
|
||||
if Dir.startswith('.'):
|
||||
Dirs.remove(Dir)
|
||||
for FileSp in Files:
|
||||
if FileSp.startswith('.'):
|
||||
continue
|
||||
Ext = os.path.splitext(FileSp)[1]
|
||||
if Ext.lower() in ['.dec']:
|
||||
DecFileList.append\
|
||||
(os.path.normpath(os.path.join(Root, FileSp)))
|
||||
PackageDir = GlobalData.gPACKAGE_PATH
|
||||
for PkgRoot in [WorkspaceDir] + PackageDir:
|
||||
for Root, Dirs, Files in os.walk(PkgRoot):
|
||||
if 'CVS' in Dirs:
|
||||
Dirs.remove('CVS')
|
||||
if '.svn' in Dirs:
|
||||
Dirs.remove('.svn')
|
||||
for Dir in Dirs:
|
||||
if Dir.startswith('.'):
|
||||
Dirs.remove(Dir)
|
||||
for FileSp in Files:
|
||||
if FileSp.startswith('.'):
|
||||
continue
|
||||
Ext = os.path.splitext(FileSp)[1]
|
||||
if Ext.lower() in ['.dec']:
|
||||
DecFileList.append\
|
||||
(os.path.normpath(os.path.join(Root, FileSp)))
|
||||
#
|
||||
# abstract package guid, version info from DecFile List
|
||||
#
|
||||
|
Reference in New Issue
Block a user