X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2FAutoGen%2FStrGather.py;h=60840041ba22ce2fc290808efc0ace05e615b6b0;hp=b84d9f90aaec59e003d65fa3adb3252622c85714;hb=47fea6afd74af76c7e2a2b03d319b7ac035ac26a;hpb=2bcc713e74b944bb5aefb433ef33fb4002a62d76
diff --git a/BaseTools/Source/Python/AutoGen/StrGather.py b/BaseTools/Source/Python/AutoGen/StrGather.py
index b84d9f90aa..60840041ba 100644
--- a/BaseTools/Source/Python/AutoGen/StrGather.py
+++ b/BaseTools/Source/Python/AutoGen/StrGather.py
@@ -1,4 +1,8 @@
-# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.
+## @file
+# This file is used to parse a strings file and create or add to a string database
+# file.
+#
+# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
# This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
@@ -7,10 +11,6 @@
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-#This file is used to parse a strings file and create or add to a string database file.
-#
-
##
# Import Modules
#
@@ -20,6 +20,7 @@ from Common.BuildToolError import *
from UniClassObject import *
from StringIO import StringIO
from struct import pack
+from Common.LongFilePathSupport import OpenLongFilePath as open
##
# Static definitions
@@ -112,7 +113,7 @@ def DecToHexStr(Dec, Digit = 8):
# @retval: A list for formatted hex string
#
def DecToHexList(Dec, Digit = 8):
- Hex = eval("'%0" + str(Digit) + "X' % int(Dec)" )
+ Hex = eval("'%0" + str(Digit) + "X' % int(Dec)")
List = []
for Bit in range(Digit - 2, -1, -2):
List.append(HexHeader + Hex[Bit:Bit + 2])
@@ -191,7 +192,7 @@ def CreateHFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniGenCFlag):
Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
UnusedStr = WriteLine(UnusedStr, Line)
- Str = ''.join([Str,UnusedStr])
+ Str = ''.join([Str, UnusedStr])
Str = WriteLine(Str, '')
if IsCompatibleMode or UniGenCFlag:
@@ -234,7 +235,7 @@ def CreateCFileHeader():
#
def CreateBinBuffer(BinBuffer, Array):
for Item in Array:
- BinBuffer.write(pack("B", int(Item,16)))
+ BinBuffer.write(pack("B", int(Item, 16)))
## Create a formatted string all items in an array
#
@@ -257,7 +258,7 @@ def CreateArrayItem(Array, Width = 16):
Index = Index + 1
else:
ArrayItem = WriteLine(ArrayItem, Line)
- Line = ' ' + Item + ', '
+ Line = ' ' + Item + ', '
Index = 1
ArrayItem = Write(ArrayItem, Line.rstrip())
@@ -319,7 +320,7 @@ def GetFilteredLanguage(UniLanguageList, LanguageFilterList):
if PrimaryTag == UniLanguagePrimaryTag:
if UniLanguage not in UniLanguageListFiltered:
- UniLanguageListFiltered += [UniLanguage]
+ UniLanguageListFiltered += [UniLanguage]
break
else:
# Here is rule 3 for "get best language"
@@ -367,7 +368,7 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer,
UniLanguageList = []
for IndexI in range(len(UniObjectClass.LanguageDef)):
- UniLanguageList += [UniObjectClass.LanguageDef[IndexI][0]]
+ UniLanguageList += [UniObjectClass.LanguageDef[IndexI][0]]
UniLanguageListFiltered = GetFilteredLanguage(UniLanguageList, LanguageFilterList)
@@ -449,14 +450,14 @@ def CreateCFileContent(BaseName, UniObjectClass, IsCompatibleMode, UniBinBuffer,
if UniBinBuffer:
CreateBinBuffer (UniBinBuffer, List)
UniBinBuffer.write (StringBuffer.getvalue())
- UniBinBuffer.write (pack("B", int(EFI_HII_SIBT_END,16)))
+ UniBinBuffer.write (pack("B", int(EFI_HII_SIBT_END, 16)))
StringBuffer.close()
#
# Create line for string variable name
# "unsigned char $(BaseName)Strings[] = {"
#
- AllStr = WriteLine('', CHAR_ARRAY_DEFIN + ' ' + BaseName + COMMON_FILE_NAME + '[] = {\n' )
+ AllStr = WriteLine('', CHAR_ARRAY_DEFIN + ' ' + BaseName + COMMON_FILE_NAME + '[] = {\n')
if IsCompatibleMode:
#
@@ -617,13 +618,13 @@ def GetStringFiles(UniFilList, SourceFileList, IncludeList, IncludePathList, Ski
# Write an item
#
def Write(Target, Item):
- return ''.join([Target,Item])
+ return ''.join([Target, Item])
#
# Write an item with a break line
#
def WriteLine(Target, Item):
- return ''.join([Target,Item,'\n'])
+ return ''.join([Target, Item, '\n'])
# This acts like the main() function for the script, unless it is 'import'ed into another
# script.