diff options
author | Hess Chen <hesheng.chen@intel.com> | 2014-09-03 08:25:10 +0000 |
---|---|---|
committer | hchen30 <hchen30@6f19259b-4bc3-4df7-8a09-765794883524> | 2014-09-03 08:25:10 +0000 |
commit | cf2b2bdef3d6b5c64b5aa528bb255db81c13d965 (patch) | |
tree | bc297730ea79b6e991ad216a8f077d37254b5108 /BaseTools/Source/Python/UPT/Library/UniClassObject.py | |
parent | b5fd61fe8c85a8aec09becd851a782631a8a4aeb (diff) | |
download | edk2-cf2b2bdef3d6b5c64b5aa528bb255db81c13d965.tar.gz edk2-cf2b2bdef3d6b5c64b5aa528bb255db81c13d965.tar.bz2 edk2-cf2b2bdef3d6b5c64b5aa528bb255db81c13d965.zip |
BaseTools/UPT: Replace os.linesep with '\r\n' when generating UNI files.
Replace os.linesep with '\r\n' when generating UNI files to make sure all files are under DOS format.
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Gao, Liming <liming.gao@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@16041 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/UPT/Library/UniClassObject.py')
-rw-r--r-- | BaseTools/Source/Python/UPT/Library/UniClassObject.py | 20 |
1 files changed, 10 insertions, 10 deletions
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
|