BaseTools: fix imports

1 - Some of these imports are cascaded from another file. Import them locally.
2 - Some of these imports are not used. Remove them.
3 - Some of these were missing the namespace used to import them.

These changes facilitate optimization of BaseTools:
https://bugzilla.tianocore.org/show_bug.cgi?id=42

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
This commit is contained in:
Carsey, Jaben
2019-01-10 03:00:41 +08:00
committed by BobCF
parent a53a888de8
commit 938cf4c33a
14 changed files with 38 additions and 32 deletions

View File

@ -1101,7 +1101,7 @@ class FdfParser:
def _GetNextGuid(self):
if not self._GetNextToken():
return False
if gGuidPattern.match(self._Token) is not None:
if GlobalData.gGuidPattern.match(self._Token) is not None:
return True
else:
self._UndoToken()
@ -1169,7 +1169,7 @@ class FdfParser:
def _GetNextHexNumber(self):
if not self._GetNextToken():
return False
if gHexPatternAll.match(self._Token):
if GlobalData.gHexPatternAll.match(self._Token):
return True
else:
self._UndoToken()

View File

@ -30,6 +30,7 @@ from . import RuleSimpleFile
from . import RuleComplexFile
from CommonDataClass.FdfClass import FfsInfStatementClassObject
from Common.MultipleWorkspace import MultipleWorkspace as mws
from Common.DataType import SUP_MODULE_USER_DEFINED
from Common.StringUtils import *
from Common.Misc import PathClass
from Common.Misc import GuidStructureByteArrayToGuidString
@ -94,7 +95,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
ModuleType = self.InfModule.ModuleType
PlatformDataBase = GenFdsGlobalVariable.WorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, self.CurrentArch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
if ModuleType != DataType.SUP_MODULE_USER_DEFINED:
if ModuleType != SUP_MODULE_USER_DEFINED:
for LibraryClass in PlatformDataBase.LibraryClasses.GetKeys():
if LibraryClass.startswith("NULL") and PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]:
self.InfModule.LibraryClasses[LibraryClass] = PlatformDataBase.LibraryClasses[LibraryClass, ModuleType]

View File

@ -1,7 +1,7 @@
## @file
# generate flash image
#
# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>
# Copyright (c) 2007 - 2019, Intel Corporation. All rights reserved.<BR>
#
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License

View File

@ -24,7 +24,6 @@ import Common.LongFilePathOs as os
from .GenFdsGlobalVariable import GenFdsGlobalVariable
from .GenFdsGlobalVariable import FindExtendTool
from CommonDataClass.FdfClass import GuidSectionClassObject
from Common import ToolDefClassObject
import sys
from Common import EdkLogger
from Common.BuildToolError import *