本文整理汇总了Python中Common.MultipleWorkspace.MultipleWorkspace类的典型用法代码示例。如果您正苦于以下问题:Python MultipleWorkspace类的具体用法?Python MultipleWorkspace怎么用?Python MultipleWorkspace使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MultipleWorkspace类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GetIncludeListOfFile
def GetIncludeListOfFile(WorkSpace, Filepath, Db):
IncludeList = []
Filepath = os.path.normpath(Filepath)
SqlCommand = """
select Value1, FullPath from Inf, File where Inf.Model = %s and Inf.BelongsToFile in(
select distinct B.BelongsToFile from File as A left join Inf as B
where A.ID = B.BelongsToFile and B.Model = %s and (A.Path || '%s' || B.Value1) = '%s')
and Inf.BelongsToFile = File.ID""" \
% (MODEL_META_DATA_PACKAGE, MODEL_EFI_SOURCE_FILE, '\\', Filepath)
RecordSet = Db.TblFile.Exec(SqlCommand)
for Record in RecordSet:
DecFullPath = os.path.normpath(mws.join(WorkSpace, Record[0]))
InfFullPath = os.path.normpath(mws.join(WorkSpace, Record[1]))
(DecPath, DecName) = os.path.split(DecFullPath)
(InfPath, InfName) = os.path.split(InfFullPath)
SqlCommand = """select Value1 from Dec where BelongsToFile =
(select ID from File where FullPath = '%s') and Model = %s""" \
% (DecFullPath, MODEL_EFI_INCLUDE)
NewRecordSet = Db.TblDec.Exec(SqlCommand)
if InfPath not in IncludeList:
IncludeList.append(InfPath)
for NewRecord in NewRecordSet:
IncludePath = os.path.normpath(os.path.join(DecPath, NewRecord[0]))
if IncludePath not in IncludeList:
IncludeList.append(IncludePath)
return IncludeList
示例2: __init__
def __init__(self):
# Version and Copyright
self.VersionNumber = ("1.0" + " Build " + gBUILD_VERSION)
self.Version = "%prog Version " + self.VersionNumber
self.Copyright = "Copyright (c) 2009 - 2018, Intel Corporation All rights reserved."
self.InitDefaultConfigIni()
self.OutputFile = 'output.txt'
self.ReportFile = 'Report.csv'
self.ExceptionFile = 'exception.xml'
self.IsInit = True
self.ScanSourceCode = True
self.ScanMetaData = True
self.MetaFile = ''
self.OnlyScan = None
# Parse the options and args
self.ParseOption()
EdkLogger.info(time.strftime("%H:%M:%S, %b.%d %Y ", time.localtime()) + "[00:00]" + "\n")
WorkspaceDir = os.path.normcase(os.path.normpath(os.environ["WORKSPACE"]))
os.environ["WORKSPACE"] = WorkspaceDir
# set multiple workspace
PackagesPath = os.getenv("PACKAGES_PATH")
mws.setWs(WorkspaceDir, PackagesPath)
GlobalData.gWorkspace = WorkspaceDir
GlobalData.gGlobalDefines["WORKSPACE"] = WorkspaceDir
EdkLogger.info("Loading ECC configuration ... done")
# Generate checkpoints list
EccGlobalData.gConfig = Configuration(self.ConfigFile)
# Generate exception list
EccGlobalData.gException = ExceptionCheck(self.ExceptionFile)
# Init Ecc database
EccGlobalData.gDb = Database.Database(Database.DATABASE_PATH)
EccGlobalData.gDb.InitDatabase(self.IsInit)
#
# Get files real name in workspace dir
#
GlobalData.gAllFiles = DirCache(GlobalData.gWorkspace)
# Build ECC database
# self.BuildDatabase()
self.DetectOnlyScanDirs()
# Start to check
self.Check()
# Show report
self.GenReport()
# Close Database
EccGlobalData.gDb.Close()
示例3: ReplaceWorkspaceMacro
def ReplaceWorkspaceMacro(String):
String = mws.handleWsMacro(String)
Str = String.replace('$(WORKSPACE)', GenFdsGlobalVariable.WorkSpaceDir)
if os.path.exists(Str):
if not os.path.isabs(Str):
Str = os.path.abspath(Str)
else:
Str = mws.join(GenFdsGlobalVariable.WorkSpaceDir, String)
return os.path.normpath(Str)
示例4: GetDistributionPackage
def GetDistributionPackage(self, WorkspaceDir, PackageList, ModuleList):
# Backup WorkspaceDir
Root = WorkspaceDir
#
# Get Packages
#
if PackageList:
for PackageFile in PackageList:
PackageFileFullPath = mws.join(Root, PackageFile)
WorkspaceDir = mws.getWs(Root, PackageFile)
DecObj = DecPomAlignment(PackageFileFullPath, WorkspaceDir, CheckMulDec=True)
PackageObj = DecObj
#
# Parser inf file one bye one
#
ModuleInfFileList = PackageObj.GetModuleFileList()
for File in ModuleInfFileList:
WsRelPath = os.path.join(PackageObj.GetPackagePath(), File)
WsRelPath = os.path.normpath(WsRelPath)
if ModuleList and WsRelPath in ModuleList:
Logger.Error("UPT",
OPTION_VALUE_INVALID,
ST.ERR_NOT_STANDALONE_MODULE_ERROR%\
(WsRelPath, PackageFile))
Filename = os.path.normpath\
(os.path.join(PackageObj.GetRelaPath(), File))
os.path.splitext(Filename)
#
# Call INF parser to generate Inf Object.
# Actually, this call is not directly call, but wrapped by
# Inf class in InfPomAlignment.
#
try:
ModuleObj = InfPomAlignment(Filename, WorkspaceDir, PackageObj.GetPackagePath())
#
# Add module to package
#
ModuleDict = PackageObj.GetModuleDict()
ModuleDict[(ModuleObj.GetGuid(), \
ModuleObj.GetVersion(), \
ModuleObj.GetName(), \
ModuleObj.GetCombinePath())] = ModuleObj
PackageObj.SetModuleDict(ModuleDict)
except FatalError, ErrCode:
if ErrCode.message == EDK1_INF_ERROR:
Logger.Warn("UPT",
ST.WRN_EDK1_INF_FOUND%Filename)
else:
raise
self.PackageSurfaceArea\
[(PackageObj.GetGuid(), PackageObj.GetVersion(), \
PackageObj.GetCombinePath())] = PackageObj
示例5: _GenPackages
def _GenPackages(self, Skip):
Logger.Debug(2, "Generate %s ..." % DT.TAB_PACKAGES)
#
# Get all Packages
#
PackageObj = self.Parser.InfPackageSection.Packages
#
# Go through each arch
#
for PackageItemObj in PackageObj:
#
# Need package information for dependency check usage
#
PackageDependency = PackageDependencyObject()
PackageDependency.SetPackageFilePath(NormPath(PackageItemObj.GetPackageName()))
PackageDependency.SetSupArchList(ConvertArchList(PackageItemObj.GetSupArchList()))
PackageDependency.SetFeatureFlag(PackageItemObj.GetFeatureFlagExp())
PkgInfo = GetPkgInfoFromDec(mws.join(self.WorkSpace, NormPath(PackageItemObj.GetPackageName())))
if PkgInfo[1] and PkgInfo[2]:
PackageDependency.SetGuid(PkgInfo[1])
PackageDependency.SetVersion(PkgInfo[2])
elif Skip:
continue
else:
Logger.Error("\nUPT", PARSER_ERROR,
ST.ERR_INF_GET_PKG_DEPENDENCY_FAIL % PackageItemObj.GetPackageName(), File=self.FullPath)
PackageDependencyList = self.GetPackageDependencyList()
PackageDependencyList.append(PackageDependency)
self.SetPackageDependencyList(PackageDependencyList)
示例6: __GetPlatformArchList__
def __GetPlatformArchList__(self):
InfFileKey = os.path.normpath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))
DscArchList = []
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IA32', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in PlatformDataBase.Modules:
DscArchList.append ('IA32')
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'X64', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in PlatformDataBase.Modules:
DscArchList.append ('X64')
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'IPF', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in (PlatformDataBase.Modules):
DscArchList.append ('IPF')
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'ARM', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in (PlatformDataBase.Modules):
DscArchList.append ('ARM')
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'EBC', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in (PlatformDataBase.Modules):
DscArchList.append ('EBC')
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'AARCH64', GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in (PlatformDataBase.Modules):
DscArchList.append ('AARCH64')
return DscArchList
示例7: CheckFileList
def CheckFileList(QualifiedExt, FileList, ErrorStringExt, ErrorStringFullPath):
if not FileList:
return
WorkspaceDir = GlobalData.gWORKSPACE
WorkspaceDir = os.path.normpath(WorkspaceDir)
for Item in FileList:
Ext = os.path.splitext(Item)[1]
if Ext.upper() != QualifiedExt.upper():
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \
ErrorStringExt % Item)
Item = os.path.normpath(Item)
Path = mws.join(WorkspaceDir, Item)
if not os.path.exists(Path):
Logger.Error("\nMkPkg", FILE_NOT_FOUND, ST.ERR_NOT_FOUND % Item)
elif Item == Path:
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID,
ErrorStringFullPath % Item)
elif not IsValidPath(Item, WorkspaceDir):
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \
ErrorStringExt % Item)
if not os.path.split(Item)[0]:
Logger.Error("\nMkPkg", OPTION_VALUE_INVALID, \
ST.ERR_INVALID_METAFILE_PATH % Item)
示例8: __GetPlatformArchList__
def __GetPlatformArchList__(self):
InfFileKey = os.path.normpath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))
DscArchList = []
for Arch in GenFdsGlobalVariable.ArchList :
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in PlatformDataBase.Modules:
DscArchList.append (Arch)
return DscArchList
示例9: GetWorkspace
def GetWorkspace():
#
# check WORKSPACE
#
if "WORKSPACE" in environ:
WorkspaceDir = os.path.normpath(environ["WORKSPACE"])
if not os.path.exists(WorkspaceDir):
Logger.Error("UPT",
ToolError.UPT_ENVIRON_MISSING_ERROR,
ST.ERR_WORKSPACE_NOTEXIST,
ExtraData="%s" % WorkspaceDir)
else:
WorkspaceDir = os.getcwd()
if WorkspaceDir[-1] == ':':
WorkspaceDir += os.sep
PackagesPath = os.environ.get("PACKAGES_PATH")
mws.setWs(WorkspaceDir, PackagesPath)
return WorkspaceDir, mws.PACKAGES_PATH
示例10: LoadToolDefFile
def LoadToolDefFile(self, FileName):
# set multiple workspace
PackagesPath = os.getenv("PACKAGES_PATH")
mws.setWs(GlobalData.gWorkspace, PackagesPath)
self.ToolsDefTxtDatabase = {
TAB_TOD_DEFINES_TARGET : [],
TAB_TOD_DEFINES_TOOL_CHAIN_TAG : [],
TAB_TOD_DEFINES_TARGET_ARCH : [],
TAB_TOD_DEFINES_COMMAND_TYPE : []
}
self.IncludeToolDefFile(FileName)
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET].sort()
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG].sort()
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH].sort()
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE].sort()
KeyList = [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG, TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE]
for Index in range(3, -1, -1):
# make a copy of the keys to enumerate over to prevent issues when
# adding/removing items from the original dict.
for Key in list(self.ToolsDefTxtDictionary.keys()):
List = Key.split('_')
if List[Index] == TAB_STAR:
for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
List[Index] = String
NewKey = '%s_%s_%s_%s_%s' % tuple(List)
if NewKey not in self.ToolsDefTxtDictionary:
self.ToolsDefTxtDictionary[NewKey] = self.ToolsDefTxtDictionary[Key]
del self.ToolsDefTxtDictionary[Key]
elif List[Index] not in self.ToolsDefTxtDatabase[KeyList[Index]]:
del self.ToolsDefTxtDictionary[Key]
示例11: LoadToolDefFile
def LoadToolDefFile(self, FileName):
# set multiple workspace
PackagesPath = os.getenv("PACKAGES_PATH")
mws.setWs(GlobalData.gWorkspace, PackagesPath)
self.ToolsDefTxtDatabase = {
TAB_TOD_DEFINES_TARGET : [],
TAB_TOD_DEFINES_TOOL_CHAIN_TAG : [],
TAB_TOD_DEFINES_TARGET_ARCH : [],
TAB_TOD_DEFINES_COMMAND_TYPE : []
}
self.IncludeToolDefFile(FileName)
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE] = list(set(self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE]))
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET].sort()
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TOOL_CHAIN_TAG].sort()
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_TARGET_ARCH].sort()
self.ToolsDefTxtDatabase[TAB_TOD_DEFINES_COMMAND_TYPE].sort()
KeyList = [TAB_TOD_DEFINES_TARGET, TAB_TOD_DEFINES_TOOL_CHAIN_TAG, TAB_TOD_DEFINES_TARGET_ARCH, TAB_TOD_DEFINES_COMMAND_TYPE]
for Index in range(3, -1, -1):
for Key in dict(self.ToolsDefTxtDictionary):
List = Key.split('_')
if List[Index] == '*':
for String in self.ToolsDefTxtDatabase[KeyList[Index]]:
List[Index] = String
NewKey = '%s_%s_%s_%s_%s' % tuple(List)
if NewKey not in self.ToolsDefTxtDictionary:
self.ToolsDefTxtDictionary[NewKey] = self.ToolsDefTxtDictionary[Key]
continue
del self.ToolsDefTxtDictionary[Key]
elif List[Index] not in self.ToolsDefTxtDatabase[KeyList[Index]]:
del self.ToolsDefTxtDictionary[Key]
示例12: IsValidPath
def IsValidPath(Path, Root):
Path = Path.strip()
OrigPath = Path.replace('\\', '/')
Path = os.path.normpath(Path).replace('\\', '/')
Root = os.path.normpath(Root).replace('\\', '/')
FullPath = mws.join(Root, Path)
if not os.path.exists(FullPath):
return False
#
# If Path is absolute path.
# It should be in Root.
#
if os.path.isabs(Path):
if not Path.startswith(Root):
return False
return True
#
# Check illegal character
#
for Rel in ['/', './', '../']:
if OrigPath.startswith(Rel):
return False
for Rel in ['//', '/./', '/../']:
if Rel in OrigPath:
return False
for Rel in ['/.', '/..', '/']:
if OrigPath.endswith(Rel):
return False
Path = Path.rstrip('/')
#
# Check relative path
#
for Word in Path.split('/'):
if not IsValidWord(Word):
return False
return True
示例13: __GetPlatformArchList__
def __GetPlatformArchList__(self):
InfFileKey = os.path.normpath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName))
DscArchList = []
for Arch in GenFdsGlobalVariable.ArchList :
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if PlatformDataBase != None:
if InfFileKey in PlatformDataBase.Modules:
DscArchList.append (Arch)
else:
#
# BaseTools support build same module more than once, the module path with FILE_GUID overridden has
# the file name FILE_GUIDmodule.inf, then PlatformDataBase.Modules use FILE_GUIDmodule.inf as key,
# but the path (self.MetaFile.Path) is the real path
#
for key in PlatformDataBase.Modules.keys():
if InfFileKey == str((PlatformDataBase.Modules[key]).MetaFile.Path):
DscArchList.append (Arch)
break
return DscArchList
示例14: NormPath
def NormPath(Path, Defines={}):
IsRelativePath = False
if Path:
if Path[0] == '.':
IsRelativePath = True
#
# Replace with Define
#
if Defines:
Path = ReplaceMacro(Path, Defines)
#
# To local path format
#
Path = os.path.normpath(Path)
if Path.startswith(GlobalData.gWorkspace) and not Path.startswith(GlobalData.gBuildDirectory) 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)
return Path
示例15: WorkspaceFile
def WorkspaceFile(self, FileName):
return os.path.realpath(mws.join(self.WorkspaceDir,FileName))