diff options
Diffstat (limited to 'BaseTools/Source/Python/UPT/Library')
-rw-r--r-- | BaseTools/Source/Python/UPT/Library/CommentGenerating.py | 44 | ||||
-rw-r--r-- | BaseTools/Source/Python/UPT/Library/UniClassObject.py | 20 |
2 files changed, 32 insertions, 32 deletions
diff --git a/BaseTools/Source/Python/UPT/Library/CommentGenerating.py b/BaseTools/Source/Python/UPT/Library/CommentGenerating.py index 1cf919a96b..9c6e3aad9f 100644 --- a/BaseTools/Source/Python/UPT/Library/CommentGenerating.py +++ b/BaseTools/Source/Python/UPT/Library/CommentGenerating.py @@ -129,45 +129,45 @@ def GenHeaderCommentSection(Abstract, Description, Copyright, License, IsBinaryH if isinstance(Description, unicode):
Description = ConvertSpecialUnicodes(Description)
if IsBinaryHeader:
- Content += CommChar * 2 + TAB_SPACE_SPLIT + TAB_BINARY_HEADER_COMMENT + END_OF_LINE
+ Content += CommChar * 2 + TAB_SPACE_SPLIT + TAB_BINARY_HEADER_COMMENT + '\r\n'
elif CommChar == TAB_COMMENT_EDK1_SPLIT:
Content += CommChar + TAB_SPACE_SPLIT + TAB_COMMENT_EDK1_START + TAB_STAR + TAB_SPACE_SPLIT +\
- TAB_HEADER_COMMENT + END_OF_LINE
+ TAB_HEADER_COMMENT + '\r\n'
else:
- Content += CommChar * 2 + TAB_SPACE_SPLIT + TAB_HEADER_COMMENT + END_OF_LINE
+ Content += CommChar * 2 + TAB_SPACE_SPLIT + TAB_HEADER_COMMENT + '\r\n'
if Abstract:
- Abstract = Abstract.rstrip(END_OF_LINE)
- Content += CommChar + TAB_SPACE_SPLIT + (END_OF_LINE + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
- (Abstract, END_OF_LINE))
- Content += END_OF_LINE + CommChar + END_OF_LINE
+ Abstract = Abstract.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
+ (Abstract, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
else:
- Content += CommChar + END_OF_LINE
+ Content += CommChar + '\r\n'
if Description:
- Description = Description.rstrip(END_OF_LINE)
- Content += CommChar + TAB_SPACE_SPLIT + (END_OF_LINE + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
- (Description, END_OF_LINE))
- Content += END_OF_LINE + CommChar + END_OF_LINE
+ Description = Description.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
+ (Description, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
#
# There is no '#\n' line to separate multiple copyright lines in code base
#
if Copyright:
- Copyright = Copyright.rstrip(END_OF_LINE)
- Content += CommChar + TAB_SPACE_SPLIT + (END_OF_LINE + CommChar + TAB_SPACE_SPLIT).join\
- (GetSplitValueList(Copyright, END_OF_LINE))
- Content += END_OF_LINE + CommChar + END_OF_LINE
+ Copyright = Copyright.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join\
+ (GetSplitValueList(Copyright, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
if License:
- License = License.rstrip(END_OF_LINE)
- Content += CommChar + TAB_SPACE_SPLIT + (END_OF_LINE + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
- (License, END_OF_LINE))
- Content += END_OF_LINE + CommChar + END_OF_LINE
+ License = License.rstrip('\r\n')
+ Content += CommChar + TAB_SPACE_SPLIT + ('\r\n' + CommChar + TAB_SPACE_SPLIT).join(GetSplitValueList\
+ (License, '\n'))
+ Content += '\r\n' + CommChar + '\r\n'
if CommChar == TAB_COMMENT_EDK1_SPLIT:
- Content += CommChar + TAB_SPACE_SPLIT + TAB_STAR + TAB_COMMENT_EDK1_END + END_OF_LINE
+ Content += CommChar + TAB_SPACE_SPLIT + TAB_STAR + TAB_COMMENT_EDK1_END + '\r\n'
else:
- Content += CommChar * 2 + END_OF_LINE
+ Content += CommChar * 2 + '\r\n'
return Content
diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py b/BaseTools/Source/Python/UPT/Library/UniClassObject.py index d542dc5dc8..563b82c688 100644 --- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py +++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py @@ -245,9 +245,9 @@ def FormatUniEntry(StrTokenName, TokenValueList, ContainerFile): for SubValue in ValueList:
if SubValue.strip():
SubValueContent += \
- ' ' * (PreFormatLength + len('#language en-US ')) + '\"%s\\n\"' % SubValue.strip() + os.linesep
- SubValueContent = SubValueContent[(PreFormatLength + len('#language en-US ')):SubValueContent.rfind('\\n')] \
- + '\"' + os.linesep
+ ' ' * (PreFormatLength + len('#language en-US ')) + '\"%s\\n\"' % SubValue.strip() + '\r\n'
+ SubValueContent = SubValueContent[(PreFormatLength + len('#language en-US ')):SubValueContent.rfind('\\n')] \
+ + '\"' + '\r\n'
SubContent += ' '*PreFormatLength + '#language %-5s ' % Lang + SubValueContent
if SubContent:
SubContent = StrTokenName + ' '*(PreFormatLength - len(StrTokenName)) + SubContent[PreFormatLength:]
@@ -289,7 +289,7 @@ class StringDefClassObject(object): def UpdateValue(self, Value = None):
if Value != None:
if self.StringValue:
- self.StringValue = self.StringValue + os.linesep + Value
+ self.StringValue = self.StringValue + '\r\n' + Value
else:
self.StringValue = Value
self.StringValueByteList = UniToHexList(self.StringValue)
@@ -452,7 +452,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 + os.linesep
+ self.UniFileHeader += Line + '\r\n'
continue
#
@@ -498,11 +498,11 @@ class UniFileClassObject(object): if FileIn[LineCount].strip().startswith('#language'):
Line = Line + FileIn[LineCount]
FileIn[LineCount-1] = Line
- FileIn[LineCount] = os.linesep
+ FileIn[LineCount] = '\r\n'
LineCount -= 1
for Index in xrange (LineCount + 1, len (FileIn) - 1):
if (Index == len(FileIn) -1):
- FileIn[Index] = os.linesep
+ FileIn[Index] = '\r\n'
else:
FileIn[Index] = FileIn[Index + 1]
continue
@@ -858,12 +858,12 @@ class UniFileClassObject(object): Value = Value + Lines[IndexJ].strip()[1:-1]
CombineToken = False
else:
- Value = Value + Lines[IndexJ].strip()[1:-1] + os.linesep
+ Value = Value + Lines[IndexJ].strip()[1:-1] + '\r\n'
else:
IndexI = IndexJ
break
- if Value.endswith(os.linesep):
- Value = Value[: Value.rfind(os.linesep)]
+ if Value.endswith('\r\n'):
+ Value = Value[: Value.rfind('\r\n')]
Language = GetLanguageCode(Language, self.IsCompatibleMode, self.File)
self.AddStringToList(Name, Language, Value)
continue
|