mirror of https://github.com/acidanthera/audk.git
BaseTools/Common/Misc: move private functions
These 2 functions are only used internally. move them to the smallest scope and use them. 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:
parent
e3ef8f0c52
commit
42bd17508e
|
@ -566,32 +566,6 @@ def RealPath(File, Dir='', OverrideDir=''):
|
||||||
NewFile = GlobalData.gAllFiles[NewFile]
|
NewFile = GlobalData.gAllFiles[NewFile]
|
||||||
return NewFile
|
return NewFile
|
||||||
|
|
||||||
def RealPath2(File, Dir='', OverrideDir=''):
|
|
||||||
NewFile = None
|
|
||||||
if OverrideDir:
|
|
||||||
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
|
|
||||||
if NewFile:
|
|
||||||
if OverrideDir[-1] == os.path.sep:
|
|
||||||
return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
|
|
||||||
else:
|
|
||||||
return NewFile[len(OverrideDir) + 1:], NewFile[0:len(OverrideDir)]
|
|
||||||
if GlobalData.gAllFiles:
|
|
||||||
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
|
|
||||||
if not NewFile:
|
|
||||||
NewFile = os.path.normpath(os.path.join(Dir, File))
|
|
||||||
if not os.path.exists(NewFile):
|
|
||||||
return None, None
|
|
||||||
if NewFile:
|
|
||||||
if Dir:
|
|
||||||
if Dir[-1] == os.path.sep:
|
|
||||||
return NewFile[len(Dir):], NewFile[0:len(Dir)]
|
|
||||||
else:
|
|
||||||
return NewFile[len(Dir) + 1:], NewFile[0:len(Dir)]
|
|
||||||
else:
|
|
||||||
return NewFile, ''
|
|
||||||
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
## Get GUID value from given packages
|
## Get GUID value from given packages
|
||||||
#
|
#
|
||||||
# @param CName The CName of the GUID
|
# @param CName The CName of the GUID
|
||||||
|
@ -1189,7 +1163,8 @@ def AnalyzePcdExpression(Setting):
|
||||||
FieldList[i] = ch.replace(RanStr,'\\\\')
|
FieldList[i] = ch.replace(RanStr,'\\\\')
|
||||||
return FieldList
|
return FieldList
|
||||||
|
|
||||||
def ParseDevPathValue (Value):
|
def ParseFieldValue (Value):
|
||||||
|
def ParseDevPathValue (Value):
|
||||||
if '\\' in Value:
|
if '\\' in Value:
|
||||||
Value.replace('\\', '/').replace(' ', '')
|
Value.replace('\\', '/').replace(' ', '')
|
||||||
|
|
||||||
|
@ -1209,7 +1184,6 @@ def ParseDevPathValue (Value):
|
||||||
out = ','.join(out.split())
|
out = ','.join(out.split())
|
||||||
return '{' + out + '}', Size
|
return '{' + out + '}', Size
|
||||||
|
|
||||||
def ParseFieldValue (Value):
|
|
||||||
if "{CODE(" in Value:
|
if "{CODE(" in Value:
|
||||||
return Value, len(Value.split(","))
|
return Value, len(Value.split(","))
|
||||||
if isinstance(Value, type(0)):
|
if isinstance(Value, type(0)):
|
||||||
|
@ -1625,6 +1599,32 @@ class PathClass(object):
|
||||||
return os.stat(self.Path)[8]
|
return os.stat(self.Path)[8]
|
||||||
|
|
||||||
def Validate(self, Type='', CaseSensitive=True):
|
def Validate(self, Type='', CaseSensitive=True):
|
||||||
|
def RealPath2(File, Dir='', OverrideDir=''):
|
||||||
|
NewFile = None
|
||||||
|
if OverrideDir:
|
||||||
|
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
|
||||||
|
if NewFile:
|
||||||
|
if OverrideDir[-1] == os.path.sep:
|
||||||
|
return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
|
||||||
|
else:
|
||||||
|
return NewFile[len(OverrideDir) + 1:], NewFile[0:len(OverrideDir)]
|
||||||
|
if GlobalData.gAllFiles:
|
||||||
|
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
|
||||||
|
if not NewFile:
|
||||||
|
NewFile = os.path.normpath(os.path.join(Dir, File))
|
||||||
|
if not os.path.exists(NewFile):
|
||||||
|
return None, None
|
||||||
|
if NewFile:
|
||||||
|
if Dir:
|
||||||
|
if Dir[-1] == os.path.sep:
|
||||||
|
return NewFile[len(Dir):], NewFile[0:len(Dir)]
|
||||||
|
else:
|
||||||
|
return NewFile[len(Dir) + 1:], NewFile[0:len(Dir)]
|
||||||
|
else:
|
||||||
|
return NewFile, ''
|
||||||
|
|
||||||
|
return None, None
|
||||||
|
|
||||||
if GlobalData.gCaseInsensitive:
|
if GlobalData.gCaseInsensitive:
|
||||||
CaseSensitive = False
|
CaseSensitive = False
|
||||||
if Type and Type.lower() != self.Type:
|
if Type and Type.lower() != self.Type:
|
||||||
|
|
Loading…
Reference in New Issue