diff options
author | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-09-04 10:39:47 +0800 |
---|---|---|
committer | Yonghong Zhu <yonghong.zhu@intel.com> | 2018-10-13 09:57:16 +0800 |
commit | 1b2e077260030290c512f3ac71a044ed1150899f (patch) | |
tree | 4834e04cda1ed358ce20dd24906af28665907e8c /BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | |
parent | 9d7e1e56a727743a811abfed92e1ede39ecbfa8c (diff) | |
download | edk2-1b2e077260030290c512f3ac71a044ed1150899f.tar.gz edk2-1b2e077260030290c512f3ac71a044ed1150899f.tar.bz2 edk2-1b2e077260030290c512f3ac71a044ed1150899f.zip |
BaseTools/UPT: Porting UPT Tool from Python2 to Python3
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py')
-rw-r--r-- | BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py index c2a240a884..82df4c62cf 100644 --- a/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py +++ b/BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py @@ -234,22 +234,22 @@ def GenModuleUNIEncodeFile(ModuleObject, UniFileHeader='', Encoding=DT.TAB_ENCOD if not os.path.exists(os.path.dirname(ModuleObject.GetFullPath())):
os.makedirs(os.path.dirname(ModuleObject.GetFullPath()))
- Content = UniFileHeader + '\r\n'
- Content += '\r\n'
+ Content = UniFileHeader + '\n'
+ Content += '\n'
- Content += FormatUniEntry('#string ' + DT.TAB_INF_ABSTRACT, ModuleObject.GetAbstract(), ContainerFile) + '\r\n'
+ Content += FormatUniEntry('#string ' + DT.TAB_INF_ABSTRACT, ModuleObject.GetAbstract(), ContainerFile) + '\n'
Content += FormatUniEntry('#string ' + DT.TAB_INF_DESCRIPTION, ModuleObject.GetDescription(), ContainerFile) \
- + '\r\n'
+ + '\n'
BinaryAbstractString = FormatUniEntry('#string ' + DT.TAB_INF_BINARY_ABSTRACT, BinaryAbstract, ContainerFile)
if BinaryAbstractString:
- Content += BinaryAbstractString + '\r\n'
+ Content += BinaryAbstractString + '\n'
BinaryDescriptionString = FormatUniEntry('#string ' + DT.TAB_INF_BINARY_DESCRIPTION, BinaryDescription, \
ContainerFile)
if BinaryDescriptionString:
- Content += BinaryDescriptionString + '\r\n'
+ Content += BinaryDescriptionString + '\n'
if not os.path.exists(ContainerFile):
File = codecs.open(ContainerFile, 'wb', Encoding)
@@ -274,7 +274,7 @@ def GenDefines(ModuleObject): if not DefinesDict:
continue
for Statement in DefinesDict:
- if Statement.split(DT.TAB_EQUAL_SPLIT) > 1:
+ if len(Statement.split(DT.TAB_EQUAL_SPLIT)) > 1:
Statement = (u'%s ' % Statement.split(DT.TAB_EQUAL_SPLIT, 1)[0]).ljust(LeftOffset) \
+ u'= %s' % Statement.split(DT.TAB_EQUAL_SPLIT, 1)[1].lstrip()
SortedArch = DT.TAB_ARCH_COMMON
@@ -409,7 +409,7 @@ def GenLibraryClasses(ModuleObject): Statement += '|' + FFE
ModuleList = LibraryClass.GetSupModuleList()
ArchList = LibraryClass.GetSupArchList()
- for Index in xrange(0, len(ArchList)):
+ for Index in range(0, len(ArchList)):
ArchList[Index] = ConvertArchForInstall(ArchList[Index])
ArchList.sort()
SortedArch = ' '.join(ArchList)
@@ -572,7 +572,7 @@ def GenUserExtensions(ModuleObject): # if not Statement:
# continue
ArchList = UserExtension.GetSupArchList()
- for Index in xrange(0, len(ArchList)):
+ for Index in range(0, len(ArchList)):
ArchList[Index] = ConvertArchForInstall(ArchList[Index])
ArchList.sort()
KeyList = []
|