[Lldb-commits] [lldb] r250762 - Run py2to3 on lldb/scripts folder.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Mon Oct 19 16:45:25 PDT 2015


Author: zturner
Date: Mon Oct 19 18:45:25 2015
New Revision: 250762

URL: http://llvm.org/viewvc/llvm-project?rev=250762&view=rev
Log:
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.

Modified:
    lldb/trunk/scripts/Python/buildSwigPython.py
    lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
    lldb/trunk/scripts/buildSwigWrapperClasses.py
    lldb/trunk/scripts/finishSwigWrapperClasses.py
    lldb/trunk/scripts/utilsArgsParse.py
    lldb/trunk/scripts/utilsDebug.py

Modified: lldb/trunk/scripts/Python/buildSwigPython.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/buildSwigPython.py?rev=250762&r1=250761&r2=250762&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/buildSwigPython.py (original)
+++ lldb/trunk/scripts/Python/buildSwigPython.py Mon Oct 19 18:45:25 2015
@@ -256,7 +256,7 @@ def check_file_exists( vDictArgs, vstrFi
 	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_platf
 		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, vstrSwig
 	strCmd += "-o \"%s\" " % strOp;
 	strCmd += "\"%s\" " % strIp;
 	if bDbg:
-		print(strMsgSwigExecute % strCmd);
+		print((strMsgSwigExecute % strCmd));
 
 	# Execute SWIG
 	process = subprocess.Popen( strCmd, stdout=subprocess.PIPE, 

Modified: lldb/trunk/scripts/Python/finishSwigPythonLLDB.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/finishSwigPythonLLDB.py?rev=250762&r1=250761&r2=250762&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/finishSwigPythonLLDB.py (original)
+++ lldb/trunk/scripts/Python/finishSwigPythonLLDB.py Mon Oct 19 18:45:25 2015
@@ -140,13 +140,13 @@ def create_py_pkg( vDictArgs, vstrFramew
 
     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, vstrFramew
     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( vD
 
     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( vD
 # 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, vstrFramewo
     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
 
     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_platf
         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 );

Modified: lldb/trunk/scripts/buildSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/buildSwigWrapperClasses.py?rev=250762&r1=250761&r2=250762&view=diff
==============================================================================
--- lldb/trunk/scripts/buildSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/buildSwigWrapperClasses.py Mon Oct 19 18:45:25 2015
@@ -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, vSwigBuild
         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 );

Modified: lldb/trunk/scripts/finishSwigWrapperClasses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/finishSwigWrapperClasses.py?rev=250762&r1=250761&r2=250762&view=diff
==============================================================================
--- lldb/trunk/scripts/finishSwigWrapperClasses.py (original)
+++ lldb/trunk/scripts/finishSwigWrapperClasses.py Mon Oct 19 18:45:25 2015
@@ -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, vs
         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 );

Modified: lldb/trunk/scripts/utilsArgsParse.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/utilsArgsParse.py?rev=250762&r1=250761&r2=250762&view=diff
==============================================================================
--- lldb/trunk/scripts/utilsArgsParse.py (original)
+++ lldb/trunk/scripts/utilsArgsParse.py Mon Oct 19 18:45:25 2015
@@ -87,7 +87,7 @@ def parse( vArgv, vstrListArgs, vListLon
 	
 	# 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;
 	

Modified: lldb/trunk/scripts/utilsDebug.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/utilsDebug.py?rev=250762&r1=250761&r2=250762&view=diff
==============================================================================
--- lldb/trunk/scripts/utilsDebug.py (original)
+++ lldb/trunk/scripts/utilsDebug.py Mon Oct 19 18:45:25 2015
@@ -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




More information about the lldb-commits mailing list