mirror of https://github.com/acidanthera/audk.git
BaseTools: Refactor python print statements
Refactor print statements to be compatible with python 3. Based on "futurize -f libfuturize.fixes.fix_print_with_import" Contributed-under: TianoCore Contribution Agreement 1.1 Cc: Yonghong Zhu <yonghong.zhu@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Gary Lin <glin@suse.com> Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
This commit is contained in:
parent
5b0671c1e5
commit
72443dd250
|
@ -23,6 +23,7 @@
|
||||||
#
|
#
|
||||||
# ExceptionList if a tool takes an argument with a / add it to the exception list
|
# ExceptionList if a tool takes an argument with a / add it to the exception list
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -86,7 +87,7 @@ if __name__ == "__main__":
|
||||||
ret = main(sys.argv[2:])
|
ret = main(sys.argv[2:])
|
||||||
|
|
||||||
except:
|
except:
|
||||||
print "exiting: exception from " + sys.argv[0]
|
print("exiting: exception from " + sys.argv[0])
|
||||||
ret = 2
|
ret = 2
|
||||||
|
|
||||||
sys.exit(ret)
|
sys.exit(ret)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
'''
|
'''
|
||||||
BinToPcd
|
BinToPcd
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import argparse
|
import argparse
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#
|
#
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import os.path
|
import os.path
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -58,10 +59,10 @@ class Symbols:
|
||||||
try:
|
try:
|
||||||
nmCommand = "nm"
|
nmCommand = "nm"
|
||||||
nmLineOption = "-l"
|
nmLineOption = "-l"
|
||||||
print "parsing (debug) - " + pdbName
|
print("parsing (debug) - " + pdbName)
|
||||||
os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
|
os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
|
||||||
except :
|
except :
|
||||||
print 'ERROR: nm command not available. Please verify PATH'
|
print('ERROR: nm command not available. Please verify PATH')
|
||||||
return
|
return
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -111,11 +112,11 @@ class Symbols:
|
||||||
DIA2DumpCommand = "Dia2Dump.exe"
|
DIA2DumpCommand = "Dia2Dump.exe"
|
||||||
#DIA2SymbolOption = "-p"
|
#DIA2SymbolOption = "-p"
|
||||||
DIA2LinesOption = "-l"
|
DIA2LinesOption = "-l"
|
||||||
print "parsing (pdb) - " + pdbName
|
print("parsing (pdb) - " + pdbName)
|
||||||
#os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
|
#os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
|
||||||
os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
|
os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
|
||||||
except :
|
except :
|
||||||
print 'ERROR: DIA2Dump command not available. Please verify PATH'
|
print('ERROR: DIA2Dump command not available. Please verify PATH')
|
||||||
return
|
return
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -254,12 +255,12 @@ def main():
|
||||||
try :
|
try :
|
||||||
file = open(Options.inputfilename)
|
file = open(Options.inputfilename)
|
||||||
except Exception:
|
except Exception:
|
||||||
print "fail to open " + Options.inputfilename
|
print("fail to open " + Options.inputfilename)
|
||||||
return 1
|
return 1
|
||||||
try :
|
try :
|
||||||
newfile = open(Options.outputfilename, "w")
|
newfile = open(Options.outputfilename, "w")
|
||||||
except Exception:
|
except Exception:
|
||||||
print "fail to open " + Options.outputfilename
|
print("fail to open " + Options.outputfilename)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os, sys, logging, traceback, subprocess
|
import os, sys, logging, traceback, subprocess
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
|
|
||||||
|
@ -62,7 +63,7 @@ def parseCmdArgs():
|
||||||
default = "C:\\Program Files\\doxygen\\bin\\doxygen.exe"
|
default = "C:\\Program Files\\doxygen\\bin\\doxygen.exe"
|
||||||
if options.DoxygenPath is None:
|
if options.DoxygenPath is None:
|
||||||
if os.path.exists(default):
|
if os.path.exists(default):
|
||||||
print "Warning: Assume doxygen tool is installed at %s. If not, please specify via -x" % default
|
print("Warning: Assume doxygen tool is installed at %s. If not, please specify via -x" % default)
|
||||||
options.DoxygenPath = default
|
options.DoxygenPath = default
|
||||||
else:
|
else:
|
||||||
errors.append('- Please specify the path of doxygen tool installation via option -x! or install it in default path %s' % default)
|
errors.append('- Please specify the path of doxygen tool installation via option -x! or install it in default path %s' % default)
|
||||||
|
@ -80,7 +81,7 @@ def parseCmdArgs():
|
||||||
if options.PackagePath is not None and os.path.exists(options.PackagePath):
|
if options.PackagePath is not None and os.path.exists(options.PackagePath):
|
||||||
dirpath = os.path.dirname(options.PackagePath)
|
dirpath = os.path.dirname(options.PackagePath)
|
||||||
default = os.path.join (dirpath, "Document")
|
default = os.path.join (dirpath, "Document")
|
||||||
print 'Warning: Assume document output at %s. If not, please specify via option -o' % default
|
print('Warning: Assume document output at %s. If not, please specify via option -o' % default)
|
||||||
options.OutputPath = default
|
options.OutputPath = default
|
||||||
if not os.path.exists(default):
|
if not os.path.exists(default):
|
||||||
try:
|
try:
|
||||||
|
@ -92,21 +93,21 @@ def parseCmdArgs():
|
||||||
|
|
||||||
if options.Arch is None:
|
if options.Arch is None:
|
||||||
options.Arch = 'ALL'
|
options.Arch = 'ALL'
|
||||||
print "Warning: Assume arch is \"ALL\". If not, specify via -a"
|
print("Warning: Assume arch is \"ALL\". If not, specify via -a")
|
||||||
|
|
||||||
if options.DocumentMode is None:
|
if options.DocumentMode is None:
|
||||||
options.DocumentMode = "HTML"
|
options.DocumentMode = "HTML"
|
||||||
print "Warning: Assume document mode is \"HTML\". If not, specify via -m"
|
print("Warning: Assume document mode is \"HTML\". If not, specify via -m")
|
||||||
|
|
||||||
if options.IncludeOnly is None:
|
if options.IncludeOnly is None:
|
||||||
options.IncludeOnly = False
|
options.IncludeOnly = False
|
||||||
print "Warning: Assume generate package document for all package\'s source including publich interfaces and implementation libraries and modules."
|
print("Warning: Assume generate package document for all package\'s source including publich interfaces and implementation libraries and modules.")
|
||||||
|
|
||||||
if options.DocumentMode.lower() == 'chm':
|
if options.DocumentMode.lower() == 'chm':
|
||||||
default = "C:\\Program Files\\HTML Help Workshop\\hhc.exe"
|
default = "C:\\Program Files\\HTML Help Workshop\\hhc.exe"
|
||||||
if options.HtmlWorkshopPath is None:
|
if options.HtmlWorkshopPath is None:
|
||||||
if os.path.exists(default):
|
if os.path.exists(default):
|
||||||
print 'Warning: Assume the installation path of Microsoft HTML Workshop is %s. If not, specify via option -c.' % default
|
print('Warning: Assume the installation path of Microsoft HTML Workshop is %s. If not, specify via option -c.' % default)
|
||||||
options.HtmlWorkshopPath = default
|
options.HtmlWorkshopPath = default
|
||||||
else:
|
else:
|
||||||
errors.append('- Please specify the installation path of Microsoft HTML Workshop via option -c!')
|
errors.append('- Please specify the installation path of Microsoft HTML Workshop via option -c!')
|
||||||
|
@ -114,7 +115,7 @@ def parseCmdArgs():
|
||||||
errors.append('- The installation path of Microsoft HTML Workshop %s does not exists. ' % options.HtmlWorkshopPath)
|
errors.append('- The installation path of Microsoft HTML Workshop %s does not exists. ' % options.HtmlWorkshopPath)
|
||||||
|
|
||||||
if len(errors) != 0:
|
if len(errors) != 0:
|
||||||
print '\n'
|
print('\n')
|
||||||
parser.error('Fail to start due to following reasons: \n%s' %'\n'.join(errors))
|
parser.error('Fail to start due to following reasons: \n%s' %'\n'.join(errors))
|
||||||
return (options.WorkspacePath, options.PackagePath, options.DoxygenPath, options.OutputPath,
|
return (options.WorkspacePath, options.PackagePath, options.DoxygenPath, options.OutputPath,
|
||||||
options.Arch, options.DocumentMode, options.IncludeOnly, options.HtmlWorkshopPath)
|
options.Arch, options.DocumentMode, options.IncludeOnly, options.HtmlWorkshopPath)
|
||||||
|
@ -130,21 +131,21 @@ def createPackageObject(wsPath, pkgPath):
|
||||||
return pkgObj
|
return pkgObj
|
||||||
|
|
||||||
def callbackLogMessage(msg, level):
|
def callbackLogMessage(msg, level):
|
||||||
print msg.strip()
|
print(msg.strip())
|
||||||
|
|
||||||
def callbackCreateDoxygenProcess(doxPath, configPath):
|
def callbackCreateDoxygenProcess(doxPath, configPath):
|
||||||
if sys.platform == 'win32':
|
if sys.platform == 'win32':
|
||||||
cmd = '"%s" %s' % (doxPath, configPath)
|
cmd = '"%s" %s' % (doxPath, configPath)
|
||||||
else:
|
else:
|
||||||
cmd = '%s %s' % (doxPath, configPath)
|
cmd = '%s %s' % (doxPath, configPath)
|
||||||
print cmd
|
print(cmd)
|
||||||
subprocess.call(cmd, shell=True)
|
subprocess.call(cmd, shell=True)
|
||||||
|
|
||||||
|
|
||||||
def DocumentFixup(outPath, arch):
|
def DocumentFixup(outPath, arch):
|
||||||
# find BASE_LIBRARY_JUMP_BUFFER structure reference page
|
# find BASE_LIBRARY_JUMP_BUFFER structure reference page
|
||||||
|
|
||||||
print '\n >>> Start fixup document \n'
|
print('\n >>> Start fixup document \n')
|
||||||
|
|
||||||
for root, dirs, files in os.walk(outPath):
|
for root, dirs, files in os.walk(outPath):
|
||||||
for dir in dirs:
|
for dir in dirs:
|
||||||
|
@ -172,10 +173,10 @@ def DocumentFixup(outPath, arch):
|
||||||
if text.find('MdePkg/Include/Library/UefiApplicationEntryPoint.h File Reference') != -1:
|
if text.find('MdePkg/Include/Library/UefiApplicationEntryPoint.h File Reference') != -1:
|
||||||
FixPageUefiApplicationEntryPoint(fullpath, text)
|
FixPageUefiApplicationEntryPoint(fullpath, text)
|
||||||
|
|
||||||
print ' >>> Finish all document fixing up! \n'
|
print(' >>> Finish all document fixing up! \n')
|
||||||
|
|
||||||
def FixPageBaseLib(path, text):
|
def FixPageBaseLib(path, text):
|
||||||
print ' >>> Fixup BaseLib file page at file %s \n' % path
|
print(' >>> Fixup BaseLib file page at file %s \n' % path)
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
lastBaseJumpIndex = -1
|
lastBaseJumpIndex = -1
|
||||||
lastIdtGateDescriptor = -1
|
lastIdtGateDescriptor = -1
|
||||||
|
@ -211,10 +212,10 @@ def FixPageBaseLib(path, text):
|
||||||
except:
|
except:
|
||||||
logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
|
logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
|
||||||
return
|
return
|
||||||
print " <<< Finish to fixup file %s\n" % path
|
print(" <<< Finish to fixup file %s\n" % path)
|
||||||
|
|
||||||
def FixPageIA32_IDT_GATE_DESCRIPTOR(path, text):
|
def FixPageIA32_IDT_GATE_DESCRIPTOR(path, text):
|
||||||
print ' >>> Fixup structure reference IA32_IDT_GATE_DESCRIPTOR at file %s \n' % path
|
print(' >>> Fixup structure reference IA32_IDT_GATE_DESCRIPTOR at file %s \n' % path)
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
for index in range(len(lines) - 1, -1, -1):
|
for index in range(len(lines) - 1, -1, -1):
|
||||||
line = lines[index].strip()
|
line = lines[index].strip()
|
||||||
|
@ -229,10 +230,10 @@ def FixPageIA32_IDT_GATE_DESCRIPTOR(path, text):
|
||||||
except:
|
except:
|
||||||
logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
|
logging.getLogger().error(" <<< Fail to fixup file %s\n" % path)
|
||||||
return
|
return
|
||||||
print " <<< Finish to fixup file %s\n" % path
|
print(" <<< Finish to fixup file %s\n" % path)
|
||||||
|
|
||||||
def FixPageBASE_LIBRARY_JUMP_BUFFER(path, text):
|
def FixPageBASE_LIBRARY_JUMP_BUFFER(path, text):
|
||||||
print ' >>> Fixup structure reference BASE_LIBRARY_JUMP_BUFFER at file %s \n' % path
|
print(' >>> Fixup structure reference BASE_LIBRARY_JUMP_BUFFER at file %s \n' % path)
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
bInDetail = True
|
bInDetail = True
|
||||||
bNeedRemove = False
|
bNeedRemove = False
|
||||||
|
@ -266,10 +267,10 @@ def FixPageBASE_LIBRARY_JUMP_BUFFER(path, text):
|
||||||
except:
|
except:
|
||||||
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
||||||
return
|
return
|
||||||
print " <<< Finish to fixup file %s\n" % path
|
print(" <<< Finish to fixup file %s\n" % path)
|
||||||
|
|
||||||
def FixPageUefiDriverEntryPoint(path, text):
|
def FixPageUefiDriverEntryPoint(path, text):
|
||||||
print ' >>> Fixup file reference MdePkg/Include/Library/UefiDriverEntryPoint.h at file %s \n' % path
|
print(' >>> Fixup file reference MdePkg/Include/Library/UefiDriverEntryPoint.h at file %s \n' % path)
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
bInModuleEntry = False
|
bInModuleEntry = False
|
||||||
bInEfiMain = False
|
bInEfiMain = False
|
||||||
|
@ -318,11 +319,11 @@ def FixPageUefiDriverEntryPoint(path, text):
|
||||||
except:
|
except:
|
||||||
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
||||||
return
|
return
|
||||||
print " <<< Finish to fixup file %s\n" % path
|
print(" <<< Finish to fixup file %s\n" % path)
|
||||||
|
|
||||||
|
|
||||||
def FixPageUefiApplicationEntryPoint(path, text):
|
def FixPageUefiApplicationEntryPoint(path, text):
|
||||||
print ' >>> Fixup file reference MdePkg/Include/Library/UefiApplicationEntryPoint.h at file %s \n' % path
|
print(' >>> Fixup file reference MdePkg/Include/Library/UefiApplicationEntryPoint.h at file %s \n' % path)
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
bInModuleEntry = False
|
bInModuleEntry = False
|
||||||
bInEfiMain = False
|
bInEfiMain = False
|
||||||
|
@ -371,7 +372,7 @@ def FixPageUefiApplicationEntryPoint(path, text):
|
||||||
except:
|
except:
|
||||||
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
logging.getLogger().error(" <<< Fail to fixup file %s" % path)
|
||||||
return
|
return
|
||||||
print " <<< Finish to fixup file %s\n" % path
|
print(" <<< Finish to fixup file %s\n" % path)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
wspath, pkgpath, doxpath, outpath, archtag, docmode, isinc, hwpath = parseCmdArgs()
|
wspath, pkgpath, doxpath, outpath, archtag, docmode, isinc, hwpath = parseCmdArgs()
|
||||||
|
@ -424,6 +425,6 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
cmd = '%s %s' % (hwpath, indexpath)
|
cmd = '%s %s' % (hwpath, indexpath)
|
||||||
subprocess.call(cmd)
|
subprocess.call(cmd)
|
||||||
print '\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.chm')
|
print('\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.chm'))
|
||||||
else:
|
else:
|
||||||
print '\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.html')
|
print('\nFinish to generate package document! Please open %s for review' % os.path.join(outpath, 'html', 'index.html'))
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
|
|
||||||
from message import *
|
from message import *
|
||||||
|
@ -446,4 +447,4 @@ if __name__== '__main__':
|
||||||
p.AddPage(Page('PCD', 'pcds'))
|
p.AddPage(Page('PCD', 'pcds'))
|
||||||
|
|
||||||
df.Generate()
|
df.Generate()
|
||||||
print df
|
print(df)
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import array
|
import array
|
||||||
import uuid
|
import uuid
|
||||||
import re
|
import re
|
||||||
|
@ -250,12 +251,12 @@ class EfiFirmwareVolumeHeader(BinaryItem):
|
||||||
return list2int(self._arr.tolist()[48:50])
|
return list2int(self._arr.tolist()[48:50])
|
||||||
|
|
||||||
def Dump(self):
|
def Dump(self):
|
||||||
print 'Signature: %s' % self.GetSigunature()
|
print('Signature: %s' % self.GetSigunature())
|
||||||
print 'Attribute: 0x%X' % self.GetAttribute()
|
print('Attribute: 0x%X' % self.GetAttribute())
|
||||||
print 'Header Length: 0x%X' % self.GetHeaderLength()
|
print('Header Length: 0x%X' % self.GetHeaderLength())
|
||||||
print 'File system Guid: ', self.GetFileSystemGuid()
|
print('File system Guid: ', self.GetFileSystemGuid())
|
||||||
print 'Revision: 0x%X' % self.GetRevision()
|
print('Revision: 0x%X' % self.GetRevision())
|
||||||
print 'FvLength: 0x%X' % self.GetFvLength()
|
print('FvLength: 0x%X' % self.GetFvLength())
|
||||||
|
|
||||||
def GetFileSystemGuid(self):
|
def GetFileSystemGuid(self):
|
||||||
list = self._arr.tolist()
|
list = self._arr.tolist()
|
||||||
|
@ -348,7 +349,7 @@ class EfiFfs(object):
|
||||||
line.append('0x%X' % int(item))
|
line.append('0x%X' % int(item))
|
||||||
count += 1
|
count += 1
|
||||||
else:
|
else:
|
||||||
print ' '.join(line)
|
print(' '.join(line))
|
||||||
count = 0
|
count = 0
|
||||||
line = []
|
line = []
|
||||||
line.append('0x%X' % int(item))
|
line.append('0x%X' % int(item))
|
||||||
|
@ -445,11 +446,11 @@ class EfiFfsHeader(BinaryItem):
|
||||||
return 'Unknown Ffs State'
|
return 'Unknown Ffs State'
|
||||||
|
|
||||||
def Dump(self):
|
def Dump(self):
|
||||||
print "FFS name: ", self.GetNameGuid()
|
print("FFS name: ", self.GetNameGuid())
|
||||||
print "FFS type: ", self.GetType()
|
print("FFS type: ", self.GetType())
|
||||||
print "FFS attr: 0x%X" % self.GetAttributes()
|
print("FFS attr: 0x%X" % self.GetAttributes())
|
||||||
print "FFS size: 0x%X" % self.GetFfsSize()
|
print("FFS size: 0x%X" % self.GetFfsSize())
|
||||||
print "FFS state: 0x%X" % self.GetState()
|
print("FFS state: 0x%X" % self.GetState())
|
||||||
|
|
||||||
def GetRawData(self):
|
def GetRawData(self):
|
||||||
return self._arr.tolist()
|
return self._arr.tolist()
|
||||||
|
@ -528,8 +529,8 @@ class EfiSectionHeader(BinaryItem):
|
||||||
return self.section_type_map[type]
|
return self.section_type_map[type]
|
||||||
|
|
||||||
def Dump(self):
|
def Dump(self):
|
||||||
print 'size = 0x%X' % self.GetSectionSize()
|
print('size = 0x%X' % self.GetSectionSize())
|
||||||
print 'type = 0x%X' % self.GetType()
|
print('type = 0x%X' % self.GetType())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#
|
#
|
||||||
##
|
##
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
@ -61,10 +62,10 @@ class Symbols:
|
||||||
try:
|
try:
|
||||||
nmCommand = "nm"
|
nmCommand = "nm"
|
||||||
nmLineOption = "-l"
|
nmLineOption = "-l"
|
||||||
print "parsing (debug) - " + pdbName
|
print("parsing (debug) - " + pdbName)
|
||||||
os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
|
os.system ('%s %s %s > nmDump.line.log' % (nmCommand, nmLineOption, pdbName))
|
||||||
except :
|
except :
|
||||||
print 'ERROR: nm command not available. Please verify PATH'
|
print('ERROR: nm command not available. Please verify PATH')
|
||||||
return
|
return
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -103,11 +104,11 @@ class Symbols:
|
||||||
DIA2DumpCommand = "Dia2Dump.exe"
|
DIA2DumpCommand = "Dia2Dump.exe"
|
||||||
#DIA2SymbolOption = "-p"
|
#DIA2SymbolOption = "-p"
|
||||||
DIA2LinesOption = "-l"
|
DIA2LinesOption = "-l"
|
||||||
print "parsing (pdb) - " + pdbName
|
print("parsing (pdb) - " + pdbName)
|
||||||
#os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
|
#os.system ('%s %s %s > DIA2Dump.symbol.log' % (DIA2DumpCommand, DIA2SymbolOption, pdbName))
|
||||||
os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
|
os.system ('%s %s %s > DIA2Dump.line.log' % (DIA2DumpCommand, DIA2LinesOption, pdbName))
|
||||||
except :
|
except :
|
||||||
print 'ERROR: DIA2Dump command not available. Please verify PATH'
|
print('ERROR: DIA2Dump command not available. Please verify PATH')
|
||||||
return
|
return
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -235,14 +236,14 @@ def main():
|
||||||
try :
|
try :
|
||||||
DOMTree = xml.dom.minidom.parse(Options.inputfilename)
|
DOMTree = xml.dom.minidom.parse(Options.inputfilename)
|
||||||
except Exception:
|
except Exception:
|
||||||
print "fail to open input " + Options.inputfilename
|
print("fail to open input " + Options.inputfilename)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
if Options.guidreffilename is not None:
|
if Options.guidreffilename is not None:
|
||||||
try :
|
try :
|
||||||
guidreffile = open(Options.guidreffilename)
|
guidreffile = open(Options.guidreffilename)
|
||||||
except Exception:
|
except Exception:
|
||||||
print "fail to open guidref" + Options.guidreffilename
|
print("fail to open guidref" + Options.guidreffilename)
|
||||||
return 1
|
return 1
|
||||||
genGuidString(guidreffile)
|
genGuidString(guidreffile)
|
||||||
guidreffile.close()
|
guidreffile.close()
|
||||||
|
@ -277,7 +278,7 @@ def main():
|
||||||
|
|
||||||
Handler = smiHandler.getElementsByTagName("Handler")
|
Handler = smiHandler.getElementsByTagName("Handler")
|
||||||
RVA = Handler[0].getElementsByTagName("RVA")
|
RVA = Handler[0].getElementsByTagName("RVA")
|
||||||
print " Handler RVA: %s" % RVA[0].childNodes[0].data
|
print(" Handler RVA: %s" % RVA[0].childNodes[0].data)
|
||||||
|
|
||||||
if (len(RVA)) >= 1:
|
if (len(RVA)) >= 1:
|
||||||
rvaName = RVA[0].childNodes[0].data
|
rvaName = RVA[0].childNodes[0].data
|
||||||
|
@ -289,7 +290,7 @@ def main():
|
||||||
|
|
||||||
Caller = smiHandler.getElementsByTagName("Caller")
|
Caller = smiHandler.getElementsByTagName("Caller")
|
||||||
RVA = Caller[0].getElementsByTagName("RVA")
|
RVA = Caller[0].getElementsByTagName("RVA")
|
||||||
print " Caller RVA: %s" % RVA[0].childNodes[0].data
|
print(" Caller RVA: %s" % RVA[0].childNodes[0].data)
|
||||||
|
|
||||||
if (len(RVA)) >= 1:
|
if (len(RVA)) >= 1:
|
||||||
rvaName = RVA[0].childNodes[0].data
|
rvaName = RVA[0].childNodes[0].data
|
||||||
|
@ -302,7 +303,7 @@ def main():
|
||||||
try :
|
try :
|
||||||
newfile = open(Options.outputfilename, "w")
|
newfile = open(Options.outputfilename, "w")
|
||||||
except Exception:
|
except Exception:
|
||||||
print "fail to open output" + Options.outputfilename
|
print("fail to open output" + Options.outputfilename)
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
newfile.write(DOMTree.toprettyxml(indent = "\t", newl = "\n", encoding = "utf-8"))
|
newfile.write(DOMTree.toprettyxml(indent = "\t", newl = "\n", encoding = "utf-8"))
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
## Import Modules
|
## Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
import os.path as path
|
import os.path as path
|
||||||
|
@ -688,7 +689,7 @@ class WorkspaceAutoGen(AutoGen):
|
||||||
os.makedirs(self.BuildDir)
|
os.makedirs(self.BuildDir)
|
||||||
with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file:
|
with open(os.path.join(self.BuildDir, 'AutoGen'), 'w+') as file:
|
||||||
for f in AllWorkSpaceMetaFiles:
|
for f in AllWorkSpaceMetaFiles:
|
||||||
print >> file, f
|
print(f, file=file)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def _GenPkgLevelHash(self, Pkg):
|
def _GenPkgLevelHash(self, Pkg):
|
||||||
|
@ -4362,7 +4363,7 @@ class ModuleAutoGen(AutoGen):
|
||||||
os.remove (self.GetTimeStampPath())
|
os.remove (self.GetTimeStampPath())
|
||||||
with open(self.GetTimeStampPath(), 'w+') as file:
|
with open(self.GetTimeStampPath(), 'w+') as file:
|
||||||
for f in FileSet:
|
for f in FileSet:
|
||||||
print >> file, f
|
print(f, file=file)
|
||||||
|
|
||||||
Module = property(_GetModule)
|
Module = property(_GetModule)
|
||||||
Name = property(_GetBaseName)
|
Name = property(_GetBaseName)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
import copy
|
import copy
|
||||||
|
@ -597,19 +598,19 @@ if __name__ == '__main__':
|
||||||
EdkLogger.Initialize()
|
EdkLogger.Initialize()
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
Br = BuildRule(sys.argv[1])
|
Br = BuildRule(sys.argv[1])
|
||||||
print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1])
|
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1])
|
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "INTEL"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1])
|
print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "GCC"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])
|
print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1])
|
print(str(Br[".h", "ACPI_TABLE", "IA32", "INTEL"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1])
|
print(str(Br[".ac", "ACPI_TABLE", "IA32", "MSFT"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1])
|
print(str(Br[".s", SUP_MODULE_SEC, "IPF", "COMMON"][1]))
|
||||||
print
|
print()
|
||||||
print str(Br[".s", SUP_MODULE_SEC][1])
|
print(str(Br[".s", SUP_MODULE_SEC][1]))
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os, codecs, re
|
import Common.LongFilePathOs as os, codecs, re
|
||||||
import distutils.util
|
import distutils.util
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
|
@ -684,12 +685,12 @@ class UniFileClassObject(object):
|
||||||
# Show the instance itself
|
# Show the instance itself
|
||||||
#
|
#
|
||||||
def ShowMe(self):
|
def ShowMe(self):
|
||||||
print self.LanguageDef
|
print(self.LanguageDef)
|
||||||
#print self.OrderedStringList
|
#print self.OrderedStringList
|
||||||
for Item in self.OrderedStringList:
|
for Item in self.OrderedStringList:
|
||||||
print Item
|
print(Item)
|
||||||
for Member in self.OrderedStringList[Item]:
|
for Member in self.OrderedStringList[Item]:
|
||||||
print str(Member)
|
print(str(Member))
|
||||||
|
|
||||||
# This acts like the main() function for the script, unless it is 'import'ed into another
|
# This acts like the main() function for the script, unless it is 'import'ed into another
|
||||||
# script.
|
# script.
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import sys
|
import sys
|
||||||
import encodings.ascii
|
import encodings.ascii
|
||||||
|
@ -132,7 +133,7 @@ def MyOptionParser():
|
||||||
#
|
#
|
||||||
def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
|
def StartBpdg(InputFileName, MapFileName, VpdFileName, Force):
|
||||||
if os.path.exists(VpdFileName) and not Force:
|
if os.path.exists(VpdFileName) and not Force:
|
||||||
print "\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName
|
print("\nFile %s already exist, Overwrite(Yes/No)?[Y]: " % VpdFileName)
|
||||||
choice = sys.stdin.readline()
|
choice = sys.stdin.readline()
|
||||||
if choice.strip().lower() not in ['y', 'yes', '']:
|
if choice.strip().lower() not in ['y', 'yes', '']:
|
||||||
return
|
return
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
## Import Modules
|
## Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
from Common.GlobalData import *
|
from Common.GlobalData import *
|
||||||
from CommonDataClass.Exceptions import BadExpression
|
from CommonDataClass.Exceptions import BadExpression
|
||||||
from CommonDataClass.Exceptions import WrnExpression
|
from CommonDataClass.Exceptions import WrnExpression
|
||||||
|
@ -1028,10 +1029,10 @@ if __name__ == '__main__':
|
||||||
if input in 'qQ':
|
if input in 'qQ':
|
||||||
break
|
break
|
||||||
try:
|
try:
|
||||||
print ValueExpression(input)(True)
|
print(ValueExpression(input)(True))
|
||||||
print ValueExpression(input)(False)
|
print(ValueExpression(input)(False))
|
||||||
except WrnExpression as Ex:
|
except WrnExpression as Ex:
|
||||||
print Ex.result
|
print(Ex.result)
|
||||||
print str(Ex)
|
print(str(Ex))
|
||||||
except Exception as Ex:
|
except Exception as Ex:
|
||||||
print str(Ex)
|
print(str(Ex))
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
|
|
||||||
# # Import Modules
|
# # Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
from Common.GlobalData import *
|
from Common.GlobalData import *
|
||||||
from CommonDataClass.Exceptions import BadExpression
|
from CommonDataClass.Exceptions import BadExpression
|
||||||
from CommonDataClass.Exceptions import WrnExpression
|
from CommonDataClass.Exceptions import WrnExpression
|
||||||
|
@ -85,11 +86,11 @@ class RangeContainer(object):
|
||||||
self.__clean__()
|
self.__clean__()
|
||||||
|
|
||||||
def dump(self):
|
def dump(self):
|
||||||
print "----------------------"
|
print("----------------------")
|
||||||
rangelist = ""
|
rangelist = ""
|
||||||
for object in self.rangelist:
|
for object in self.rangelist:
|
||||||
rangelist = rangelist + "[%d , %d]" % (object.start, object.end)
|
rangelist = rangelist + "[%d , %d]" % (object.start, object.end)
|
||||||
print rangelist
|
print(rangelist)
|
||||||
|
|
||||||
|
|
||||||
class XOROperatorObject(object):
|
class XOROperatorObject(object):
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import EdkLogger
|
import EdkLogger
|
||||||
import DataType
|
import DataType
|
||||||
|
@ -158,6 +159,6 @@ def TargetTxtDict(ConfDir):
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
pass
|
pass
|
||||||
Target = TargetTxtDict(os.getenv("WORKSPACE"))
|
Target = TargetTxtDict(os.getenv("WORKSPACE"))
|
||||||
print Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER]
|
print(Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_MAX_CONCURRENT_THREAD_NUMBER])
|
||||||
print Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TARGET]
|
print(Target.TargetTxtDictionary[DataType.TAB_TAT_DEFINES_TARGET])
|
||||||
print Target.TargetTxtDictionary
|
print(Target.TargetTxtDictionary)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
|
@ -248,7 +249,7 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
|
||||||
except Exception as X:
|
except Exception as X:
|
||||||
EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData=str(X))
|
EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, ExtraData=str(X))
|
||||||
(out, error) = PopenObject.communicate()
|
(out, error) = PopenObject.communicate()
|
||||||
print out
|
print(out)
|
||||||
while PopenObject.returncode is None :
|
while PopenObject.returncode is None :
|
||||||
PopenObject.wait()
|
PopenObject.wait()
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
|
# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
from antlr3 import *
|
from antlr3 import *
|
||||||
from antlr3.compat import set, frozenset
|
from antlr3.compat import set, frozenset
|
||||||
|
|
||||||
|
@ -102,8 +103,8 @@ class CParser(Parser):
|
||||||
self.postfix_expression_stack = []
|
self.postfix_expression_stack = []
|
||||||
|
|
||||||
def printTokenInfo(self, line, offset, tokenText):
|
def printTokenInfo(self, line, offset, tokenText):
|
||||||
print str(line)+ ',' + str(offset) + ':' + str(tokenText)
|
print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
|
||||||
|
|
||||||
def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
|
def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
|
||||||
PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
|
PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
|
||||||
FileProfile.PredicateExpressionList.append(PredExp)
|
FileProfile.PredicateExpressionList.append(PredExp)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import sys
|
import sys
|
||||||
|
@ -533,58 +534,58 @@ class CodeFragmentCollector:
|
||||||
|
|
||||||
def PrintFragments(self):
|
def PrintFragments(self):
|
||||||
|
|
||||||
print '################# ' + self.FileName + '#####################'
|
print('################# ' + self.FileName + '#####################')
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/*************** COMMENTS ***************/'
|
print('/*************** COMMENTS ***************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for comment in FileProfile.CommentList:
|
for comment in FileProfile.CommentList:
|
||||||
print str(comment.StartPos) + comment.Content
|
print(str(comment.StartPos) + comment.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* PREPROCESS DIRECTIVES ********/'
|
print('/********* PREPROCESS DIRECTIVES ********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for pp in FileProfile.PPDirectiveList:
|
for pp in FileProfile.PPDirectiveList:
|
||||||
print str(pp.StartPos) + pp.Content
|
print(str(pp.StartPos) + pp.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* VARIABLE DECLARATIONS ********/'
|
print('/********* VARIABLE DECLARATIONS ********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for var in FileProfile.VariableDeclarationList:
|
for var in FileProfile.VariableDeclarationList:
|
||||||
print str(var.StartPos) + var.Modifier + ' '+ var.Declarator
|
print(str(var.StartPos) + var.Modifier + ' '+ var.Declarator)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* FUNCTION DEFINITIONS *********/'
|
print('/********* FUNCTION DEFINITIONS *********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for func in FileProfile.FunctionDefinitionList:
|
for func in FileProfile.FunctionDefinitionList:
|
||||||
print str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos)
|
print(str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos))
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/************ ENUMERATIONS **************/'
|
print('/************ ENUMERATIONS **************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for enum in FileProfile.EnumerationDefinitionList:
|
for enum in FileProfile.EnumerationDefinitionList:
|
||||||
print str(enum.StartPos) + enum.Content
|
print(str(enum.StartPos) + enum.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/*********** STRUCTS/UNIONS *************/'
|
print('/*********** STRUCTS/UNIONS *************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for su in FileProfile.StructUnionDefinitionList:
|
for su in FileProfile.StructUnionDefinitionList:
|
||||||
print str(su.StartPos) + su.Content
|
print(str(su.StartPos) + su.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* PREDICATE EXPRESSIONS ********/'
|
print('/********* PREDICATE EXPRESSIONS ********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for predexp in FileProfile.PredicateExpressionList:
|
for predexp in FileProfile.PredicateExpressionList:
|
||||||
print str(predexp.StartPos) + predexp.Content
|
print(str(predexp.StartPos) + predexp.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/************** TYPEDEFS ****************/'
|
print('/************** TYPEDEFS ****************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for typedef in FileProfile.TypedefDefinitionList:
|
for typedef in FileProfile.TypedefDefinitionList:
|
||||||
print str(typedef.StartPos) + typedef.ToType
|
print(str(typedef.StartPos) + typedef.ToType)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
collector = CodeFragmentCollector(sys.argv[1])
|
collector = CodeFragmentCollector(sys.argv[1])
|
||||||
collector.PreprocessFile()
|
collector.PreprocessFile()
|
||||||
print "For Test."
|
print("For Test.")
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
from Common.DataType import *
|
from Common.DataType import *
|
||||||
|
@ -419,9 +420,9 @@ class Configuration(object):
|
||||||
self.__dict__[_ConfigFileToInternalTranslation[List[0]]] = List[1]
|
self.__dict__[_ConfigFileToInternalTranslation[List[0]]] = List[1]
|
||||||
|
|
||||||
def ShowMe(self):
|
def ShowMe(self):
|
||||||
print self.Filename
|
print(self.Filename)
|
||||||
for Key in self.__dict__.keys():
|
for Key in self.__dict__.keys():
|
||||||
print Key, '=', self.__dict__[Key]
|
print(Key, '=', self.__dict__[Key])
|
||||||
|
|
||||||
#
|
#
|
||||||
# test that our dict and out class still match in contents.
|
# test that our dict and out class still match in contents.
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
from Xml.XmlRoutines import *
|
from Xml.XmlRoutines import *
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
|
|
||||||
|
@ -84,4 +85,4 @@ class ExceptionCheck(object):
|
||||||
#
|
#
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
El = ExceptionCheck('C:\\Hess\\Project\\BuildTool\\src\\Ecc\\exception.xml')
|
El = ExceptionCheck('C:\\Hess\\Project\\BuildTool\\src\\Ecc\\exception.xml')
|
||||||
print El.ExceptionList
|
print(El.ExceptionList)
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
|
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
|
@ -99,7 +100,7 @@ class Table(object):
|
||||||
try:
|
try:
|
||||||
self.Cur.execute(SqlCommand)
|
self.Cur.execute(SqlCommand)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print "An error occurred when Drop a table:", e.args[0]
|
print("An error occurred when Drop a table:", e.args[0])
|
||||||
|
|
||||||
## Get count
|
## Get count
|
||||||
#
|
#
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
from Common.LongFilePathSupport import OpenLongFilePath as open
|
from Common.LongFilePathSupport import OpenLongFilePath as open
|
||||||
|
|
||||||
|
@ -215,7 +216,7 @@ def XmlParseFile(FileName):
|
||||||
XmlFile.close()
|
XmlFile.close()
|
||||||
return Dom
|
return Dom
|
||||||
except Exception as X:
|
except Exception as X:
|
||||||
print X
|
print(X)
|
||||||
return ""
|
return ""
|
||||||
|
|
||||||
# This acts like the main() function for the script, unless it is 'import'ed
|
# This acts like the main() function for the script, unless it is 'import'ed
|
||||||
|
@ -225,5 +226,5 @@ if __name__ == '__main__':
|
||||||
A = CreateXmlElement('AAA', 'CCC', [['AAA', '111'], ['BBB', '222']], [['A', '1'], ['B', '2']])
|
A = CreateXmlElement('AAA', 'CCC', [['AAA', '111'], ['BBB', '222']], [['A', '1'], ['B', '2']])
|
||||||
B = CreateXmlElement('ZZZ', 'CCC', [['XXX', '111'], ['YYY', '222']], [['A', '1'], ['B', '2']])
|
B = CreateXmlElement('ZZZ', 'CCC', [['XXX', '111'], ['YYY', '222']], [['A', '1'], ['B', '2']])
|
||||||
C = CreateXmlList('DDD', 'EEE', [A, B], ['FFF', 'GGG'])
|
C = CreateXmlList('DDD', 'EEE', [A, B], ['FFF', 'GGG'])
|
||||||
print C.toprettyxml(indent = " ")
|
print(C.toprettyxml(indent = " "))
|
||||||
pass
|
pass
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
|
@ -2285,7 +2286,7 @@ def CheckDoxygenTripleForwardSlash(FullFileName):
|
||||||
for Result in ResultSet:
|
for Result in ResultSet:
|
||||||
CommentSet.append(Result)
|
CommentSet.append(Result)
|
||||||
except:
|
except:
|
||||||
print 'Unrecognized chars in comment of file %s', FullFileName
|
print('Unrecognized chars in comment of file %s', FullFileName)
|
||||||
|
|
||||||
|
|
||||||
for Result in CommentSet:
|
for Result in CommentSet:
|
||||||
|
@ -2438,7 +2439,7 @@ def CheckFuncHeaderDoxygenComments(FullFileName):
|
||||||
for Result in ResultSet:
|
for Result in ResultSet:
|
||||||
CommentSet.append(Result)
|
CommentSet.append(Result)
|
||||||
except:
|
except:
|
||||||
print 'Unrecognized chars in comment of file %s', FullFileName
|
print('Unrecognized chars in comment of file %s', FullFileName)
|
||||||
|
|
||||||
# Func Decl check
|
# Func Decl check
|
||||||
SqlStatement = """ select Modifier, Name, StartLine, ID, Value
|
SqlStatement = """ select Modifier, Name, StartLine, ID, Value
|
||||||
|
@ -2469,7 +2470,7 @@ def CheckFuncHeaderDoxygenComments(FullFileName):
|
||||||
for Result in ResultSet:
|
for Result in ResultSet:
|
||||||
CommentSet.append(Result)
|
CommentSet.append(Result)
|
||||||
except:
|
except:
|
||||||
print 'Unrecognized chars in comment of file %s', FullFileName
|
print('Unrecognized chars in comment of file %s', FullFileName)
|
||||||
|
|
||||||
SqlStatement = """ select Modifier, Header, StartLine, ID, Name
|
SqlStatement = """ select Modifier, Header, StartLine, ID, Name
|
||||||
from Function
|
from Function
|
||||||
|
@ -2634,9 +2635,9 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
test_file = sys.argv[1]
|
test_file = sys.argv[1]
|
||||||
except IndexError as v:
|
except IndexError as v:
|
||||||
print "Usage: %s filename" % sys.argv[0]
|
print("Usage: %s filename" % sys.argv[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
MsgList = CheckFuncHeaderDoxygenComments(test_file)
|
MsgList = CheckFuncHeaderDoxygenComments(test_file)
|
||||||
for Msg in MsgList:
|
for Msg in MsgList:
|
||||||
print Msg
|
print(Msg)
|
||||||
print 'Done!'
|
print('Done!')
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
|
# $ANTLR 3.0.1 C.g 2010-02-23 09:58:53
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
from antlr3 import *
|
from antlr3 import *
|
||||||
from antlr3.compat import set, frozenset
|
from antlr3.compat import set, frozenset
|
||||||
|
|
||||||
|
@ -102,8 +103,8 @@ class CParser(Parser):
|
||||||
self.postfix_expression_stack = []
|
self.postfix_expression_stack = []
|
||||||
|
|
||||||
def printTokenInfo(self, line, offset, tokenText):
|
def printTokenInfo(self, line, offset, tokenText):
|
||||||
print str(line)+ ',' + str(offset) + ':' + str(tokenText)
|
print(str(line)+ ',' + str(offset) + ':' + str(tokenText))
|
||||||
|
|
||||||
def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
|
def StorePredicateExpression(self, StartLine, StartOffset, EndLine, EndOffset, Text):
|
||||||
PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
|
PredExp = CodeFragment.PredicateExpression(Text, (StartLine, StartOffset), (EndLine, EndOffset))
|
||||||
FileProfile.PredicateExpressionList.append(PredExp)
|
FileProfile.PredicateExpressionList.append(PredExp)
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import sys
|
import sys
|
||||||
|
@ -379,49 +380,49 @@ class CodeFragmentCollector:
|
||||||
#
|
#
|
||||||
def PrintFragments(self):
|
def PrintFragments(self):
|
||||||
|
|
||||||
print '################# ' + self.FileName + '#####################'
|
print('################# ' + self.FileName + '#####################')
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/*************** ASSIGNMENTS ***************/'
|
print('/*************** ASSIGNMENTS ***************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for asign in FileProfile.AssignmentExpressionList:
|
for asign in FileProfile.AssignmentExpressionList:
|
||||||
print str(asign.StartPos) + asign.Name + asign.Operator + asign.Value
|
print(str(asign.StartPos) + asign.Name + asign.Operator + asign.Value)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* PREPROCESS DIRECTIVES ********/'
|
print('/********* PREPROCESS DIRECTIVES ********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for pp in FileProfile.PPDirectiveList:
|
for pp in FileProfile.PPDirectiveList:
|
||||||
print str(pp.StartPos) + pp.Content
|
print(str(pp.StartPos) + pp.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* VARIABLE DECLARATIONS ********/'
|
print('/********* VARIABLE DECLARATIONS ********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for var in FileProfile.VariableDeclarationList:
|
for var in FileProfile.VariableDeclarationList:
|
||||||
print str(var.StartPos) + var.Modifier + ' '+ var.Declarator
|
print(str(var.StartPos) + var.Modifier + ' '+ var.Declarator)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/********* FUNCTION DEFINITIONS *********/'
|
print('/********* FUNCTION DEFINITIONS *********/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for func in FileProfile.FunctionDefinitionList:
|
for func in FileProfile.FunctionDefinitionList:
|
||||||
print str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos)
|
print(str(func.StartPos) + func.Modifier + ' '+ func.Declarator + ' ' + str(func.NamePos))
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/************ ENUMERATIONS **************/'
|
print('/************ ENUMERATIONS **************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for enum in FileProfile.EnumerationDefinitionList:
|
for enum in FileProfile.EnumerationDefinitionList:
|
||||||
print str(enum.StartPos) + enum.Content
|
print(str(enum.StartPos) + enum.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/*********** STRUCTS/UNIONS *************/'
|
print('/*********** STRUCTS/UNIONS *************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for su in FileProfile.StructUnionDefinitionList:
|
for su in FileProfile.StructUnionDefinitionList:
|
||||||
print str(su.StartPos) + su.Content
|
print(str(su.StartPos) + su.Content)
|
||||||
|
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
print '/************** TYPEDEFS ****************/'
|
print('/************** TYPEDEFS ****************/')
|
||||||
print '/****************************************/'
|
print('/****************************************/')
|
||||||
for typedef in FileProfile.TypedefDefinitionList:
|
for typedef in FileProfile.TypedefDefinitionList:
|
||||||
print str(typedef.StartPos) + typedef.ToType
|
print(str(typedef.StartPos) + typedef.ToType)
|
||||||
|
|
||||||
##
|
##
|
||||||
#
|
#
|
||||||
|
@ -430,4 +431,4 @@ class CodeFragmentCollector:
|
||||||
#
|
#
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|
||||||
print "For Test."
|
print("For Test.")
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import Common.EdkLogger as EdkLogger
|
import Common.EdkLogger as EdkLogger
|
||||||
from Common.DataType import *
|
from Common.DataType import *
|
||||||
|
@ -164,8 +165,8 @@ if __name__ == '__main__':
|
||||||
Db.InitDatabase()
|
Db.InitDatabase()
|
||||||
P = EdkInfParser(os.path.normpath("C:\Framework\Edk\Sample\Platform\Nt32\Dxe\PlatformBds\PlatformBds.inf"), Db, '', '')
|
P = EdkInfParser(os.path.normpath("C:\Framework\Edk\Sample\Platform\Nt32\Dxe\PlatformBds\PlatformBds.inf"), Db, '', '')
|
||||||
for Inf in P.Sources:
|
for Inf in P.Sources:
|
||||||
print Inf
|
print(Inf)
|
||||||
for Item in P.Macros:
|
for Item in P.Macros:
|
||||||
print Item, P.Macros[Item]
|
print(Item, P.Macros[Item])
|
||||||
|
|
||||||
Db.Close()
|
Db.Close()
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
|
@ -384,4 +385,4 @@ if __name__ == '__main__':
|
||||||
EdkLogger.SetLevel(EdkLogger.QUIET)
|
EdkLogger.SetLevel(EdkLogger.QUIET)
|
||||||
CollectSourceCodeDataIntoDB(sys.argv[1])
|
CollectSourceCodeDataIntoDB(sys.argv[1])
|
||||||
|
|
||||||
print 'Done!'
|
print('Done!')
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import re
|
import re
|
||||||
|
|
||||||
import Fd
|
import Fd
|
||||||
|
@ -4777,7 +4778,7 @@ if __name__ == "__main__":
|
||||||
try:
|
try:
|
||||||
test_file = sys.argv[1]
|
test_file = sys.argv[1]
|
||||||
except IndexError as v:
|
except IndexError as v:
|
||||||
print "Usage: %s filename" % sys.argv[0]
|
print("Usage: %s filename" % sys.argv[0])
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
parser = FdfParser(test_file)
|
parser = FdfParser(test_file)
|
||||||
|
@ -4785,7 +4786,7 @@ if __name__ == "__main__":
|
||||||
parser.ParseFile()
|
parser.ParseFile()
|
||||||
parser.CycleReferenceCheck()
|
parser.CycleReferenceCheck()
|
||||||
except Warning as X:
|
except Warning as X:
|
||||||
print str(X)
|
print(str(X))
|
||||||
else:
|
else:
|
||||||
print "Success!"
|
print("Success!")
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import sys
|
import sys
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
|
@ -689,7 +690,7 @@ class GenFds :
|
||||||
ModuleDict = BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules
|
ModuleDict = BuildDb.BuildObject[DscFile, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag].Modules
|
||||||
for Key in ModuleDict:
|
for Key in ModuleDict:
|
||||||
ModuleObj = BuildDb.BuildObject[Key, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
ModuleObj = BuildDb.BuildObject[Key, TAB_COMMON, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
|
||||||
print ModuleObj.BaseName + ' ' + ModuleObj.ModuleType
|
print(ModuleObj.BaseName + ' ' + ModuleObj.ModuleType)
|
||||||
|
|
||||||
def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
|
def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
|
||||||
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
|
GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, "Guid.xref")
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
@ -736,7 +737,7 @@ class GenFdsGlobalVariable:
|
||||||
GenFdsGlobalVariable.InfLogger (out)
|
GenFdsGlobalVariable.InfLogger (out)
|
||||||
GenFdsGlobalVariable.InfLogger (error)
|
GenFdsGlobalVariable.InfLogger (error)
|
||||||
if PopenObject.returncode != 0:
|
if PopenObject.returncode != 0:
|
||||||
print "###", cmd
|
print("###", cmd)
|
||||||
EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
|
EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
|
||||||
|
|
||||||
def VerboseLogger (msg):
|
def VerboseLogger (msg):
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
#====================================== External Libraries ========================================
|
#====================================== External Libraries ========================================
|
||||||
|
from __future__ import print_function
|
||||||
import optparse
|
import optparse
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
|
@ -216,7 +217,7 @@ if __name__ == '__main__':
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if options.mapfile is None or options.efifile is None:
|
if options.mapfile is None or options.efifile is None:
|
||||||
print parser.get_usage()
|
print(parser.get_usage())
|
||||||
elif os.path.exists(options.mapfile) and os.path.exists(options.efifile):
|
elif os.path.exists(options.mapfile) and os.path.exists(options.efifile):
|
||||||
list = parsePcdInfoFromMapFile(options.mapfile, options.efifile)
|
list = parsePcdInfoFromMapFile(options.mapfile, options.efifile)
|
||||||
if list is not None:
|
if list is not None:
|
||||||
|
@ -225,6 +226,6 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt'))
|
generatePcdTable(list, options.mapfile.replace('.map', '.BinaryPcdTable.txt'))
|
||||||
else:
|
else:
|
||||||
print 'Fail to generate Patch PCD Table based on map file and efi file'
|
print('Fail to generate Patch PCD Table based on map file and efi file')
|
||||||
else:
|
else:
|
||||||
print 'Fail to generate Patch PCD Table for fail to find map file or efi file!'
|
print('Fail to generate Patch PCD Table for fail to find map file or efi file!')
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
'''
|
'''
|
||||||
Pkcs7Sign
|
Pkcs7Sign
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -113,14 +114,14 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
except:
|
except:
|
||||||
print 'ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH'
|
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
Version = Process.communicate()
|
Version = Process.communicate()
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH'
|
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
print Version[0]
|
print(Version[0])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read input file into a buffer and save input filename
|
# Read input file into a buffer and save input filename
|
||||||
|
@ -134,7 +135,7 @@ if __name__ == '__main__':
|
||||||
#
|
#
|
||||||
OutputDir = os.path.dirname(args.OutputFile)
|
OutputDir = os.path.dirname(args.OutputFile)
|
||||||
if not os.path.exists(OutputDir):
|
if not os.path.exists(OutputDir):
|
||||||
print 'ERROR: The output path does not exist: %s' % OutputDir
|
print('ERROR: The output path does not exist: %s' % OutputDir)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
args.OutputFileName = args.OutputFile
|
args.OutputFileName = args.OutputFile
|
||||||
|
|
||||||
|
@ -170,7 +171,7 @@ if __name__ == '__main__':
|
||||||
args.SignerPrivateCertFile = open(args.SignerPrivateCertFileName, 'rb')
|
args.SignerPrivateCertFile = open(args.SignerPrivateCertFileName, 'rb')
|
||||||
args.SignerPrivateCertFile.close()
|
args.SignerPrivateCertFile.close()
|
||||||
except:
|
except:
|
||||||
print 'ERROR: test signer private cert file %s missing' % (args.SignerPrivateCertFileName)
|
print('ERROR: test signer private cert file %s missing' % (args.SignerPrivateCertFileName))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -196,7 +197,7 @@ if __name__ == '__main__':
|
||||||
args.OtherPublicCertFile = open(args.OtherPublicCertFileName, 'rb')
|
args.OtherPublicCertFile = open(args.OtherPublicCertFileName, 'rb')
|
||||||
args.OtherPublicCertFile.close()
|
args.OtherPublicCertFile.close()
|
||||||
except:
|
except:
|
||||||
print 'ERROR: test other public cert file %s missing' % (args.OtherPublicCertFileName)
|
print('ERROR: test other public cert file %s missing' % (args.OtherPublicCertFileName))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
format = "%dsQ" % len(args.InputFileBuffer)
|
format = "%dsQ" % len(args.InputFileBuffer)
|
||||||
|
@ -242,11 +243,11 @@ if __name__ == '__main__':
|
||||||
args.TrustedPublicCertFile = open(args.TrustedPublicCertFileName, 'rb')
|
args.TrustedPublicCertFile = open(args.TrustedPublicCertFileName, 'rb')
|
||||||
args.TrustedPublicCertFile.close()
|
args.TrustedPublicCertFile.close()
|
||||||
except:
|
except:
|
||||||
print 'ERROR: test trusted public cert file %s missing' % (args.TrustedPublicCertFileName)
|
print('ERROR: test trusted public cert file %s missing' % (args.TrustedPublicCertFileName))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
if not args.SignatureSizeStr:
|
if not args.SignatureSizeStr:
|
||||||
print "ERROR: please use the option --signature-size to specify the size of the signature data!"
|
print("ERROR: please use the option --signature-size to specify the size of the signature data!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if args.SignatureSizeStr.upper().startswith('0X'):
|
if args.SignatureSizeStr.upper().startswith('0X'):
|
||||||
|
@ -254,10 +255,10 @@ if __name__ == '__main__':
|
||||||
else:
|
else:
|
||||||
SignatureSize = (long)(args.SignatureSizeStr)
|
SignatureSize = (long)(args.SignatureSizeStr)
|
||||||
if SignatureSize < 0:
|
if SignatureSize < 0:
|
||||||
print "ERROR: The value of option --signature-size can't be set to negative value!"
|
print("ERROR: The value of option --signature-size can't be set to negative value!")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif SignatureSize > len(args.InputFileBuffer):
|
elif SignatureSize > len(args.InputFileBuffer):
|
||||||
print "ERROR: The value of option --signature-size is exceed the size of the input file !"
|
print("ERROR: The value of option --signature-size is exceed the size of the input file !")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
args.SignatureBuffer = args.InputFileBuffer[0:SignatureSize]
|
args.SignatureBuffer = args.InputFileBuffer[0:SignatureSize]
|
||||||
|
@ -277,7 +278,7 @@ if __name__ == '__main__':
|
||||||
Process = subprocess.Popen('%s smime -verify -inform DER -content %s -CAfile %s' % (OpenSslCommand, args.OutputFileName, args.TrustedPublicCertFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s smime -verify -inform DER -content %s -CAfile %s' % (OpenSslCommand, args.OutputFileName, args.TrustedPublicCertFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
Process.communicate(input=args.SignatureBuffer)[0]
|
Process.communicate(input=args.SignatureBuffer)[0]
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Verification failed'
|
print('ERROR: Verification failed')
|
||||||
os.remove (args.OutputFileName)
|
os.remove (args.OutputFileName)
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
'''
|
'''
|
||||||
Rsa2048Sha256GenerateKeys
|
Rsa2048Sha256GenerateKeys
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -75,14 +76,14 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
except:
|
except:
|
||||||
print 'ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH'
|
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
Version = Process.communicate()
|
Version = Process.communicate()
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH'
|
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
print Version[0]
|
print(Version[0])
|
||||||
|
|
||||||
args.PemFileName = []
|
args.PemFileName = []
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ if __name__ == '__main__':
|
||||||
Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s genrsa -out %s 2048' % (OpenSslCommand, Item.name), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
Process.communicate()
|
Process.communicate()
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: RSA 2048 key generation failed'
|
print('ERROR: RSA 2048 key generation failed')
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -125,7 +126,7 @@ if __name__ == '__main__':
|
||||||
Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s rsa -in %s -modulus -noout' % (OpenSslCommand, Item), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()
|
PublicKeyHexString = Process.communicate()[0].split('=')[1].strip()
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Unable to extract public key from private key'
|
print('ERROR: Unable to extract public key from private key')
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
PublicKey = ''
|
PublicKey = ''
|
||||||
for Index in range (0, len(PublicKeyHexString), 2):
|
for Index in range (0, len(PublicKeyHexString), 2):
|
||||||
|
@ -138,7 +139,7 @@ if __name__ == '__main__':
|
||||||
Process.stdin.write (PublicKey)
|
Process.stdin.write (PublicKey)
|
||||||
PublicKeyHash = PublicKeyHash + Process.communicate()[0]
|
PublicKeyHash = PublicKeyHash + Process.communicate()[0]
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Unable to extract SHA 256 hash of public key'
|
print('ERROR: Unable to extract SHA 256 hash of public key')
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -171,4 +172,4 @@ if __name__ == '__main__':
|
||||||
# If verbose is enabled display the public key in C structure format
|
# If verbose is enabled display the public key in C structure format
|
||||||
#
|
#
|
||||||
if args.Verbose:
|
if args.Verbose:
|
||||||
print 'PublicKeySha256 = ' + PublicKeyHashC
|
print('PublicKeySha256 = ' + PublicKeyHashC)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
'''
|
'''
|
||||||
Rsa2048Sha256Sign
|
Rsa2048Sha256Sign
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
@ -96,14 +97,14 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s version' % (OpenSslCommand), stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
except:
|
except:
|
||||||
print 'ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH'
|
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
Version = Process.communicate()
|
Version = Process.communicate()
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH'
|
print('ERROR: Open SSL command not available. Please verify PATH or set OPENSSL_PATH')
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
print Version[0]
|
print(Version[0])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read input file into a buffer and save input filename
|
# Read input file into a buffer and save input filename
|
||||||
|
@ -117,7 +118,7 @@ if __name__ == '__main__':
|
||||||
#
|
#
|
||||||
OutputDir = os.path.dirname(args.OutputFile)
|
OutputDir = os.path.dirname(args.OutputFile)
|
||||||
if not os.path.exists(OutputDir):
|
if not os.path.exists(OutputDir):
|
||||||
print 'ERROR: The output path does not exist: %s' % OutputDir
|
print('ERROR: The output path does not exist: %s' % OutputDir)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
args.OutputFileName = args.OutputFile
|
args.OutputFileName = args.OutputFile
|
||||||
|
|
||||||
|
@ -144,7 +145,7 @@ if __name__ == '__main__':
|
||||||
args.PrivateKeyFile = open(args.PrivateKeyFileName, 'rb')
|
args.PrivateKeyFile = open(args.PrivateKeyFileName, 'rb')
|
||||||
args.PrivateKeyFile.close()
|
args.PrivateKeyFile.close()
|
||||||
except:
|
except:
|
||||||
print 'ERROR: test signing private key file %s missing' % (args.PrivateKeyFileName)
|
print('ERROR: test signing private key file %s missing' % (args.PrivateKeyFileName))
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -202,14 +203,14 @@ if __name__ == '__main__':
|
||||||
# Verify that the Hash Type matches the expected SHA256 type
|
# Verify that the Hash Type matches the expected SHA256 type
|
||||||
#
|
#
|
||||||
if uuid.UUID(bytes_le = Header.HashType) <> EFI_HASH_ALGORITHM_SHA256_GUID:
|
if uuid.UUID(bytes_le = Header.HashType) <> EFI_HASH_ALGORITHM_SHA256_GUID:
|
||||||
print 'ERROR: unsupport hash GUID'
|
print('ERROR: unsupport hash GUID')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Verify the public key
|
# Verify the public key
|
||||||
#
|
#
|
||||||
if Header.PublicKey <> PublicKey:
|
if Header.PublicKey <> PublicKey:
|
||||||
print 'ERROR: Public key in input file does not match public key from private key file'
|
print('ERROR: Public key in input file does not match public key from private key file')
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
FullInputFileBuffer = args.InputFileBuffer
|
FullInputFileBuffer = args.InputFileBuffer
|
||||||
|
@ -228,7 +229,7 @@ if __name__ == '__main__':
|
||||||
Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
Process = subprocess.Popen('%s dgst -sha256 -prverify "%s" -signature %s' % (OpenSslCommand, args.PrivateKeyFileName, args.OutputFileName), stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||||
Process.communicate(input=FullInputFileBuffer)
|
Process.communicate(input=FullInputFileBuffer)
|
||||||
if Process.returncode <> 0:
|
if Process.returncode <> 0:
|
||||||
print 'ERROR: Verification failed'
|
print('ERROR: Verification failed')
|
||||||
os.remove (args.OutputFileName)
|
os.remove (args.OutputFileName)
|
||||||
sys.exit(Process.returncode)
|
sys.exit(Process.returncode)
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import sys
|
import sys
|
||||||
import traceback
|
import traceback
|
||||||
|
@ -32,7 +33,7 @@ class TargetTool():
|
||||||
self.Arg = args[0]
|
self.Arg = args[0]
|
||||||
self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', 'target.txt'))
|
self.FileName = os.path.normpath(os.path.join(self.WorkSpace, 'Conf', 'target.txt'))
|
||||||
if os.path.isfile(self.FileName) == False:
|
if os.path.isfile(self.FileName) == False:
|
||||||
print "%s does not exist." % self.FileName
|
print("%s does not exist." % self.FileName)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
self.TargetTxtDictionary = {
|
self.TargetTxtDictionary = {
|
||||||
TAB_TAT_DEFINES_ACTIVE_PLATFORM : None,
|
TAB_TAT_DEFINES_ACTIVE_PLATFORM : None,
|
||||||
|
@ -83,14 +84,14 @@ class TargetTool():
|
||||||
errMsg = ''
|
errMsg = ''
|
||||||
for Key in self.TargetTxtDictionary:
|
for Key in self.TargetTxtDictionary:
|
||||||
if type(self.TargetTxtDictionary[Key]) == type([]):
|
if type(self.TargetTxtDictionary[Key]) == type([]):
|
||||||
print "%-30s = %s" % (Key, ''.join(elem + ' ' for elem in self.TargetTxtDictionary[Key]))
|
print("%-30s = %s" % (Key, ''.join(elem + ' ' for elem in self.TargetTxtDictionary[Key])))
|
||||||
elif self.TargetTxtDictionary[Key] is None:
|
elif self.TargetTxtDictionary[Key] is None:
|
||||||
errMsg += " Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep
|
errMsg += " Missing %s configuration information, please use TargetTool to set value!" % Key + os.linesep
|
||||||
else:
|
else:
|
||||||
print "%-30s = %s" % (Key, self.TargetTxtDictionary[Key])
|
print("%-30s = %s" % (Key, self.TargetTxtDictionary[Key]))
|
||||||
|
|
||||||
if errMsg != '':
|
if errMsg != '':
|
||||||
print os.linesep + 'Warning:' + os.linesep + errMsg
|
print(os.linesep + 'Warning:' + os.linesep + errMsg)
|
||||||
|
|
||||||
def RWFile(self, CommentCharacter, KeySplitCharacter, Num):
|
def RWFile(self, CommentCharacter, KeySplitCharacter, Num):
|
||||||
try:
|
try:
|
||||||
|
@ -109,7 +110,7 @@ class TargetTool():
|
||||||
if Key not in existKeys:
|
if Key not in existKeys:
|
||||||
existKeys.append(Key)
|
existKeys.append(Key)
|
||||||
else:
|
else:
|
||||||
print "Warning: Found duplicate key item in original configuration files!"
|
print("Warning: Found duplicate key item in original configuration files!")
|
||||||
|
|
||||||
if Num == 0:
|
if Num == 0:
|
||||||
Line = "%-30s = \n" % Key
|
Line = "%-30s = \n" % Key
|
||||||
|
@ -120,7 +121,7 @@ class TargetTool():
|
||||||
fw.write(Line)
|
fw.write(Line)
|
||||||
for key in self.TargetTxtDictionary:
|
for key in self.TargetTxtDictionary:
|
||||||
if key not in existKeys:
|
if key not in existKeys:
|
||||||
print "Warning: %s does not exist in original configuration file" % key
|
print("Warning: %s does not exist in original configuration file" % key)
|
||||||
Line = GetConfigureKeyValue(self, key)
|
Line = GetConfigureKeyValue(self, key)
|
||||||
if Line is None:
|
if Line is None:
|
||||||
Line = "%-30s = " % key
|
Line = "%-30s = " % key
|
||||||
|
@ -223,25 +224,25 @@ if __name__ == '__main__':
|
||||||
EdkLogger.Initialize()
|
EdkLogger.Initialize()
|
||||||
EdkLogger.SetLevel(EdkLogger.QUIET)
|
EdkLogger.SetLevel(EdkLogger.QUIET)
|
||||||
if os.getenv('WORKSPACE') is None:
|
if os.getenv('WORKSPACE') is None:
|
||||||
print "ERROR: WORKSPACE should be specified or edksetup script should be executed before run TargetTool"
|
print("ERROR: WORKSPACE should be specified or edksetup script should be executed before run TargetTool")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
(opt, args) = MyOptionParser()
|
(opt, args) = MyOptionParser()
|
||||||
if len(args) != 1 or (args[0].lower() != 'print' and args[0].lower() != 'clean' and args[0].lower() != 'set'):
|
if len(args) != 1 or (args[0].lower() != 'print' and args[0].lower() != 'clean' and args[0].lower() != 'set'):
|
||||||
print "The number of args isn't 1 or the value of args is invalid."
|
print("The number of args isn't 1 or the value of args is invalid.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.NUM is not None and opt.NUM < 1:
|
if opt.NUM is not None and opt.NUM < 1:
|
||||||
print "The MAX_CONCURRENT_THREAD_NUMBER must be larger than 0."
|
print("The MAX_CONCURRENT_THREAD_NUMBER must be larger than 0.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.TARGET is not None and len(opt.TARGET) > 1:
|
if opt.TARGET is not None and len(opt.TARGET) > 1:
|
||||||
for elem in opt.TARGET:
|
for elem in opt.TARGET:
|
||||||
if elem == '0':
|
if elem == '0':
|
||||||
print "0 will clear the TARGET setting in target.txt and can't combine with other value."
|
print("0 will clear the TARGET setting in target.txt and can't combine with other value.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
if opt.TARGET_ARCH is not None and len(opt.TARGET_ARCH) > 1:
|
if opt.TARGET_ARCH is not None and len(opt.TARGET_ARCH) > 1:
|
||||||
for elem in opt.TARGET_ARCH:
|
for elem in opt.TARGET_ARCH:
|
||||||
if elem == '0':
|
if elem == '0':
|
||||||
print "0 will clear the TARGET_ARCH setting in target.txt and can't combine with other value."
|
print("0 will clear the TARGET_ARCH setting in target.txt and can't combine with other value.")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
'''
|
'''
|
||||||
ExpressionValidate
|
ExpressionValidate
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
|
@ -566,7 +567,7 @@ def IsValidFeatureFlagExp(Token, Flag=False):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# print IsValidRangeExpr('LT 9')
|
# print IsValidRangeExpr('LT 9')
|
||||||
print _LogicalExpressionParser('gCrownBayTokenSpaceGuid.PcdPciDevice1BridgeAddressLE0').IsValidLogicalExpression()
|
print(_LogicalExpressionParser('gCrownBayTokenSpaceGuid.PcdPciDevice1BridgeAddressLE0').IsValidLogicalExpression())
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
"""
|
"""
|
||||||
Collect all defined strings in multiple uni files
|
Collect all defined strings in multiple uni files
|
||||||
"""
|
"""
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
|
@ -730,7 +731,7 @@ class UniFileClassObject(object):
|
||||||
EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
|
EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
|
||||||
NewLines.append(Line)
|
NewLines.append(Line)
|
||||||
else:
|
else:
|
||||||
print Line
|
print(Line)
|
||||||
EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
|
EdkLogger.Error("Unicode File Parser", ToolError.FORMAT_INVALID, ExtraData=File.Path)
|
||||||
|
|
||||||
if StrName and not StrName.split()[1].startswith(u'STR_'):
|
if StrName and not StrName.split()[1].startswith(u'STR_'):
|
||||||
|
@ -1022,12 +1023,12 @@ class UniFileClassObject(object):
|
||||||
# Show the instance itself
|
# Show the instance itself
|
||||||
#
|
#
|
||||||
def ShowMe(self):
|
def ShowMe(self):
|
||||||
print self.LanguageDef
|
print(self.LanguageDef)
|
||||||
#print self.OrderedStringList
|
#print self.OrderedStringList
|
||||||
for Item in self.OrderedStringList:
|
for Item in self.OrderedStringList:
|
||||||
print Item
|
print(Item)
|
||||||
for Member in self.OrderedStringList[Item]:
|
for Member in self.OrderedStringList[Item]:
|
||||||
print str(Member)
|
print(str(Member))
|
||||||
|
|
||||||
#
|
#
|
||||||
# Read content from '!include' UNI file
|
# Read content from '!include' UNI file
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
'''
|
'''
|
||||||
DecPomAlignment
|
DecPomAlignment
|
||||||
'''
|
'''
|
||||||
|
from __future__ import print_function
|
||||||
|
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
|
@ -902,47 +903,47 @@ class DecPomAlignment(PackageObject):
|
||||||
# Print all members and their values of Package class
|
# Print all members and their values of Package class
|
||||||
#
|
#
|
||||||
def ShowPackage(self):
|
def ShowPackage(self):
|
||||||
print '\nName =', self.GetName()
|
print('\nName =', self.GetName())
|
||||||
print '\nBaseName =', self.GetBaseName()
|
print('\nBaseName =', self.GetBaseName())
|
||||||
print '\nVersion =', self.GetVersion()
|
print('\nVersion =', self.GetVersion())
|
||||||
print '\nGuid =', self.GetGuid()
|
print('\nGuid =', self.GetGuid())
|
||||||
|
|
||||||
print '\nStandardIncludes = %d ' \
|
print('\nStandardIncludes = %d ' \
|
||||||
% len(self.GetStandardIncludeFileList()),
|
% len(self.GetStandardIncludeFileList()), end=' ')
|
||||||
for Item in self.GetStandardIncludeFileList():
|
for Item in self.GetStandardIncludeFileList():
|
||||||
print Item.GetFilePath(), ' ', Item.GetSupArchList()
|
print(Item.GetFilePath(), ' ', Item.GetSupArchList())
|
||||||
print '\nPackageIncludes = %d \n' \
|
print('\nPackageIncludes = %d \n' \
|
||||||
% len(self.GetPackageIncludeFileList()),
|
% len(self.GetPackageIncludeFileList()), end=' ')
|
||||||
for Item in self.GetPackageIncludeFileList():
|
for Item in self.GetPackageIncludeFileList():
|
||||||
print Item.GetFilePath(), ' ', Item.GetSupArchList()
|
print(Item.GetFilePath(), ' ', Item.GetSupArchList())
|
||||||
|
|
||||||
print '\nGuids =', self.GetGuidList()
|
print('\nGuids =', self.GetGuidList())
|
||||||
for Item in self.GetGuidList():
|
for Item in self.GetGuidList():
|
||||||
print Item.GetCName(), Item.GetGuid(), Item.GetSupArchList()
|
print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
|
||||||
print '\nProtocols =', self.GetProtocolList()
|
print('\nProtocols =', self.GetProtocolList())
|
||||||
for Item in self.GetProtocolList():
|
for Item in self.GetProtocolList():
|
||||||
print Item.GetCName(), Item.GetGuid(), Item.GetSupArchList()
|
print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
|
||||||
print '\nPpis =', self.GetPpiList()
|
print('\nPpis =', self.GetPpiList())
|
||||||
for Item in self.GetPpiList():
|
for Item in self.GetPpiList():
|
||||||
print Item.GetCName(), Item.GetGuid(), Item.GetSupArchList()
|
print(Item.GetCName(), Item.GetGuid(), Item.GetSupArchList())
|
||||||
print '\nLibraryClasses =', self.GetLibraryClassList()
|
print('\nLibraryClasses =', self.GetLibraryClassList())
|
||||||
for Item in self.GetLibraryClassList():
|
for Item in self.GetLibraryClassList():
|
||||||
print Item.GetLibraryClass(), Item.GetRecommendedInstance(), \
|
print(Item.GetLibraryClass(), Item.GetRecommendedInstance(), \
|
||||||
Item.GetSupArchList()
|
Item.GetSupArchList())
|
||||||
print '\nPcds =', self.GetPcdList()
|
print('\nPcds =', self.GetPcdList())
|
||||||
for Item in self.GetPcdList():
|
for Item in self.GetPcdList():
|
||||||
print 'CName=', Item.GetCName(), 'TokenSpaceGuidCName=', \
|
print('CName=', Item.GetCName(), 'TokenSpaceGuidCName=', \
|
||||||
Item.GetTokenSpaceGuidCName(), \
|
Item.GetTokenSpaceGuidCName(), \
|
||||||
'DefaultValue=', Item.GetDefaultValue(), \
|
'DefaultValue=', Item.GetDefaultValue(), \
|
||||||
'ValidUsage=', Item.GetValidUsage(), \
|
'ValidUsage=', Item.GetValidUsage(), \
|
||||||
'SupArchList', Item.GetSupArchList(), \
|
'SupArchList', Item.GetSupArchList(), \
|
||||||
'Token=', Item.GetToken(), 'DatumType=', Item.GetDatumType()
|
'Token=', Item.GetToken(), 'DatumType=', Item.GetDatumType())
|
||||||
|
|
||||||
for Item in self.GetMiscFileList():
|
for Item in self.GetMiscFileList():
|
||||||
print Item.GetName()
|
print(Item.GetName())
|
||||||
for FileObjectItem in Item.GetFileList():
|
for FileObjectItem in Item.GetFileList():
|
||||||
print FileObjectItem.GetURI()
|
print(FileObjectItem.GetURI())
|
||||||
print '****************\n'
|
print('****************\n')
|
||||||
|
|
||||||
## GenPcdDeclaration
|
## GenPcdDeclaration
|
||||||
#
|
#
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
|
@ -66,7 +67,7 @@ def TestTemplate(TestString, TestFunc):
|
||||||
# Close file
|
# Close file
|
||||||
f.close()
|
f.close()
|
||||||
except:
|
except:
|
||||||
print 'Can not create temporary file [%s]!' % Path
|
print('Can not create temporary file [%s]!' % Path)
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
# Call test function to test
|
# Call test function to test
|
||||||
|
@ -279,6 +280,6 @@ if __name__ == '__main__':
|
||||||
unittest.FunctionTestCase(TestDecPcd).runTest()
|
unittest.FunctionTestCase(TestDecPcd).runTest()
|
||||||
unittest.FunctionTestCase(TestDecUserExtension).runTest()
|
unittest.FunctionTestCase(TestDecUserExtension).runTest()
|
||||||
|
|
||||||
print 'All tests passed...'
|
print('All tests passed...')
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
||||||
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
#import Object.Parser.InfObject as InfObject
|
#import Object.Parser.InfObject as InfObject
|
||||||
from Object.Parser.InfCommonObject import CurrentLine
|
from Object.Parser.InfCommonObject import CurrentLine
|
||||||
|
@ -271,7 +272,7 @@ def PrepareTest(String):
|
||||||
TempFile = open (FileName, "w")
|
TempFile = open (FileName, "w")
|
||||||
TempFile.close()
|
TempFile.close()
|
||||||
except:
|
except:
|
||||||
print "File Create Error"
|
print("File Create Error")
|
||||||
CurrentLine = CurrentLine()
|
CurrentLine = CurrentLine()
|
||||||
CurrentLine.SetFileName("Test")
|
CurrentLine.SetFileName("Test")
|
||||||
CurrentLine.SetLineString(Item[0])
|
CurrentLine.SetLineString(Item[0])
|
||||||
|
@ -376,11 +377,11 @@ if __name__ == '__main__':
|
||||||
try:
|
try:
|
||||||
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
|
InfBinariesInstance.SetBinary(Ver = Ver, ArchList = ArchList)
|
||||||
except:
|
except:
|
||||||
print "Test Failed!"
|
print("Test Failed!")
|
||||||
AllPassedFlag = False
|
AllPassedFlag = False
|
||||||
|
|
||||||
if AllPassedFlag :
|
if AllPassedFlag :
|
||||||
print 'All tests passed...'
|
print('All tests passed...')
|
||||||
else:
|
else:
|
||||||
print 'Some unit test failed!'
|
print('Some unit test failed!')
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
# This class is used to retrieve information stored in database and convert them
|
# This class is used to retrieve information stored in database and convert them
|
||||||
# into PlatformBuildClassObject form for easier use for AutoGen.
|
# into PlatformBuildClassObject form for easier use for AutoGen.
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
from Common.StringUtils import *
|
from Common.StringUtils import *
|
||||||
from Common.DataType import *
|
from Common.DataType import *
|
||||||
from Common.Misc import *
|
from Common.Misc import *
|
||||||
|
@ -1373,7 +1374,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
for (skuname,StoreName,PcdGuid,PcdName,PcdValue) in Str_Pcd_Values:
|
for (skuname,StoreName,PcdGuid,PcdName,PcdValue) in Str_Pcd_Values:
|
||||||
str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))
|
str_pcd_obj = S_pcd_set.get((PcdName, PcdGuid))
|
||||||
if str_pcd_obj is None:
|
if str_pcd_obj is None:
|
||||||
print PcdName, PcdGuid
|
print(PcdName, PcdGuid)
|
||||||
raise
|
raise
|
||||||
if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
|
if str_pcd_obj.Type in [self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII],
|
||||||
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
|
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
|
||||||
|
@ -1808,7 +1809,7 @@ class DscBuildData(PlatformBuildClassObject):
|
||||||
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
EdkLogger.error('Build', FORMAT_INVALID, "Invalid value format for %s. From %s Line %d " %
|
||||||
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
|
(".".join((Pcd.TokenSpaceGuidCName, Pcd.TokenCName, FieldName)), FieldList[FieldName][1], FieldList[FieldName][2]))
|
||||||
except:
|
except:
|
||||||
print "error"
|
print("error")
|
||||||
try:
|
try:
|
||||||
Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
|
Value, ValueSize = ParseFieldValue (FieldList[FieldName][0])
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
import time
|
import time
|
||||||
|
@ -1630,7 +1631,7 @@ class DscParser(MetaFileParser):
|
||||||
try:
|
try:
|
||||||
self._ValueList[2] = '|'.join(ValList)
|
self._ValueList[2] = '|'.join(ValList)
|
||||||
except Exception:
|
except Exception:
|
||||||
print ValList
|
print(ValList)
|
||||||
|
|
||||||
def __ProcessComponent(self):
|
def __ProcessComponent(self):
|
||||||
self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
|
self._ValueList[0] = ReplaceMacro(self._ValueList[0], self._Macros)
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import Common.LongFilePathOs as os
|
import Common.LongFilePathOs as os
|
||||||
import re
|
import re
|
||||||
import StringIO
|
import StringIO
|
||||||
|
@ -2195,7 +2196,7 @@ class Build():
|
||||||
toolsFile = os.path.join(FvDir, 'GuidedSectionTools.txt')
|
toolsFile = os.path.join(FvDir, 'GuidedSectionTools.txt')
|
||||||
toolsFile = open(toolsFile, 'wt')
|
toolsFile = open(toolsFile, 'wt')
|
||||||
for guidedSectionTool in guidAttribs:
|
for guidedSectionTool in guidAttribs:
|
||||||
print >> toolsFile, ' '.join(guidedSectionTool)
|
print(' '.join(guidedSectionTool), file=toolsFile)
|
||||||
toolsFile.close()
|
toolsFile.close()
|
||||||
|
|
||||||
## Returns the full path of the tool.
|
## Returns the full path of the tool.
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
from __future__ import print_function
|
||||||
## @file
|
## @file
|
||||||
# Utility functions and classes for BaseTools unit tests
|
# Utility functions and classes for BaseTools unit tests
|
||||||
#
|
#
|
||||||
|
@ -91,9 +92,9 @@ class BaseToolsTest(unittest.TestCase):
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
|
|
||||||
def DisplayBinaryData(self, description, data):
|
def DisplayBinaryData(self, description, data):
|
||||||
print description, '(base64 encoded):'
|
print(description, '(base64 encoded):')
|
||||||
b64data = base64.b64encode(data)
|
b64data = base64.b64encode(data)
|
||||||
print b64data
|
print(b64data)
|
||||||
|
|
||||||
def DisplayFile(self, fileName):
|
def DisplayFile(self, fileName):
|
||||||
sys.stdout.write(self.ReadTmpFile(fileName))
|
sys.stdout.write(self.ReadTmpFile(fileName))
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
##
|
##
|
||||||
# Import Modules
|
# Import Modules
|
||||||
#
|
#
|
||||||
|
from __future__ import print_function
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
import sys
|
import sys
|
||||||
|
@ -52,8 +53,8 @@ class Tests(TestTools.BaseToolsTest):
|
||||||
finish = self.ReadTmpFile('output2')
|
finish = self.ReadTmpFile('output2')
|
||||||
startEqualsFinish = start == finish
|
startEqualsFinish = start == finish
|
||||||
if not startEqualsFinish:
|
if not startEqualsFinish:
|
||||||
print
|
print()
|
||||||
print 'Original data did not match decompress(compress(data))'
|
print('Original data did not match decompress(compress(data))')
|
||||||
self.DisplayBinaryData('original data', start)
|
self.DisplayBinaryData('original data', start)
|
||||||
self.DisplayBinaryData('after compression', self.ReadTmpFile('output1'))
|
self.DisplayBinaryData('after compression', self.ReadTmpFile('output1'))
|
||||||
self.DisplayBinaryData('after decomression', finish)
|
self.DisplayBinaryData('after decomression', finish)
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
||||||
|
from __future__ import print_function
|
||||||
from optparse import OptionParser
|
from optparse import OptionParser
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
@ -34,7 +35,7 @@ if sys.version_info < (2, 5):
|
||||||
#
|
#
|
||||||
# This script (and edk2 BaseTools) require Python 2.5 or newer
|
# This script (and edk2 BaseTools) require Python 2.5 or newer
|
||||||
#
|
#
|
||||||
print 'Python version 2.5 or later is required.'
|
print('Python version 2.5 or later is required.')
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -146,37 +147,37 @@ class Config:
|
||||||
if not self.options.skip_gcc:
|
if not self.options.skip_gcc:
|
||||||
building.append('gcc')
|
building.append('gcc')
|
||||||
if len(building) == 0:
|
if len(building) == 0:
|
||||||
print "Nothing will be built!"
|
print("Nothing will be built!")
|
||||||
print
|
print()
|
||||||
print "Please try using --help and then change the configuration."
|
print("Please try using --help and then change the configuration.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print "Current directory:"
|
print("Current directory:")
|
||||||
print " ", self.base_dir
|
print(" ", self.base_dir)
|
||||||
print "Sources download/extraction:", self.Relative(self.src_dir)
|
print("Sources download/extraction:", self.Relative(self.src_dir))
|
||||||
print "Build directory :", self.Relative(self.build_dir)
|
print("Build directory :", self.Relative(self.build_dir))
|
||||||
print "Prefix (install) directory :", self.Relative(self.prefix)
|
print("Prefix (install) directory :", self.Relative(self.prefix))
|
||||||
print "Create symlinks directory :", self.Relative(self.symlinks)
|
print("Create symlinks directory :", self.Relative(self.symlinks))
|
||||||
print "Building :", ', '.join(building)
|
print("Building :", ', '.join(building))
|
||||||
print
|
print()
|
||||||
answer = raw_input("Is this configuration ok? (default = no): ")
|
answer = raw_input("Is this configuration ok? (default = no): ")
|
||||||
if (answer.lower() not in ('y', 'yes')):
|
if (answer.lower() not in ('y', 'yes')):
|
||||||
print
|
print()
|
||||||
print "Please try using --help and then change the configuration."
|
print("Please try using --help and then change the configuration.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if self.arch.lower() == 'ipf':
|
if self.arch.lower() == 'ipf':
|
||||||
print
|
print()
|
||||||
print 'Please note that the IPF compiler built by this script has'
|
print('Please note that the IPF compiler built by this script has')
|
||||||
print 'not yet been validated!'
|
print('not yet been validated!')
|
||||||
print
|
print()
|
||||||
answer = raw_input("Are you sure you want to build it? (default = no): ")
|
answer = raw_input("Are you sure you want to build it? (default = no): ")
|
||||||
if (answer.lower() not in ('y', 'yes')):
|
if (answer.lower() not in ('y', 'yes')):
|
||||||
print
|
print()
|
||||||
print "Please try using --help and then change the configuration."
|
print("Please try using --help and then change the configuration.")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
print
|
print()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def Relative(self, path):
|
def Relative(self, path):
|
||||||
|
@ -275,7 +276,7 @@ class SourceFiles:
|
||||||
wDots = (100 * received * blockSize) / fileSize / 10
|
wDots = (100 * received * blockSize) / fileSize / 10
|
||||||
if wDots > self.dots:
|
if wDots > self.dots:
|
||||||
for i in range(wDots - self.dots):
|
for i in range(wDots - self.dots):
|
||||||
print '.',
|
print('.', end=' ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
self.dots += 1
|
self.dots += 1
|
||||||
|
|
||||||
|
@ -286,18 +287,18 @@ class SourceFiles:
|
||||||
self.dots = 0
|
self.dots = 0
|
||||||
local_file = os.path.join(self.config.src_dir, fdata['filename'])
|
local_file = os.path.join(self.config.src_dir, fdata['filename'])
|
||||||
url = fdata['url']
|
url = fdata['url']
|
||||||
print 'Downloading %s:' % fname, url
|
print('Downloading %s:' % fname, url)
|
||||||
if retries > 0:
|
if retries > 0:
|
||||||
print '(retry)',
|
print('(retry)', end=' ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
|
|
||||||
completed = False
|
completed = False
|
||||||
if os.path.exists(local_file):
|
if os.path.exists(local_file):
|
||||||
md5_pass = self.checkHash(fdata)
|
md5_pass = self.checkHash(fdata)
|
||||||
if md5_pass:
|
if md5_pass:
|
||||||
print '[md5 match]',
|
print('[md5 match]', end=' ')
|
||||||
else:
|
else:
|
||||||
print '[md5 mismatch]',
|
print('[md5 mismatch]', end=' ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
completed = md5_pass
|
completed = md5_pass
|
||||||
|
|
||||||
|
@ -313,32 +314,32 @@ class SourceFiles:
|
||||||
if not completed and os.path.exists(local_file):
|
if not completed and os.path.exists(local_file):
|
||||||
md5_pass = self.checkHash(fdata)
|
md5_pass = self.checkHash(fdata)
|
||||||
if md5_pass:
|
if md5_pass:
|
||||||
print '[md5 match]',
|
print('[md5 match]', end=' ')
|
||||||
else:
|
else:
|
||||||
print '[md5 mismatch]',
|
print('[md5 mismatch]', end=' ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
completed = md5_pass
|
completed = md5_pass
|
||||||
|
|
||||||
if completed:
|
if completed:
|
||||||
print '[done]'
|
print('[done]')
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print '[failed]'
|
print('[failed]')
|
||||||
print ' Tried to retrieve', url
|
print(' Tried to retrieve', url)
|
||||||
print ' to', local_file
|
print(' to', local_file)
|
||||||
print 'Possible fixes:'
|
print('Possible fixes:')
|
||||||
print '* If you are behind a web-proxy, try setting the',
|
print('* If you are behind a web-proxy, try setting the', end=' ')
|
||||||
print 'http_proxy environment variable'
|
print('http_proxy environment variable')
|
||||||
print '* You can try to download this file separately',
|
print('* You can try to download this file separately', end=' ')
|
||||||
print 'and rerun this script'
|
print('and rerun this script')
|
||||||
raise Exception()
|
raise Exception()
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
print '[KeyboardInterrupt]'
|
print('[KeyboardInterrupt]')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print(e)
|
||||||
|
|
||||||
if not completed: return False
|
if not completed: return False
|
||||||
|
|
||||||
|
@ -396,7 +397,7 @@ class Extracter:
|
||||||
extractedMd5 = open(extracted).read()
|
extractedMd5 = open(extracted).read()
|
||||||
|
|
||||||
if extractedMd5 != moduleMd5:
|
if extractedMd5 != moduleMd5:
|
||||||
print 'Extracting %s:' % self.config.Relative(local_file)
|
print('Extracting %s:' % self.config.Relative(local_file))
|
||||||
tar = tarfile.open(local_file)
|
tar = tarfile.open(local_file)
|
||||||
tar.extractall(extractDst)
|
tar.extractall(extractDst)
|
||||||
open(extracted, 'w').write(moduleMd5)
|
open(extracted, 'w').write(moduleMd5)
|
||||||
|
@ -480,7 +481,7 @@ class Builder:
|
||||||
|
|
||||||
os.chdir(base_dir)
|
os.chdir(base_dir)
|
||||||
|
|
||||||
print '%s module is now built and installed' % module
|
print('%s module is now built and installed' % module)
|
||||||
|
|
||||||
def RunCommand(self, cmd, module, stage, skipable=False):
|
def RunCommand(self, cmd, module, stage, skipable=False):
|
||||||
if skipable:
|
if skipable:
|
||||||
|
@ -495,13 +496,13 @@ class Builder:
|
||||||
stderr=subprocess.STDOUT
|
stderr=subprocess.STDOUT
|
||||||
)
|
)
|
||||||
|
|
||||||
print '%s [%s] ...' % (module, stage),
|
print('%s [%s] ...' % (module, stage), end=' ')
|
||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
p = popen(cmd)
|
p = popen(cmd)
|
||||||
output = p.stdout.read()
|
output = p.stdout.read()
|
||||||
p.wait()
|
p.wait()
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print '[failed!]'
|
print('[failed!]')
|
||||||
logFile = os.path.join(self.config.build_dir, 'log.txt')
|
logFile = os.path.join(self.config.build_dir, 'log.txt')
|
||||||
f = open(logFile, "w")
|
f = open(logFile, "w")
|
||||||
f.write(output)
|
f.write(output)
|
||||||
|
@ -509,7 +510,7 @@ class Builder:
|
||||||
raise Exception, 'Failed to %s %s\n' % (stage, module) + \
|
raise Exception, 'Failed to %s %s\n' % (stage, module) + \
|
||||||
'See output log at %s' % self.config.Relative(logFile)
|
'See output log at %s' % self.config.Relative(logFile)
|
||||||
else:
|
else:
|
||||||
print '[done]'
|
print('[done]')
|
||||||
|
|
||||||
if skipable:
|
if skipable:
|
||||||
self.MarkBuildStepComplete('%s.%s' % (module, stage))
|
self.MarkBuildStepComplete('%s.%s' % (module, stage))
|
||||||
|
@ -526,13 +527,13 @@ class Builder:
|
||||||
linkdst = os.path.join(links_dir, link)
|
linkdst = os.path.join(links_dir, link)
|
||||||
if not os.path.lexists(linkdst):
|
if not os.path.lexists(linkdst):
|
||||||
if not startPrinted:
|
if not startPrinted:
|
||||||
print 'Making symlinks in %s:' % self.config.Relative(links_dir),
|
print('Making symlinks in %s:' % self.config.Relative(links_dir), end=' ')
|
||||||
startPrinted = True
|
startPrinted = True
|
||||||
print link,
|
print(link, end=' ')
|
||||||
os.symlink(src, linkdst)
|
os.symlink(src, linkdst)
|
||||||
|
|
||||||
if startPrinted:
|
if startPrinted:
|
||||||
print '[done]'
|
print('[done]')
|
||||||
|
|
||||||
class App:
|
class App:
|
||||||
"""class App
|
"""class App
|
||||||
|
@ -551,9 +552,9 @@ class App:
|
||||||
sources = SourceFiles(config)
|
sources = SourceFiles(config)
|
||||||
result = sources.GetAll()
|
result = sources.GetAll()
|
||||||
if result:
|
if result:
|
||||||
print 'All files have been downloaded & verified'
|
print('All files have been downloaded & verified')
|
||||||
else:
|
else:
|
||||||
print 'An error occured while downloading a file'
|
print('An error occured while downloading a file')
|
||||||
return
|
return
|
||||||
|
|
||||||
Extracter(sources, config).ExtractAll()
|
Extracter(sources, config).ExtractAll()
|
||||||
|
|
Loading…
Reference in New Issue