upgrade to python 3.x 63/274363/1
authortangkaiyuan <kaiyuan.tang@samsung.com>
Wed, 27 Apr 2022 06:00:48 +0000 (14:00 +0800)
committertangkaiyuan <kaiyuan.tang@samsung.com>
Wed, 27 Apr 2022 06:00:59 +0000 (14:00 +0800)
Change-Id: I32fb29182073328ba7c2cf7ad3e969f4cebf83d2
Signed-off-by: tangkaiyuan <kaiyuan.tang@samsung.com>
73 files changed:
common/tct-ext01-wrt-tests/inst.apk.py
common/tct-ext01-wrt-tests/inst.wgt.py
common/tct-ext01-wrt-tests/inst.xpk.py
common/tct-ext01-wrt-tests/pack.py
common/tct-ext02-wrt-tests/inst.apk.py
common/tct-ext02-wrt-tests/inst.wgt.py
common/tct-ext02-wrt-tests/inst.xpk.py
common/tct-ext02-wrt-tests/pack.py
common/tct-imeconfig-wrt-tests/inst.apk.py
common/tct-imeconfig-wrt-tests/inst.wgt.py
common/tct-imeconfig-wrt-tests/inst.xpk.py
common/tct-imeconfig-wrt-tests/pack.py
common/tct-pm-wrt-tests/inst.apk.py
common/tct-pm-wrt-tests/inst.wgt.py
common/tct-pm-wrt-tests/inst.xpk.py
common/tct-pm-wrt-tests/pack.py
common/tct-privilege-wrt-tests/inst.apk.py
common/tct-privilege-wrt-tests/inst.wgt.py
common/tct-privilege-wrt-tests/inst.xpk.py
common/tct-privilege-wrt-tests/pack.py
common/tct-rt01-wrt-tests/inst.apk.py
common/tct-rt01-wrt-tests/inst.wgt.py
common/tct-rt01-wrt-tests/inst.xpk.py
common/tct-rt01-wrt-tests/pack.py
common/tct-rt02-wrt-tests/inst.apk.py
common/tct-rt02-wrt-tests/inst.wgt.py
common/tct-rt02-wrt-tests/inst.xpk.py
common/tct-rt02-wrt-tests/pack.py
common/tct-sp01-wrt-tests/inst.apk.py
common/tct-sp01-wrt-tests/inst.wgt.py
common/tct-sp01-wrt-tests/inst.xpk.py
common/tct-sp01-wrt-tests/pack.py
common/tct-sp02-wrt-tests/inst.apk.py
common/tct-sp02-wrt-tests/inst.wgt.py
common/tct-sp02-wrt-tests/inst.xpk.py
common/tct-sp02-wrt-tests/pack.py
common/tct-stab-wrt-tests/inst.apk.py
common/tct-stab-wrt-tests/inst.wgt.py
common/tct-stab-wrt-tests/inst.xpk.py
common/tct-stab-wrt-tests/pack.py
common/tct-ui01-wrt-tests/inst.apk.py
common/tct-ui01-wrt-tests/inst.wgt.py
common/tct-ui01-wrt-tests/inst.xpk.py
common/tct-ui01-wrt-tests/pack.py
ivi/tct-ext01-wrt-tests/inst.apk.py
ivi/tct-ext01-wrt-tests/inst.wgt.py
ivi/tct-ext01-wrt-tests/inst.xpk.py
ivi/tct-ext02-wrt-tests/inst.apk.py
ivi/tct-ext02-wrt-tests/inst.wgt.py
ivi/tct-ext02-wrt-tests/inst.xpk.py
ivi/tct-pm-wrt-tests/inst.apk.py
ivi/tct-pm-wrt-tests/inst.wgt.py
ivi/tct-pm-wrt-tests/inst.xpk.py
ivi/tct-rt01-wrt-tests/inst.apk.py
ivi/tct-rt01-wrt-tests/inst.wgt.py
ivi/tct-rt01-wrt-tests/inst.xpk.py
ivi/tct-sp01-wrt-tests/inst.apk.py
ivi/tct-sp01-wrt-tests/inst.wgt.py
ivi/tct-sp01-wrt-tests/inst.xpk.py
ivi/tct-sp02-wrt-tests/inst.apk.py
ivi/tct-sp02-wrt-tests/inst.wgt.py
ivi/tct-sp02-wrt-tests/inst.xpk.py
ivi/tct-sp03-wrt-tests/inst.apk.py
ivi/tct-sp03-wrt-tests/inst.wgt.py
ivi/tct-sp03-wrt-tests/inst.xpk.py
ivi/tct-ui01-wrt-tests/inst.apk.py
ivi/tct-ui01-wrt-tests/inst.wgt.py
ivi/tct-ui01-wrt-tests/inst.xpk.py
tools/build/pack.py
tools/coverage/stats.py
tools/xml/csv2xml.py
tools/xml/xml2csv.py
tools/xml/xmlverifier.py

index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..d636bee034d8504fbfee33e3d6fe297f4e9bee1a 100755 (executable)
@@ -6,8 +6,8 @@ import glob
 import time
 import sys
 import subprocess
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index c4a5984dcc406a49449396e541abcc8fbdda049b..03de68a06f0f83a4b04adeaed6789adcc529cfe4 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -32,14 +32,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -179,8 +179,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -199,7 +199,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..1e6b799087b3266ca391beca12866af0e77adb71 100755 (executable)
@@ -7,8 +7,8 @@ import time
 import sys
 import subprocess
 import string
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..997d98f378383bf25adb2e29457b44aa19b30eae 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 44e6c991851660dac2f6eedfff63607ebfa53744..3af23c68c4a749f866f51ae2a8b638b49d07b58d 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 USER_DIR = tct_parser.get('DEVICE', 'DEVICE_USER_30')
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -196,8 +196,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -216,7 +216,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -228,10 +228,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..2f0e80305e5890b794ce01bc894781862d6e600e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index d5f9fbb96f7b82ebce4068b79598df34023b9b0f..d636bee034d8504fbfee33e3d6fe297f4e9bee1a 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 31bd49daf1cf07d1034d4ddecdae69a9e93129bf..1c685e3578706576a0adeb5b84b7c9326188d06e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -195,8 +195,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -215,7 +215,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -227,10 +227,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index f70351a9bca5ce6c87032da6adacd41a268563bc..ace8cbba96610eaf7e44d169716ce4fc3b921873 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -183,8 +183,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -203,7 +203,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -213,10 +213,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..997d98f378383bf25adb2e29457b44aa19b30eae 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index ba86fdf55dda55fb4005d4c35fda981eafb4006c..3878b88fa8b615c8b98eb5831db09af78b12bb87 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -195,8 +195,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -215,7 +215,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -227,10 +227,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..2f0e80305e5890b794ce01bc894781862d6e600e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..997d98f378383bf25adb2e29457b44aa19b30eae 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 31bd49daf1cf07d1034d4ddecdae69a9e93129bf..1c685e3578706576a0adeb5b84b7c9326188d06e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -195,8 +195,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -215,7 +215,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -227,10 +227,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..2f0e80305e5890b794ce01bc894781862d6e600e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..d636bee034d8504fbfee33e3d6fe297f4e9bee1a 100755 (executable)
@@ -6,8 +6,8 @@ import glob
 import time
 import sys
 import subprocess
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 2c16cb57be8f28c6c58319de52d6bd76bb9a875e..d4f6ce479557997082e5fbfa6d2efd3647add616 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -186,8 +186,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -206,7 +206,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -218,10 +218,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..1e6b799087b3266ca391beca12866af0e77adb71 100755 (executable)
@@ -7,8 +7,8 @@ import time
 import sys
 import subprocess
 import string
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..997d98f378383bf25adb2e29457b44aa19b30eae 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 31bd49daf1cf07d1034d4ddecdae69a9e93129bf..1c685e3578706576a0adeb5b84b7c9326188d06e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -195,8 +195,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -215,7 +215,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -227,10 +227,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..2f0e80305e5890b794ce01bc894781862d6e600e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..d636bee034d8504fbfee33e3d6fe297f4e9bee1a 100755 (executable)
@@ -6,8 +6,8 @@ import glob
 import time
 import sys
 import subprocess
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 4d18fa9461097371bfd98c6456089d0d9cf4d176..a7ad4eeb25788d2736eaf804131fb1116b555561 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -180,8 +180,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -200,7 +200,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
     
     userCheck()
@@ -212,10 +212,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..1e6b799087b3266ca391beca12866af0e77adb71 100755 (executable)
@@ -7,8 +7,8 @@ import time
 import sys
 import subprocess
 import string
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..d636bee034d8504fbfee33e3d6fe297f4e9bee1a 100755 (executable)
@@ -6,8 +6,8 @@ import glob
 import time
 import sys
 import subprocess
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index c33fe4085ac57475a036d72c3e18395d000b8a86..01e7e6d18aa80d2fc90fef7f8b097a18e598f04a 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -195,8 +195,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -215,7 +215,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
     
     userCheck()
@@ -227,10 +227,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..1e6b799087b3266ca391beca12866af0e77adb71 100755 (executable)
@@ -7,8 +7,8 @@ import time
 import sys
 import subprocess
 import string
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..997d98f378383bf25adb2e29457b44aa19b30eae 100755 (executable)
@@ -7,7 +7,7 @@ import time
 import sys
 import subprocess
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 8781fd7009b16746fd2620436b94bbbdba759a5d..07a8aded576b9164656ae65c7d04759d1ccd22d1 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -33,14 +33,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -195,8 +195,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -215,7 +215,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
     
     userCheck()
@@ -227,10 +227,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..2f0e80305e5890b794ce01bc894781862d6e600e 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option\r
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index 31210db162ff0d25d19c69d63e5de2a6f552b4e7..d636bee034d8504fbfee33e3d6fe297f4e9bee1a 100755 (executable)
@@ -6,8 +6,8 @@ import glob
 import time
 import sys
 import subprocess
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -17,14 +17,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -77,8 +77,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -89,11 +89,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 176784dfefdcd3692a68bc9565690d4c18359e8e..83e58a47d273d3158a835387030cb6859f6d872a 100755 (executable)
@@ -8,7 +8,7 @@ import sys
 import subprocess
 import string
 from optparse import OptionParser, make_option
-import ConfigParser
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -32,14 +32,14 @@ def userCheck():
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -179,8 +179,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -199,7 +199,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     userCheck()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index aa292c3795e83842b3a33fef0f81bac408e3b979..1e6b799087b3266ca391beca12866af0e77adb71 100755 (executable)
@@ -7,8 +7,8 @@ import time
 import sys
 import subprocess
 import string
-from optparse import OptionParser, make_option\r
-import ConfigParser
+from optparse import OptionParser, make_option
+import configparser
 
 
 SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__))
@@ -16,7 +16,7 @@ PKG_NAME = os.path.basename(SCRIPT_DIR)
 PARAMETERS = None
 #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/5000/dbus/user_bus_socket"
 TCT_CONFIG_FILE = "/opt/tools/TCT_CONFIG"
-tct_parser = ConfigParser.ConfigParser()
+tct_parser = configparser.ConfigParser()
 tct_parser.read(TCT_CONFIG_FILE)
 SRC_DIR = tct_parser.get('DEVICE', 'DEVICE_SUITE_TARGET_30')
 PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
@@ -24,14 +24,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -181,8 +181,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -201,7 +201,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -211,10 +211,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e29187a0bae2e2dce107adc8fe9ecb8898559397..f1f0cb470fad677077cced4db9cf44015525827c 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 63cf05e4fe4e99fab9ff0d722fc09897f1f337cb..1301e62c544d865a9216753f6536e5258354fdc5 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -167,8 +167,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -187,7 +187,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -197,10 +197,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 88cf13a755b8cfef2e74d107e2cfa445790a5712..20b88fecf4a542b7dc49a20f8901ea46988851ba 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -183,8 +183,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -203,7 +203,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -213,10 +213,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 24832a6e4f1cf5056544fbdfe546bfc5598e0bb5..5689e30d9f72a3daa86cd24d95ce32822764c527 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -182,8 +182,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -202,7 +202,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -212,10 +212,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 63cf05e4fe4e99fab9ff0d722fc09897f1f337cb..1301e62c544d865a9216753f6536e5258354fdc5 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -167,8 +167,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -187,7 +187,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -197,10 +197,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 63cf05e4fe4e99fab9ff0d722fc09897f1f337cb..1301e62c544d865a9216753f6536e5258354fdc5 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -167,8 +167,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -187,7 +187,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -197,10 +197,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 24832a6e4f1cf5056544fbdfe546bfc5598e0bb5..5689e30d9f72a3daa86cd24d95ce32822764c527 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -182,8 +182,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -202,7 +202,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -212,10 +212,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 63cf05e4fe4e99fab9ff0d722fc09897f1f337cb..1301e62c544d865a9216753f6536e5258354fdc5 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -167,8 +167,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -187,7 +187,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -197,10 +197,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index a13f660a9139880755ad26f3165b84b1efc8b760..5fcedb9d91f24fe5a9a5da8222042cef2d9f323b 100755 (executable)
@@ -16,14 +16,14 @@ ADB_CMD = "adb"
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -76,8 +76,8 @@ def main():
             "-u", dest="buninstpkg", action="store_true", help="Uninstall package")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.device:
@@ -88,11 +88,11 @@ def main():
                 break
 
     if not PARAMETERS.device:
-        print "No device found"
+        print ("No device found")
         sys.exit(1)
 
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 63cf05e4fe4e99fab9ff0d722fc09897f1f337cb..1301e62c544d865a9216753f6536e5258354fdc5 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -167,8 +167,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -187,7 +187,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -197,10 +197,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index 62d5424ef7a87ba9a010be38c285517fb807de95..45afba593a4690c84810e51721530ee18d59e146 100755 (executable)
@@ -20,14 +20,14 @@ PKG_SRC_DIR = "%s/tct/opt/%s" % (SRC_DIR, PKG_NAME)
 
 def doCMD(cmd):
     # Do not need handle timeout in this short script, let tool do it
-    print "-->> \"%s\"" % cmd
+    print ("-->> \"%s\"" % cmd)
     output = []
     cmd_return_code = 1
     cmd_proc = subprocess.Popen(
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         if output_line == '' and cmd_return_code != None:
             break
@@ -177,8 +177,8 @@ def main():
             "-a", dest="user", action="store", help="User name")
         global PARAMETERS
         (PARAMETERS, args) = opts_parser.parse_args()
-    except Exception, e:
-        print "Got wrong option: %s, exit ..." % e
+    except Exception as e:
+        print ("Got wrong option: %s, exit ..." % e)
         sys.exit(1)
 
     if not PARAMETERS.user:
@@ -197,7 +197,7 @@ def main():
         PARAMETERS.mode = "SSH"
 
     if not PARAMETERS.device:
-        print "No device provided"
+        print ("No device provided")
         sys.exit(1)
 
     user_info = getUSERID()
@@ -207,10 +207,10 @@ def main():
         userid = user_info[1][0]
         XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/%s/dbus/user_bus_socket"%str(userid)
     else:
-        print "[Error] cmd commands error : %s"%str(user_info[1])
+        print ("[Error] cmd commands error : %s" % str(user_info[1]))
         sys.exit(1)
     if PARAMETERS.binstpkg and PARAMETERS.buninstpkg:
-        print "-i and -u are conflict"
+        print ("-i and -u are conflict")
         sys.exit(1)
 
     if PARAMETERS.buninstpkg:
index e48cdc1748839ecd1b864814a8f96db9b166898c..22bf5e2a1c4f3f5593f9cc18f1af5ea2c927d073 100755 (executable)
@@ -40,10 +40,10 @@ import logging
 import zipfile
 import signal
 import subprocess
+import imp
 from optparse import OptionParser
 
-reload(sys)
-sys.setdefaultencoding('utf8')
+imp.reload(sys)
 
 TOOL_VERSION = "v0.1"
 VERSION_FILE = "VERSION"
@@ -363,7 +363,7 @@ def doCMDWithOutput(cmd, time_out=DEFAULT_CMD_TIMEOUT):
         cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
 
     while True:
-        output_line = cmd_proc.stdout.readline().strip("\r\n")
+        output_line = cmd_proc.stdout.readline().decode("UTF-8").strip("\r\n")
         cmd_return_code = cmd_proc.poll()
         elapsed_time = time.time() - pre_time
         if cmd_return_code is None:
@@ -938,7 +938,7 @@ def main():
         sys.exit(1)
 
     if BUILD_PARAMETERS.bversion:
-        print "Version: %s" % TOOL_VERSION
+        LOG.info("Version: %s" % TOOL_VERSION)
         sys.exit(0)
 
     if not BUILD_PARAMETERS.srcdir:
index e10865f470ba1f7cfcafcabfaaf5515f49fa6852..10a22ab09119901cdc3a6fe8d2977d7ccdd2d59f 100755 (executable)
@@ -4,7 +4,7 @@
 import os
 import sys
 import re
-import commands
+import subprocess
 import glob
 import fnmatch
 import string
@@ -14,8 +14,8 @@ from optparse import OptionParser
 
 def iterfindfiles (path, fnexp):
     for root, dirs, files in os.walk(path):
-           for filename in fnmatch.filter(files, fnexp):
-                   yield os.path.join(root, filename)
+        for filename in fnmatch.filter(files, fnexp):
+            yield os.path.join(root, filename)
 
 def count_upstream (string = None, str_entry=None ):
     if string.find('/%s/' % str_entry) >= 0:
@@ -94,9 +94,9 @@ def analy_test_file(file_path = None):
                      p3_auto_webdriver += 1*subcase
                  else:
                    p3_manual += 1*subcase
-    except Exception, e:
-         print "Got error when analy test files: %s" % e
-         print file_path
+    except Exception as e:
+         print ("Got error when analy test files: %s" % e)
+         print (file_path)
 
     p0_number = p0_auto + p0_manual
     p1_number = p1_auto + p1_manual
@@ -125,8 +125,8 @@ def get_upstream(file_path):
                     n_upstream += 1
                     if element not in exist_upstream :
                        exist_upstream.append(element)
-    except Exception, e:
-        print e
+    except Exception as e:
+        print (e)
 
     upstream = ""
     for element in exist_upstream:
@@ -151,8 +151,8 @@ def get_case_status(file_path):
         fp.write(content)
         fp.write("\n")
         fp.close()
-    except Exception, e:
-        print "Got error when get case status: %s" % e
+    except Exception as e:
+        print ("Got error when get case status: %s" % e)
 
 def init_result_file():
     title = "Suite_name,Total,Total_auto,Total_auto_webdriver,Total_manual,P0,P0_auto,P0_auto_webdriver,P0_manual,P1,P1_auto,\
@@ -166,8 +166,8 @@ Integrated_Upstream_TCs,Upstream_Resource"
         fp.write(title)
         fp.write("\n")
         fp.close()
-    except Exception, e:
-        print "Got error when init analy file : %s" % e
+    except Exception as e:
+        print ("Got error when init analy file : %s" % e)
 
 def main():
     try:
@@ -184,7 +184,7 @@ def main():
         
         init_result_file()
         if len(sys.argv) == 1:
-                   sys.argv.append("-h")
+            sys.argv.append("-h")
         (PARAMETERS, args) = opts_parser.parse_args()
         if PARAMETERS.suitesdir:
             for filename in iterfindfiles("%s" % PARAMETERS.suitesdir, "tests.full.xml"):
@@ -193,8 +193,8 @@ def main():
         if PARAMETERS.xmlfile:
             get_case_status(PARAMETERS.xmlfile)   
     except Exception as e:
-        print "Got error: %s, exit" % e
+        print ("Got error: %s, exit" % e)
 
 if __name__ == '__main__':
-       main()
+    main()
 
index 4447e4d65a1c8aad0bdcd5ad43cef5e355f01198..bdfdb207da941214883b6589d44165ec1c074c58 100755 (executable)
@@ -65,11 +65,11 @@ class ColorFormatter(logging.Formatter):
 
 def csv2full(csv_path, split_sign):
     if not os.path.isfile(csv_path):
-        print '%s is not a file' % csv_path
+        print ('%s is not a file' % csv_path)
         return
     name, ext = os.path.splitext(csv_path)
     if not ext == '.csv':
-        print '%s is not a csv' % csv_path
+        print ('%s is not a csv' % csv_path)
         return
     LOG.info("+Convert csv to xml start ...")
     csv_file = file(csv_path, 'rb')
@@ -139,7 +139,7 @@ def echo_about():
     This function will print the user guide and stop toolkit.
     """
     about = 'csv2xml V1.0\n-c <path>  |  Convert csv file to tests.full.xml and tests.xml\n'
-    print about
+    print (about)
     sys.exit()
 
 def main():
@@ -161,7 +161,7 @@ def main():
     elif sys_name == 'Linux':
         split_sign = '/'
     if len(sys.argv) != 3:
-        print 'Error: No enough argv!'
+        print ('Error: No enough argv!')
         echo_about()
     else:
         {'-c': lambda : csv2full(sys.argv[2], split_sign)}[sys.argv[1]]()
index 07de9c35a9f99b2a33bb37a7717b195a1a43c866..4e6ee0e2dce6877b486449413c414b904bcfb6ce 100755 (executable)
@@ -65,16 +65,16 @@ class ColorFormatter(logging.Formatter):
 
 def xml2csv(xml_path, split_sign):
     if not os.path.isfile(xml_path):
-        print '%s is not a file' % xml_path
+        print ('%s is not a file' % xml_path)
         return
     name, ext = os.path.splitext(xml_path)
 
     if not ext == '.xml':
-        print '%s is not a xml' % xml_path
+        print ('%s is not a xml' % xml_path)
         return
     if not name.split(split_sign)[-1] == 'tests.full':
-        print name
-        print '%s is not tests.full.xml' % xml_path
+        print (name)
+        print ('%s is not tests.full.xml' % xml_path)
         return
     LOG.info("+Convert xml to csv start ...")
     folder = os.path.dirname(xml_path)
@@ -88,7 +88,7 @@ def make_csv(xml_path, csv_path):
     csv_file_name = set_node.attrib['name']
     csv_path += csv_file_name + '.csv'
     LOG.info("General: %s" % csv_path)
-    writer = csv.writer(file(csv_path, 'wb'))
+    writer = csv.writer(open(csv_path, 'w'))
     writer.writerow(['Name',
      'Description',
      'Component',
@@ -152,7 +152,7 @@ def echo_about():
     This function will print the user guide and stop toolkit.
     """
     about = 'xml2csv V1.0\n-c <path>  |  Convert tests.full.xml to csv file\n'
-    print about
+    print (about)
     sys.exit()
 
 def main():
@@ -174,7 +174,7 @@ def main():
     elif sys_name == 'Linux':
         split_sign = '/'
     if len(sys.argv) != 3:
-        print 'Error: No enough argv!'
+        print ('Error: No enough argv!')
         echo_about()
     else:
         {
index 4165ec9d6951df855f42197c477363fc8089a2ec..9794b2c8b1725646a07c9452a38811a926ac327b 100755 (executable)
@@ -72,7 +72,7 @@ def verify_xml(xml_dir, split_sign):
         else:
             name, ext = os.path.splitext(xml_dir)
             if not ext == '.xml':
-                print '%s is not a xml' % xml_path
+                print ('%s is not a xml' % xml_path)
                 return
             else:
                 verify_path(xml_dir, split_sign)
@@ -143,7 +143,7 @@ def echo_about():
     This function will print the user guide and stop toolkit.
     """
     about = 'xmlverifier V1.0\n-v <path>  |  Verify case path, id, purpose and set type are right\n'
-    print about
+    print (about)
     sys.exit()
 
 def main():
@@ -165,7 +165,7 @@ def main():
     elif sys_name == 'Linux':
         split_sign = '/'
     if len(sys.argv) != 3:
-        print 'Error: No enough argv!'
+        print ('Error: No enough argv!')
         echo_about()
     else:
         {'-v': lambda : verify_xml(sys.argv[2], split_sign)}[sys.argv[1]]()