summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/UPT/Library/UniClassObject.py
diff options
context:
space:
mode:
authorLiming Gao <liming.gao@intel.com>2018-10-15 08:27:53 +0800
committerLiming Gao <liming.gao@intel.com>2018-10-15 08:29:14 +0800
commit1ccc4d895dd8d659d016efcd6ef8a48749aba1d0 (patch)
tree0d5f58643cc72275887d3bb322813609906a9334 /BaseTools/Source/Python/UPT/Library/UniClassObject.py
parent678f85131238622e576705117e299d81cff755c9 (diff)
downloadedk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.tar.gz
edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.tar.bz2
edk2-1ccc4d895dd8d659d016efcd6ef8a48749aba1d0.zip
Revert BaseTools: PYTHON3 migration
This reverts commit 6693f359b3c213513c5096a06c6f67244a44dc52.. 678f85131238622e576705117e299d81cff755c9. Python3 migration is the fundamental change. It requires every developer to install Python3. Before this migration, the well communication and wide verification must be done. But now, most people is not aware of this change, and not try it. So, Python3 migration is reverted and be moved to edk2-staging Python3 branch for the edk2 user evaluation. Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Liming Gao <liming.gao@intel.com>
Diffstat (limited to 'BaseTools/Source/Python/UPT/Library/UniClassObject.py')
-rw-r--r--BaseTools/Source/Python/UPT/Library/UniClassObject.py21
1 files changed, 11 insertions, 10 deletions
diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
index 549f278b05..670cf3b4ee 100644
--- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py
+++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -14,6 +14,7 @@
"""
Collect all defined strings in multiple uni files
"""
+from __future__ import print_function
##
# Import Modules
@@ -246,9 +247,9 @@ def FormatUniEntry(StrTokenName, TokenValueList, ContainerFile):
for SubValue in ValueList:
if SubValue.strip():
SubValueContent += \
- ' ' * (PreFormatLength + len('#language en-US ')) + '\"%s\\n\"' % SubValue.strip() + '\n'
+ ' ' * (PreFormatLength + len('#language en-US ')) + '\"%s\\n\"' % SubValue.strip() + '\r\n'
SubValueContent = SubValueContent[(PreFormatLength + len('#language en-US ')):SubValueContent.rfind('\\n')] \
- + '\"' + '\n'
+ + '\"' + '\r\n'
SubContent += ' '*PreFormatLength + '#language %-5s ' % Lang + SubValueContent
if SubContent:
SubContent = StrTokenName + ' '*(PreFormatLength - len(StrTokenName)) + SubContent[PreFormatLength:]
@@ -290,7 +291,7 @@ class StringDefClassObject(object):
def UpdateValue(self, Value = None):
if Value is not None:
if self.StringValue:
- self.StringValue = self.StringValue + '\n' + Value
+ self.StringValue = self.StringValue + '\r\n' + Value
else:
self.StringValue = Value
self.StringValueByteList = UniToHexList(self.StringValue)
@@ -464,7 +465,7 @@ class UniFileClassObject(object):
if not Line.startswith(DT.TAB_COMMENT_EDK1_SPLIT) and HeaderStart and not HeaderEnd:
HeaderEnd = True
if Line.startswith(DT.TAB_COMMENT_EDK1_SPLIT) and HeaderStart and not HeaderEnd and FirstGenHeader:
- self.UniFileHeader += Line + '\n'
+ self.UniFileHeader += Line + '\r\n'
continue
#
@@ -510,11 +511,11 @@ class UniFileClassObject(object):
if FileIn[LineCount].strip().startswith('#language'):
Line = Line + FileIn[LineCount]
FileIn[LineCount-1] = Line
- FileIn[LineCount] = '\n'
+ FileIn[LineCount] = '\r\n'
LineCount -= 1
- for Index in range (LineCount + 1, len (FileIn) - 1):
+ for Index in xrange (LineCount + 1, len (FileIn) - 1):
if (Index == len(FileIn) -1):
- FileIn[Index] = '\n'
+ FileIn[Index] = '\r\n'
else:
FileIn[Index] = FileIn[Index + 1]
continue
@@ -866,12 +867,12 @@ class UniFileClassObject(object):
Value = Value + Lines[IndexJ].strip()[1:-1]
CombineToken = False
else:
- Value = Value + Lines[IndexJ].strip()[1:-1] + '\n'
+ Value = Value + Lines[IndexJ].strip()[1:-1] + '\r\n'
else:
IndexI = IndexJ
break
- if Value.endswith('\n'):
- Value = Value[: Value.rfind('\n')]
+ if Value.endswith('\r\n'):
+ Value = Value[: Value.rfind('\r\n')]
Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
self.AddStringToList(Name, Language, Value)
continue