Run py2to3 on lldb/scripts folder.

This mostly fixes some print statements, but there were also some
instances of dict.iteritems() lingering that this found.

llvm-svn: 250762
This commit is contained in:
Zachary Turner 2015-10-19 23:45:25 +00:00
parent 0b98b27677
commit 1756e05688
6 changed files with 36 additions and 36 deletions

View File

@ -256,7 +256,7 @@ def check_file_exists( vDictArgs, vstrFileNamePath ):
if os.path.exists( vstrFileNamePath ):
bExists = True;
elif bDebug:
print(strMsgFileNotExist % vstrFileNamePath);
print((strMsgFileNotExist % vstrFileNamePath));
return bExists;
@ -368,7 +368,7 @@ def get_framework_python_dir_other_platforms( vDictArgs ):
strWkDir += "/LLDB.framework";
if os.path.exists( strWkDir ):
if bDbg:
print(strMsgFoundLldbFrameWkDir % strWkDir);
print((strMsgFoundLldbFrameWkDir % strWkDir));
strWkDir += "/Resources/Python/lldb";
strWkDir = os.path.normcase( strWkDir );
else:
@ -502,7 +502,7 @@ def do_swig_rebuild( vDictArgs, vstrSwigDepFile, vstrCfgBldDir,
strCmd += "-o \"%s\" " % strOp;
strCmd += "\"%s\" " % strIp;
if bDbg:
print(strMsgSwigExecute % strCmd);
print((strMsgSwigExecute % strCmd));
# Execute SWIG
process = subprocess.Popen( strCmd, stdout=subprocess.PIPE,

View File

@ -140,13 +140,13 @@ def create_py_pkg( vDictArgs, vstrFrameworkPythonDir, vstrPkgDir, vListPkgFiles
if not(os.path.exists( strPkgDir ) and os.path.isdir( strPkgDir )):
if bDbg:
print(strMsgCreatePyPkgMkDir % strPkgDir);
print((strMsgCreatePyPkgMkDir % strPkgDir));
os.makedirs( strPkgDir );
for strPkgFile in vListPkgFiles:
if os.path.exists( strPkgFile ) and os.path.isfile( strPkgFile ):
if bDbg:
print(strMsgCreatePyPkgCopyPkgFile % (strPkgFile, strPkgDir));
print((strMsgCreatePyPkgCopyPkgFile % (strPkgFile, strPkgDir)));
shutil.copy( strPkgFile, strPkgDir );
# Create a packet init files if there wasn't one
@ -169,7 +169,7 @@ def create_py_pkg( vDictArgs, vstrFrameworkPythonDir, vstrPkgDir, vListPkgFiles
strPyScript += "\t__import__('%s.' + x)" % strPkgName;
if bDbg:
print(strMsgCreatePyPkgInitFile % strPkgIniFile);
print((strMsgCreatePyPkgInitFile % strPkgIniFile));
file = open( strPkgIniFile, "w" );
file.write( strPyScript );
file.close();
@ -203,7 +203,7 @@ def copy_lldbpy_file_to_lldb_pkg_dir( vDictArgs, vstrFrameworkPythonDir, vstrCfg
try:
if bDbg:
print(strMsgCopyLLDBPy % (strSrc, strDst));
print((strMsgCopyLLDBPy % (strSrc, strDst)));
shutil.copyfile( strSrc, strDst );
except IOError as e:
bOk = False;
@ -225,7 +225,7 @@ def copy_lldbpy_file_to_lldb_pkg_dir( vDictArgs, vstrFrameworkPythonDir, vstrCfg
# Throws: None.
#--
def make_symlink_windows( vstrSrcPath, vstrTargetPath ):
print("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath));
print(("Making symlink from %s to %s" % (vstrSrcPath, vstrTargetPath)));
dbg = utilsDebug.CDebugFnVerbose( "Python script make_symlink_windows()" );
bOk = True;
strErrMsg = "";
@ -313,19 +313,19 @@ def make_symlink( vDictArgs, vstrFrameworkPythonDir, vstrSrcFile, vstrTargetFile
elif eOSType == utilsOsType.EnumOsType.Windows:
if os.path.isfile( strTarget ):
if bDbg:
print(strMsgSymlinkExists % vstrTargetFile);
print((strMsgSymlinkExists % vstrTargetFile));
return (bOk, strErrMsg);
if bDbg:
print(strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget));
print((strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget)));
bOk, strErrMsg = make_symlink_windows( strSrc,
strTarget );
else:
if os.path.islink( strTarget ):
if bDbg:
print(strMsgSymlinkExists % vstrTargetFile);
print((strMsgSymlinkExists % vstrTargetFile));
return (bOk, strErrMsg);
if bDbg:
print(strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget));
print((strMsgSymlinkMk % (vstrTargetFile, strSrc, strTarget)));
bOk, strErrMsg = make_symlink_other_platforms( strSrc,
strTarget );
@ -498,11 +498,11 @@ def find_or_create_python_dir( vDictArgs, vstrFrameworkPythonDir ):
if os.path.isdir( vstrFrameworkPythonDir ):
if bDbg:
print(strMsgFrameWkPyExists % vstrFrameworkPythonDir);
print((strMsgFrameWkPyExists % vstrFrameworkPythonDir));
return (bOk, strMsg);
if bDbg:
print(strMsgFrameWkPyMkDir % vstrFrameworkPythonDir);
print((strMsgFrameWkPyMkDir % vstrFrameworkPythonDir));
try:
os.makedirs( vstrFrameworkPythonDir );
@ -601,7 +601,7 @@ def get_framework_python_dir_other_platforms( vDictArgs ):
strWkDir += os.path.join(strWkDir, "LLDB.framework");
if os.path.exists( strWkDir ):
if bDbg:
print(strMsgFoundLldbFrameWkDir % strWkDir);
print((strMsgFoundLldbFrameWkDir % strWkDir));
strWkDir = os.path.join(strWkDir, "Resources", "Python", "lldb");
strWkDir = os.path.normcase( strWkDir );
else:
@ -680,16 +680,16 @@ def main( vDictArgs ):
eOSType = utilsOsType.determine_os_type();
if bDbg:
pyVersion = sys.version_info;
print(strMsgOsVersion % utilsOsType.EnumOsType.name_of( eOSType ));
print(strMsgPyVersion % (pyVersion[ 0 ], pyVersion[ 1 ]));
print((strMsgOsVersion % utilsOsType.EnumOsType.name_of( eOSType )));
print((strMsgPyVersion % (pyVersion[ 0 ], pyVersion[ 1 ])));
bOk, strFrameworkPythonDir, strMsg = get_framework_python_dir( vDictArgs );
if bOk:
bOk, strCfgBldDir, strMsg = get_config_build_dir( vDictArgs, strFrameworkPythonDir );
if bOk and bDbg:
print(strMsgPyFileLocatedHere % strFrameworkPythonDir);
print(strMsgConfigBuildDir % strCfgBldDir);
print((strMsgPyFileLocatedHere % strFrameworkPythonDir));
print((strMsgConfigBuildDir % strCfgBldDir));
if bOk:
bOk, strMsg = find_or_create_python_dir( vDictArgs, strFrameworkPythonDir );

View File

@ -139,7 +139,7 @@ def program_exit_success( vnResult, vMsg ):
# Throws: None.
#--
def program_exit_on_failure( vnResult, vMsg ):
print("%s%s (%d)" % (strExitMsgError, vMsg, vnResult));
print(("%s%s (%d)" % (strExitMsgError, vMsg, vnResult)));
sys.exit( vnResult );
#++---------------------------------------------------------------------------
@ -164,13 +164,13 @@ def program_exit( vnResult, vMsg ):
# Throws: None.
#--
def print_out_input_parameters( vDictArgs ):
for arg, val in vDictArgs.iteritems():
for arg, val in vDictArgs.items():
strEqs = "";
strQ = "";
if val.__len__() != 0:
strEqs = " =";
strQ = "\"";
print("%s%s%s %s%s%s\n" % (strParameter, arg, strEqs, strQ, val, strQ));
print(("%s%s%s %s%s%s\n" % (strParameter, arg, strEqs, strQ, val, strQ)));
#++---------------------------------------------------------------------------
# Details: Locate the lldb.swig file. No checking for path correctness is
@ -227,8 +227,8 @@ def run_swig( vStrScriptLang, vSwigBuildFileName, vDictArgs ):
return (-9, strStatusMsg);
if gbDbgFlag:
print(strSwigScriptLangFound % vStrScriptLang);
print(strSwigExecuteMsg % vStrScriptLang);
print((strSwigScriptLangFound % vStrScriptLang));
print((strSwigExecuteMsg % vStrScriptLang));
# Change where Python looks for our modules
strDir = os.path.normcase( strScriptFileDir );

View File

@ -110,7 +110,7 @@ def program_exit_success( vnResult, vMsg ):
# Throws: None.
#--
def program_exit_on_failure( vnResult, vMsg ):
print("%s%s (%d)" % (strExitMsgError, vMsg, vnResult));
print(("%s%s (%d)" % (strExitMsgError, vMsg, vnResult)));
sys.exit( vnResult );
#++---------------------------------------------------------------------------
@ -135,13 +135,13 @@ def program_exit( vnResult, vMsg ):
# Throws: None.
#--
def print_out_input_parameters( vDictArgs ):
for arg, val in vDictArgs.iteritems():
for arg, val in list(vDictArgs.items()):
strEqs = "";
strQ = "";
if val.__len__() != 0:
strEqs = " =";
strQ = "\"";
print("%s%s%s %s%s%s\n" % (strParameter, arg, strEqs, strQ, val, strQ));
print(("%s%s%s %s%s%s\n" % (strParameter, arg, strEqs, strQ, val, strQ)));
#++---------------------------------------------------------------------------
# Details: Validate the arguments passed to the program. This function exits
@ -210,8 +210,8 @@ def run_post_process( vStrScriptLang, vstrFinishFileName, vDictArgs ):
return (-9, strStatusMsg);
if gbDbgFlag:
print(strScriptLangFound % vStrScriptLang);
print(strExecuteMsg % vStrScriptLang);
print((strScriptLangFound % vStrScriptLang));
print((strExecuteMsg % vStrScriptLang));
# Change where Python looks for our modules
strDir = os.path.normcase( strScriptFileDir );

View File

@ -87,7 +87,7 @@ def parse( vArgv, vstrListArgs, vListLongArgs, vDictArgReq, vstrHelpInfo ):
# Count the number of mandatory args required (if any one found)
countMandatory = 0;
for opt, man in vDictArgReq.items():
for opt, man in list(vDictArgReq.items()):
if man == "m":
countMandatory = countMandatory + 1;

View File

@ -69,8 +69,8 @@ class CDebugFnVerbose:
def dump_text( self, vstrText ):
if CDebugFnVerbose.bVerboseOn == False:
return;
print("%d%s> Dp: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(),
vstrText));
print(("%d%s> Dp: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(),
vstrText)));
# Private methods:
def __init__( self, vstrFnName ):
@ -100,8 +100,8 @@ class CDebugFnVerbose:
#--
def __indent_back( self ):
if CDebugFnVerbose.bVerboseOn:
print("%d%s< fn: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(),
self.__strFnName));
print(("%d%s< fn: %s" % (CDebugFnVerbose.__nLevel, self.__get_dots(),
self.__strFnName)));
CDebugFnVerbose.__nLevel -= 1;
#++------------------------------------------------------------------------
@ -116,8 +116,8 @@ class CDebugFnVerbose:
CDebugFnVerbose.__nLevel += 1;
self.__strFnName = vstrFnName;
if CDebugFnVerbose.bVerboseOn:
print("%d%s> fn: %s" % ( CDebugFnVerbose.__nLevel, self.__get_dots(),
self.__strFnName));
print(("%d%s> fn: %s" % ( CDebugFnVerbose.__nLevel, self.__get_dots(),
self.__strFnName)));
# Private statics attributes:
__nLevel = 0; # Indentation level counter