BaseTools: Clean up source files
1. Do not use tab characters 2. No trailing white space in one line 3. All files must end with CRLF Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com> Cc: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
@@ -369,10 +369,10 @@ class MetaFileParser(object):
|
||||
EdkLogger.error("Parser", FORMAT_INVALID, "Global macro %s is not permitted." % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
|
||||
else:
|
||||
EdkLogger.error("Parser", FORMAT_INVALID, "%s not defined" % (Macro), ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex + 1)
|
||||
# Sometimes, we need to make differences between EDK and EDK2 modules
|
||||
# Sometimes, we need to make differences between EDK and EDK2 modules
|
||||
if Name == 'INF_VERSION':
|
||||
if hexVersionPattern.match(Value):
|
||||
self._Version = int(Value, 0)
|
||||
self._Version = int(Value, 0)
|
||||
elif decVersionPattern.match(Value):
|
||||
ValueList = Value.split('.')
|
||||
Major = '%04o' % int(ValueList[0], 0)
|
||||
@@ -418,7 +418,7 @@ class MetaFileParser(object):
|
||||
Macros.update(self._GetApplicableSectionMacro())
|
||||
return Macros
|
||||
|
||||
## Construct section Macro dict
|
||||
## Construct section Macro dict
|
||||
def _ConstructSectionMacroDict(self, Name, Value):
|
||||
ScopeKey = [(Scope[0], Scope[1], Scope[2]) for Scope in self._Scope]
|
||||
ScopeKey = tuple(ScopeKey)
|
||||
@@ -433,7 +433,7 @@ class MetaFileParser(object):
|
||||
|
||||
self._SectionsMacroDict[SectionDictKey][Name] = Value
|
||||
|
||||
## Get section Macros that are applicable to current line, which may come from other sections
|
||||
## Get section Macros that are applicable to current line, which may come from other sections
|
||||
## that share the same name while scope is wider
|
||||
def _GetApplicableSectionMacro(self):
|
||||
Macros = {}
|
||||
@@ -1351,7 +1351,7 @@ class DscParser(MetaFileParser):
|
||||
try:
|
||||
Processer[self._ItemType]()
|
||||
except EvaluationException as Excpt:
|
||||
#
|
||||
#
|
||||
# Only catch expression evaluation error here. We need to report
|
||||
# the precise number of line on which the error occurred
|
||||
#
|
||||
@@ -1478,7 +1478,7 @@ class DscParser(MetaFileParser):
|
||||
EdkLogger.debug(EdkLogger.DEBUG_5, str(Exc), self._ValueList[1])
|
||||
Result = False
|
||||
except WrnExpression as Excpt:
|
||||
#
|
||||
#
|
||||
# Catch expression evaluation warning here. We need to report
|
||||
# the precise number of line and return the evaluation result
|
||||
#
|
||||
@@ -1535,7 +1535,7 @@ class DscParser(MetaFileParser):
|
||||
__IncludeMacros['EFI_SOURCE'] = GlobalData.gGlobalDefines['EFI_SOURCE']
|
||||
__IncludeMacros['EDK_SOURCE'] = GlobalData.gGlobalDefines['EDK_SOURCE']
|
||||
#
|
||||
# Allow using MACROs comes from [Defines] section to keep compatible.
|
||||
# Allow using MACROs comes from [Defines] section to keep compatible.
|
||||
#
|
||||
__IncludeMacros.update(self._Macros)
|
||||
|
||||
|
@@ -56,7 +56,7 @@ class MetaFileTable(Table):
|
||||
Result = self.Cur.execute("select ID from %s where ID<0" % (self.Table)).fetchall()
|
||||
if not Result:
|
||||
# update the timestamp in database
|
||||
self._FileIndexTable.SetFileTimeStamp(self.IdBase, TimeStamp)
|
||||
self._FileIndexTable.SetFileTimeStamp(self.IdBase, TimeStamp)
|
||||
return False
|
||||
|
||||
if TimeStamp != self._FileIndexTable.GetFileTimeStamp(self.IdBase):
|
||||
@@ -113,28 +113,28 @@ class ModuleTable(MetaFileTable):
|
||||
BelongsToItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0):
|
||||
(Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))
|
||||
return Table.Insert(
|
||||
self,
|
||||
Model,
|
||||
Value1,
|
||||
Value2,
|
||||
Value3,
|
||||
Scope1,
|
||||
self,
|
||||
Model,
|
||||
Value1,
|
||||
Value2,
|
||||
Value3,
|
||||
Scope1,
|
||||
Scope2,
|
||||
BelongsToItem,
|
||||
StartLine,
|
||||
StartColumn,
|
||||
EndLine,
|
||||
EndColumn,
|
||||
BelongsToItem,
|
||||
StartLine,
|
||||
StartColumn,
|
||||
EndLine,
|
||||
EndColumn,
|
||||
Enabled
|
||||
)
|
||||
|
||||
## Query table
|
||||
#
|
||||
# @param Model: The Model of Record
|
||||
# @param Arch: The Arch attribute of Record
|
||||
# @param Platform The Platform attribute of Record
|
||||
# @param Model: The Model of Record
|
||||
# @param Arch: The Arch attribute of Record
|
||||
# @param Platform The Platform attribute of Record
|
||||
#
|
||||
# @retval: A recordSet of all found records
|
||||
# @retval: A recordSet of all found records
|
||||
#
|
||||
def Query(self, Model, Arch=None, Platform=None, BelongsToItem=None):
|
||||
ConditionString = "Model=%s AND Enabled>=0" % Model
|
||||
@@ -195,27 +195,27 @@ class PackageTable(MetaFileTable):
|
||||
BelongsToItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=0):
|
||||
(Value1, Value2, Value3, Scope1, Scope2) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2))
|
||||
return Table.Insert(
|
||||
self,
|
||||
Model,
|
||||
Value1,
|
||||
Value2,
|
||||
Value3,
|
||||
Scope1,
|
||||
self,
|
||||
Model,
|
||||
Value1,
|
||||
Value2,
|
||||
Value3,
|
||||
Scope1,
|
||||
Scope2,
|
||||
BelongsToItem,
|
||||
StartLine,
|
||||
StartColumn,
|
||||
EndLine,
|
||||
EndColumn,
|
||||
BelongsToItem,
|
||||
StartLine,
|
||||
StartColumn,
|
||||
EndLine,
|
||||
EndColumn,
|
||||
Enabled
|
||||
)
|
||||
|
||||
## Query table
|
||||
#
|
||||
# @param Model: The Model of Record
|
||||
# @param Arch: The Arch attribute of Record
|
||||
# @param Model: The Model of Record
|
||||
# @param Arch: The Arch attribute of Record
|
||||
#
|
||||
# @retval: A recordSet of all found records
|
||||
# @retval: A recordSet of all found records
|
||||
#
|
||||
def Query(self, Model, Arch=None):
|
||||
ConditionString = "Model=%s AND Enabled>=0" % Model
|
||||
@@ -236,7 +236,7 @@ class PackageTable(MetaFileTable):
|
||||
try:
|
||||
for row in self.Cur:
|
||||
comment = row[0]
|
||||
|
||||
|
||||
LineNum = row[1]
|
||||
comment = comment.strip("#")
|
||||
comment = comment.strip()
|
||||
@@ -310,32 +310,32 @@ class PlatformTable(MetaFileTable):
|
||||
FromItem=-1, StartLine=-1, StartColumn=-1, EndLine=-1, EndColumn=-1, Enabled=1):
|
||||
(Value1, Value2, Value3, Scope1, Scope2, Scope3) = ConvertToSqlString((Value1, Value2, Value3, Scope1, Scope2, Scope3))
|
||||
return Table.Insert(
|
||||
self,
|
||||
Model,
|
||||
Value1,
|
||||
Value2,
|
||||
Value3,
|
||||
Scope1,
|
||||
self,
|
||||
Model,
|
||||
Value1,
|
||||
Value2,
|
||||
Value3,
|
||||
Scope1,
|
||||
Scope2,
|
||||
Scope3,
|
||||
BelongsToItem,
|
||||
BelongsToItem,
|
||||
FromItem,
|
||||
StartLine,
|
||||
StartColumn,
|
||||
EndLine,
|
||||
EndColumn,
|
||||
StartLine,
|
||||
StartColumn,
|
||||
EndLine,
|
||||
EndColumn,
|
||||
Enabled
|
||||
)
|
||||
|
||||
## Query table
|
||||
#
|
||||
# @param Model: The Model of Record
|
||||
# @param Model: The Model of Record
|
||||
# @param Scope1: Arch of a Dsc item
|
||||
# @param Scope2: Module type of a Dsc item
|
||||
# @param BelongsToItem: The item belongs to which another item
|
||||
# @param FromItem: The item belongs to which dsc file
|
||||
#
|
||||
# @retval: A recordSet of all found records
|
||||
# @retval: A recordSet of all found records
|
||||
#
|
||||
def Query(self, Model, Scope1=None, Scope2=None, BelongsToItem=None, FromItem=None):
|
||||
ConditionString = "Model=%s AND Enabled>0" % Model
|
||||
|
@@ -114,8 +114,8 @@ class WorkspaceDatabase(object):
|
||||
|
||||
# get the parser ready for this file
|
||||
MetaFile = self._FILE_PARSER_[FileType](
|
||||
FilePath,
|
||||
FileType,
|
||||
FilePath,
|
||||
FileType,
|
||||
Arch,
|
||||
MetaFileStorage(self.WorkspaceDb.Cur, FilePath, FileType)
|
||||
)
|
||||
@@ -162,7 +162,7 @@ class WorkspaceDatabase(object):
|
||||
# remove db file in case inconsistency between db and file in file system
|
||||
if self._CheckWhetherDbNeedRenew(RenewDb, DbPath):
|
||||
os.remove(DbPath)
|
||||
|
||||
|
||||
# create db with optimized parameters
|
||||
self.Conn = sqlite3.connect(DbPath, isolation_level='DEFERRED')
|
||||
self.Conn.execute("PRAGMA synchronous=OFF")
|
||||
@@ -199,11 +199,11 @@ class WorkspaceDatabase(object):
|
||||
def _CheckWhetherDbNeedRenew (self, force, DbPath):
|
||||
# if database does not exist, we need do nothing
|
||||
if not os.path.exists(DbPath): return False
|
||||
|
||||
|
||||
# if user force to renew database, then not check whether database is out of date
|
||||
if force: return True
|
||||
|
||||
#
|
||||
|
||||
#
|
||||
# Check the time of last modified source file or build.exe
|
||||
# if is newer than time of database, then database need to be re-created.
|
||||
#
|
||||
@@ -217,15 +217,15 @@ class WorkspaceDatabase(object):
|
||||
if rootPath == "" or rootPath is None:
|
||||
EdkLogger.verbose("\nFail to find the root path of build.exe or python sources, so can not \
|
||||
determine whether database file is out of date!\n")
|
||||
|
||||
|
||||
# walk the root path of source or build's binary to get the time last modified.
|
||||
|
||||
|
||||
for root, dirs, files in os.walk (rootPath):
|
||||
for dir in dirs:
|
||||
# bypass source control folder
|
||||
# bypass source control folder
|
||||
if dir.lower() in [".svn", "_svn", "cvs"]:
|
||||
dirs.remove(dir)
|
||||
|
||||
|
||||
for file in files:
|
||||
ext = os.path.splitext(file)[1]
|
||||
if ext.lower() == ".py": # only check .py files
|
||||
@@ -235,9 +235,9 @@ determine whether database file is out of date!\n")
|
||||
if timeOfToolModified > os.stat(DbPath).st_mtime:
|
||||
EdkLogger.verbose("\nWorkspace database is out of data!")
|
||||
return True
|
||||
|
||||
|
||||
return False
|
||||
|
||||
|
||||
## Initialize build database
|
||||
def InitDatabase(self):
|
||||
EdkLogger.verbose("\nInitialize build database started ...")
|
||||
|
Reference in New Issue
Block a user