From: Wei Zhang Date: Thu, 26 May 2022 06:37:50 +0000 (+0000) Subject: Revert "Revert "upgrade to python 3.x"" X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F42%2F275542%2F1;p=test%2Ftct%2Fweb%2Fapi.git Revert "Revert "upgrade to python 3.x"" This reverts commit c51ce5db24be02d8627114472e4a89ab346f1ac2. Change-Id: I8b5cfd335f20997c0a2ea98007924cbd9411e934 --- diff --git a/common/tct-2dtransforms-css3-tests/inst.apk.py b/common/tct-2dtransforms-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/common/tct-2dtransforms-css3-tests/inst.apk.py +++ b/common/tct-2dtransforms-css3-tests/inst.apk.py @@ -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: diff --git a/common/tct-2dtransforms-css3-tests/inst.wgt.py b/common/tct-2dtransforms-css3-tests/inst.wgt.py index c7f89fd44..909755af3 100755 --- a/common/tct-2dtransforms-css3-tests/inst.wgt.py +++ b/common/tct-2dtransforms-css3-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-2dtransforms-css3-tests/inst.xpk.py b/common/tct-2dtransforms-css3-tests/inst.xpk.py index bbc0c8558..ace8cbba9 100755 --- a/common/tct-2dtransforms-css3-tests/inst.xpk.py +++ b/common/tct-2dtransforms-css3-tests/inst.xpk.py @@ -8,6 +8,7 @@ import sys import subprocess import string from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -15,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) @@ -23,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 @@ -182,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: @@ -202,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() @@ -212,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: diff --git a/common/tct-2dtransforms-css3-tests/pack.py b/common/tct-2dtransforms-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-2dtransforms-css3-tests/pack.py +++ b/common/tct-2dtransforms-css3-tests/pack.py @@ -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: diff --git a/common/tct-3dtransforms-css3-tests/inst.apk.py b/common/tct-3dtransforms-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-3dtransforms-css3-tests/inst.apk.py +++ b/common/tct-3dtransforms-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-3dtransforms-css3-tests/inst.wgt.py b/common/tct-3dtransforms-css3-tests/inst.wgt.py index 7e3caa6c3..fb496b6e9 100755 --- a/common/tct-3dtransforms-css3-tests/inst.wgt.py +++ b/common/tct-3dtransforms-css3-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-3dtransforms-css3-tests/inst.xpk.py b/common/tct-3dtransforms-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-3dtransforms-css3-tests/inst.xpk.py +++ b/common/tct-3dtransforms-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-3dtransforms-css3-tests/pack.py b/common/tct-3dtransforms-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-3dtransforms-css3-tests/pack.py +++ b/common/tct-3dtransforms-css3-tests/pack.py @@ -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: diff --git a/common/tct-ResponsiveImage-w3c-tests/inst.apk.py b/common/tct-ResponsiveImage-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-ResponsiveImage-w3c-tests/inst.apk.py +++ b/common/tct-ResponsiveImage-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-ResponsiveImage-w3c-tests/inst.wgt.py b/common/tct-ResponsiveImage-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-ResponsiveImage-w3c-tests/inst.wgt.py +++ b/common/tct-ResponsiveImage-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-ResponsiveImage-w3c-tests/inst.xpk.py b/common/tct-ResponsiveImage-w3c-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-ResponsiveImage-w3c-tests/inst.xpk.py +++ b/common/tct-ResponsiveImage-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-ResponsiveImage-w3c-tests/pack.py b/common/tct-ResponsiveImage-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-ResponsiveImage-w3c-tests/pack.py +++ b/common/tct-ResponsiveImage-w3c-tests/pack.py @@ -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: diff --git a/common/tct-account-tizen-tests/inst.apk.py b/common/tct-account-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-account-tizen-tests/inst.apk.py +++ b/common/tct-account-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-account-tizen-tests/inst.wgt.py b/common/tct-account-tizen-tests/inst.wgt.py index 2316502f4..8f1ecdb9b 100755 --- a/common/tct-account-tizen-tests/inst.wgt.py +++ b/common/tct-account-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -36,7 +36,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -48,14 +48,14 @@ def askpolicyremoving(): 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 @@ -206,8 +206,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: @@ -226,7 +226,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -238,10 +238,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: diff --git a/common/tct-account-tizen-tests/inst.xpk.py b/common/tct-account-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-account-tizen-tests/inst.xpk.py +++ b/common/tct-account-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-account-tizen-tests/pack.py b/common/tct-account-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-account-tizen-tests/pack.py +++ b/common/tct-account-tizen-tests/pack.py @@ -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: diff --git a/common/tct-alarm-tizen-tests/inst.apk.py b/common/tct-alarm-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-alarm-tizen-tests/inst.apk.py +++ b/common/tct-alarm-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-alarm-tizen-tests/inst.wgt.py b/common/tct-alarm-tizen-tests/inst.wgt.py index 7f7d2c9d3..0c9ab8085 100755 --- a/common/tct-alarm-tizen-tests/inst.wgt.py +++ b/common/tct-alarm-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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: diff --git a/common/tct-alarm-tizen-tests/inst.xpk.py b/common/tct-alarm-tizen-tests/inst.xpk.py index c0c358ecc..9b2adfedd 100755 --- a/common/tct-alarm-tizen-tests/inst.xpk.py +++ b/common/tct-alarm-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -166,8 +166,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: @@ -186,7 +186,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -196,10 +196,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: diff --git a/common/tct-alarm-tizen-tests/pack.py b/common/tct-alarm-tizen-tests/pack.py index 08d55aafe..92866ab2e 100755 --- a/common/tct-alarm-tizen-tests/pack.py +++ b/common/tct-alarm-tizen-tests/pack.py @@ -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: diff --git a/common/tct-animations-css3-tests/inst.apk.py b/common/tct-animations-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-animations-css3-tests/inst.apk.py +++ b/common/tct-animations-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-animations-css3-tests/inst.wgt.py b/common/tct-animations-css3-tests/inst.wgt.py index 7e3caa6c3..fb496b6e9 100755 --- a/common/tct-animations-css3-tests/inst.wgt.py +++ b/common/tct-animations-css3-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-animations-css3-tests/inst.xpk.py b/common/tct-animations-css3-tests/inst.xpk.py index aa292c379..1e6b79908 100755 --- a/common/tct-animations-css3-tests/inst.xpk.py +++ b/common/tct-animations-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-animations-css3-tests/pack.py b/common/tct-animations-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-animations-css3-tests/pack.py +++ b/common/tct-animations-css3-tests/pack.py @@ -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: diff --git a/common/tct-animationtiming-w3c-tests/inst.apk.py b/common/tct-animationtiming-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-animationtiming-w3c-tests/inst.apk.py +++ b/common/tct-animationtiming-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-animationtiming-w3c-tests/inst.wgt.py b/common/tct-animationtiming-w3c-tests/inst.wgt.py index 7e3caa6c3..fb496b6e9 100755 --- a/common/tct-animationtiming-w3c-tests/inst.wgt.py +++ b/common/tct-animationtiming-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-animationtiming-w3c-tests/inst.xpk.py b/common/tct-animationtiming-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-animationtiming-w3c-tests/inst.xpk.py +++ b/common/tct-animationtiming-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-animationtiming-w3c-tests/pack.py b/common/tct-animationtiming-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-animationtiming-w3c-tests/pack.py +++ b/common/tct-animationtiming-w3c-tests/pack.py @@ -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: diff --git a/common/tct-appcache-html5-tests/inst.apk.py b/common/tct-appcache-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-appcache-html5-tests/inst.apk.py +++ b/common/tct-appcache-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-appcache-html5-tests/inst.wgt.py b/common/tct-appcache-html5-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-appcache-html5-tests/inst.wgt.py +++ b/common/tct-appcache-html5-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-appcache-html5-tests/inst.xpk.py b/common/tct-appcache-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-appcache-html5-tests/inst.xpk.py +++ b/common/tct-appcache-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-appcache-html5-tests/pack.py b/common/tct-appcache-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-appcache-html5-tests/pack.py +++ b/common/tct-appcache-html5-tests/pack.py @@ -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: diff --git a/common/tct-appcontrol-tizen-tests/inst.apk.py b/common/tct-appcontrol-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-appcontrol-tizen-tests/inst.apk.py +++ b/common/tct-appcontrol-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-appcontrol-tizen-tests/inst.wgt.py b/common/tct-appcontrol-tizen-tests/inst.wgt.py index 8b44f9c8d..b72850d63 100755 --- a/common/tct-appcontrol-tizen-tests/inst.wgt.py +++ b/common/tct-appcontrol-tizen-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-appcontrol-tizen-tests/inst.xpk.py b/common/tct-appcontrol-tizen-tests/inst.xpk.py index 2b5e3f2e1..4cd2306f2 100755 --- a/common/tct-appcontrol-tizen-tests/inst.xpk.py +++ b/common/tct-appcontrol-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/common/tct-appcontrol-tizen-tests/pack.py b/common/tct-appcontrol-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-appcontrol-tizen-tests/pack.py +++ b/common/tct-appcontrol-tizen-tests/pack.py @@ -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: diff --git a/common/tct-application-tizen-tests/inst.apk.py b/common/tct-application-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-application-tizen-tests/inst.apk.py +++ b/common/tct-application-tizen-tests/inst.apk.py @@ -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: diff --git a/common/tct-application-tizen-tests/inst.wgt.py b/common/tct-application-tizen-tests/inst.wgt.py index 9e0c931c3..4baa95007 100755 --- a/common/tct-application-tizen-tests/inst.wgt.py +++ b/common/tct-application-tizen-tests/inst.wgt.py @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-application-tizen-tests/inst.xpk.py b/common/tct-application-tizen-tests/inst.xpk.py index 371cc3088..9a9a8f4e3 100755 --- a/common/tct-application-tizen-tests/inst.xpk.py +++ b/common/tct-application-tizen-tests/inst.xpk.py @@ -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 @@ -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: diff --git a/common/tct-application-tizen-tests/pack.py b/common/tct-application-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-application-tizen-tests/pack.py +++ b/common/tct-application-tizen-tests/pack.py @@ -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: diff --git a/common/tct-archive-tizen-tests/inst.apk.py b/common/tct-archive-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-archive-tizen-tests/inst.apk.py +++ b/common/tct-archive-tizen-tests/inst.apk.py @@ -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: diff --git a/common/tct-archive-tizen-tests/inst.wgt.py b/common/tct-archive-tizen-tests/inst.wgt.py index b8776ee49..a20ec241c 100755 --- a/common/tct-archive-tizen-tests/inst.wgt.py +++ b/common/tct-archive-tizen-tests/inst.wgt.py @@ -10,7 +10,7 @@ import string import logging import Queue from optparse import OptionParser, make_option -import ConfigParser +import configparser from shellmanager import ShellManager SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -18,7 +18,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') @@ -53,10 +53,10 @@ def getInternalStorage(): shell_mgr.write_cmd('export `tzplatform-get --user ' +PARAMETERS.user+' TZ_USER_CONTENT`', '', None) INTERNAL_STORAGE=shell_mgr.write_cmd('echo $TZ_USER_CONTENT','', None) INTERNAL_STORAGE=str(INTERNAL_STORAGE[len(INTERNAL_STORAGE)-1]) - print str(INTERNAL_STORAGE) + print (str(INTERNAL_STORAGE)) except Exception as ex: - print ex + print (ex) finally: shell_mgr.close_shellpipe() @@ -72,7 +72,7 @@ def getInternalStorage(): # PARAMETERS.device) # return doCMD(cmd) # except Exception as ex: -# print ex +# print (ex) # else: # print ("aaaaaaaaaaaaaaa") # os.system( @@ -85,14 +85,14 @@ def getInternalStorage(): 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 @@ -245,8 +245,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: @@ -265,7 +265,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -279,10 +279,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: diff --git a/common/tct-archive-tizen-tests/inst.xpk.py b/common/tct-archive-tizen-tests/inst.xpk.py index 371cc3088..9a9a8f4e3 100755 --- a/common/tct-archive-tizen-tests/inst.xpk.py +++ b/common/tct-archive-tizen-tests/inst.xpk.py @@ -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 @@ -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: diff --git a/common/tct-archive-tizen-tests/pack.py b/common/tct-archive-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-archive-tizen-tests/pack.py +++ b/common/tct-archive-tizen-tests/pack.py @@ -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: diff --git a/common/tct-audio-html5-tests/inst.apk.py b/common/tct-audio-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-audio-html5-tests/inst.apk.py +++ b/common/tct-audio-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-audio-html5-tests/inst.wgt.py b/common/tct-audio-html5-tests/inst.wgt.py index a7478a061..6ae9cae4a 100755 --- a/common/tct-audio-html5-tests/inst.wgt.py +++ b/common/tct-audio-html5-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-audio-html5-tests/inst.xpk.py b/common/tct-audio-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-audio-html5-tests/inst.xpk.py +++ b/common/tct-audio-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-audio-html5-tests/pack.py b/common/tct-audio-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-audio-html5-tests/pack.py +++ b/common/tct-audio-html5-tests/pack.py @@ -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: diff --git a/common/tct-backgrounds-css3-tests/inst.apk.py b/common/tct-backgrounds-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-backgrounds-css3-tests/inst.apk.py +++ b/common/tct-backgrounds-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-backgrounds-css3-tests/inst.wgt.py b/common/tct-backgrounds-css3-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-backgrounds-css3-tests/inst.wgt.py +++ b/common/tct-backgrounds-css3-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-backgrounds-css3-tests/inst.xpk.py b/common/tct-backgrounds-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-backgrounds-css3-tests/inst.xpk.py +++ b/common/tct-backgrounds-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-backgrounds-css3-tests/pack.py b/common/tct-backgrounds-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-backgrounds-css3-tests/pack.py +++ b/common/tct-backgrounds-css3-tests/pack.py @@ -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: diff --git a/common/tct-badge-tizen-tests/inst.apk.py b/common/tct-badge-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-badge-tizen-tests/inst.apk.py +++ b/common/tct-badge-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-badge-tizen-tests/inst.wgt.py b/common/tct-badge-tizen-tests/inst.wgt.py index 18690763e..c3285e19c 100755 --- a/common/tct-badge-tizen-tests/inst.wgt.py +++ b/common/tct-badge-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -192,8 +192,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: @@ -212,7 +212,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -224,10 +224,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: diff --git a/common/tct-badge-tizen-tests/inst.xpk.py b/common/tct-badge-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-badge-tizen-tests/inst.xpk.py +++ b/common/tct-badge-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-badge-tizen-tests/pack.py b/common/tct-badge-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-badge-tizen-tests/pack.py +++ b/common/tct-badge-tizen-tests/pack.py @@ -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: diff --git a/common/tct-batterystatus-w3c-tests/inst.apk.py b/common/tct-batterystatus-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-batterystatus-w3c-tests/inst.apk.py +++ b/common/tct-batterystatus-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-batterystatus-w3c-tests/inst.wgt.py b/common/tct-batterystatus-w3c-tests/inst.wgt.py index 7e3caa6c3..fb496b6e9 100755 --- a/common/tct-batterystatus-w3c-tests/inst.wgt.py +++ b/common/tct-batterystatus-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-batterystatus-w3c-tests/inst.xpk.py b/common/tct-batterystatus-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-batterystatus-w3c-tests/inst.xpk.py +++ b/common/tct-batterystatus-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-batterystatus-w3c-tests/pack.py b/common/tct-batterystatus-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-batterystatus-w3c-tests/pack.py +++ b/common/tct-batterystatus-w3c-tests/pack.py @@ -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: diff --git a/common/tct-beacon-w3c-tests/inst.apk.py b/common/tct-beacon-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-beacon-w3c-tests/inst.apk.py +++ b/common/tct-beacon-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-beacon-w3c-tests/inst.wgt.py b/common/tct-beacon-w3c-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-beacon-w3c-tests/inst.wgt.py +++ b/common/tct-beacon-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-beacon-w3c-tests/inst.xpk.py b/common/tct-beacon-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-beacon-w3c-tests/inst.xpk.py +++ b/common/tct-beacon-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-beacon-w3c-tests/pack.py b/common/tct-beacon-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-beacon-w3c-tests/pack.py +++ b/common/tct-beacon-w3c-tests/pack.py @@ -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: diff --git a/common/tct-bluetooth-tizen-tests/inst.apk.py b/common/tct-bluetooth-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-bluetooth-tizen-tests/inst.apk.py +++ b/common/tct-bluetooth-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-bluetooth-tizen-tests/inst.wgt.py b/common/tct-bluetooth-tizen-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-bluetooth-tizen-tests/inst.wgt.py +++ b/common/tct-bluetooth-tizen-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-bluetooth-tizen-tests/inst.xpk.py b/common/tct-bluetooth-tizen-tests/inst.xpk.py index c0c358ecc..9b2adfedd 100755 --- a/common/tct-bluetooth-tizen-tests/inst.xpk.py +++ b/common/tct-bluetooth-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -166,8 +166,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: @@ -186,7 +186,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -196,10 +196,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: diff --git a/common/tct-bluetooth-tizen-tests/pack.py b/common/tct-bluetooth-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-bluetooth-tizen-tests/pack.py +++ b/common/tct-bluetooth-tizen-tests/pack.py @@ -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: diff --git a/common/tct-browserstate-html5-tests/inst.apk.py b/common/tct-browserstate-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-browserstate-html5-tests/inst.apk.py +++ b/common/tct-browserstate-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-browserstate-html5-tests/inst.wgt.py b/common/tct-browserstate-html5-tests/inst.wgt.py index 7e3caa6c3..fb496b6e9 100755 --- a/common/tct-browserstate-html5-tests/inst.wgt.py +++ b/common/tct-browserstate-html5-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-browserstate-html5-tests/inst.xpk.py b/common/tct-browserstate-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-browserstate-html5-tests/inst.xpk.py +++ b/common/tct-browserstate-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-browserstate-html5-tests/pack.py b/common/tct-browserstate-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-browserstate-html5-tests/pack.py +++ b/common/tct-browserstate-html5-tests/pack.py @@ -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: diff --git a/common/tct-calendar-tizen-tests/inst.apk.py b/common/tct-calendar-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-calendar-tizen-tests/inst.apk.py +++ b/common/tct-calendar-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-calendar-tizen-tests/inst.wgt.py b/common/tct-calendar-tizen-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/common/tct-calendar-tizen-tests/inst.wgt.py +++ b/common/tct-calendar-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-calendar-tizen-tests/inst.xpk.py b/common/tct-calendar-tizen-tests/inst.xpk.py index 36b426acb..3a5bc9067 100755 --- a/common/tct-calendar-tizen-tests/inst.xpk.py +++ b/common/tct-calendar-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,14 @@ PKG_SRC_DIR = "" 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 @@ -178,8 +178,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: diff --git a/common/tct-calendar-tizen-tests/pack.py b/common/tct-calendar-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-calendar-tizen-tests/pack.py +++ b/common/tct-calendar-tizen-tests/pack.py @@ -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: diff --git a/common/tct-callhistory-tizen-tests/inst.apk.py b/common/tct-callhistory-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-callhistory-tizen-tests/inst.apk.py +++ b/common/tct-callhistory-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-callhistory-tizen-tests/inst.wgt.py b/common/tct-callhistory-tizen-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/common/tct-callhistory-tizen-tests/inst.wgt.py +++ b/common/tct-callhistory-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-callhistory-tizen-tests/inst.xpk.py b/common/tct-callhistory-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-callhistory-tizen-tests/inst.xpk.py +++ b/common/tct-callhistory-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-callhistory-tizen-tests/pack.py b/common/tct-callhistory-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-callhistory-tizen-tests/pack.py +++ b/common/tct-callhistory-tizen-tests/pack.py @@ -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: diff --git a/common/tct-canvas-html5-tests/inst.apk.py b/common/tct-canvas-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-canvas-html5-tests/inst.apk.py +++ b/common/tct-canvas-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-canvas-html5-tests/inst.wgt.py b/common/tct-canvas-html5-tests/inst.wgt.py index 84a331b62..275a9362d 100755 --- a/common/tct-canvas-html5-tests/inst.wgt.py +++ b/common/tct-canvas-html5-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-canvas-html5-tests/inst.xpk.py b/common/tct-canvas-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-canvas-html5-tests/inst.xpk.py +++ b/common/tct-canvas-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-canvas-html5-tests/pack.py b/common/tct-canvas-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-canvas-html5-tests/pack.py +++ b/common/tct-canvas-html5-tests/pack.py @@ -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: diff --git a/common/tct-colors-css3-tests/inst.apk.py b/common/tct-colors-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-colors-css3-tests/inst.apk.py +++ b/common/tct-colors-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-colors-css3-tests/inst.wgt.py b/common/tct-colors-css3-tests/inst.wgt.py index c7f89fd44..909755af3 100755 --- a/common/tct-colors-css3-tests/inst.wgt.py +++ b/common/tct-colors-css3-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-colors-css3-tests/inst.xpk.py b/common/tct-colors-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-colors-css3-tests/inst.xpk.py +++ b/common/tct-colors-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-colors-css3-tests/pack.py b/common/tct-colors-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-colors-css3-tests/pack.py +++ b/common/tct-colors-css3-tests/pack.py @@ -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: diff --git a/common/tct-contact-tizen-tests/inst.apk.py b/common/tct-contact-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-contact-tizen-tests/inst.apk.py +++ b/common/tct-contact-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-contact-tizen-tests/inst.wgt.py b/common/tct-contact-tizen-tests/inst.wgt.py index f04d84498..80b6b1ba8 100755 --- a/common/tct-contact-tizen-tests/inst.wgt.py +++ b/common/tct-contact-tizen-tests/inst.wgt.py @@ -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) @@ -36,7 +36,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -48,14 +48,14 @@ def askpolicyremoving(): 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 @@ -199,8 +199,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: @@ -219,7 +219,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -231,10 +231,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: diff --git a/common/tct-contact-tizen-tests/inst.xpk.py b/common/tct-contact-tizen-tests/inst.xpk.py index 371cc3088..34cd55034 100755 --- a/common/tct-contact-tizen-tests/inst.xpk.py +++ b/common/tct-contact-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-contact-tizen-tests/pack.py b/common/tct-contact-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-contact-tizen-tests/pack.py +++ b/common/tct-contact-tizen-tests/pack.py @@ -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: diff --git a/common/tct-content-tizen-tests/inst.apk.py b/common/tct-content-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-content-tizen-tests/inst.apk.py +++ b/common/tct-content-tizen-tests/inst.apk.py @@ -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: diff --git a/common/tct-content-tizen-tests/inst.wgt.py b/common/tct-content-tizen-tests/inst.wgt.py index 08c6d3d34..1508860d8 100755 --- a/common/tct-content-tizen-tests/inst.wgt.py +++ b/common/tct-content-tizen-tests/inst.wgt.py @@ -10,7 +10,7 @@ import string import logging import Queue from optparse import OptionParser, make_option -import ConfigParser +import configparser from shellmanager import ShellManager time.sleep(3) @@ -20,7 +20,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') #INTERNAL_STORAGE = tct_parser.get('DEVICE', 'DEVICE_STORAGE_30') @@ -72,51 +72,28 @@ def getInternalStorage(): shell_mgr.write_cmd('export `tzplatform-get --user ' +PARAMETERS.user+' TZ_USER_CONTENT`', '', None) INTERNAL_STORAGE=shell_mgr.write_cmd('echo $TZ_USER_CONTENT','', None) INTERNAL_STORAGE=str(INTERNAL_STORAGE[len(INTERNAL_STORAGE)-1]) - print str(INTERNAL_STORAGE) + print (str(INTERNAL_STORAGE)) except Exception as ex: - print ex + print (ex) finally: shell_mgr.close_shellpipe() def askpolicyremoving(): - print "0" - print "0" - print "0" - print "0" - print "0" for root, dirs, files in os.walk(SCRIPT_DIR): for file in files: if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id - print pkg_id - print pkg_id - print pkg_id + print (pkg_id) print (os.getcwd()) - print (os.getcwd()) - print (os.path.dirname(os.path.realpath(__file__)) ) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): action_status = False - print "1" - print "1" - print "1" - print "1" - print "1" if PARAMETERS.mode == "SDB": cmd = "sdb -s %s shell .%s/askpolicy.sh %s" % (PARAMETERS.device, SRC_DIR, pkg_id) - print cmd - print cmd - print cmd - print cmd - print cmd - return doCMD(cmd) - print "2" - print "2" - print "2" + return doCMD(cmd) def recordInternalStorage(): try: @@ -130,7 +107,7 @@ def recordInternalStorage(): PARAMETERS.device) return doCMD(cmd) except Exception as ex: - print ex + print (ex) else: print ("aaaaaaaaaaaaaaa") # os.system( @@ -143,14 +120,14 @@ def recordInternalStorage(): 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 @@ -273,8 +250,6 @@ def instPKGs(): action_status = False break print(INTERNAL_STORAGE) - print(INTERNAL_STORAGE) - print(INTERNAL_STORAGE) if not doRemoteCopy("%s/media" % SCRIPT_DIR, "%s/%s" % (SRC_DIR, PKG_NAME)): action_status = False if not doRemoteCopy("%s/media" % SCRIPT_DIR, "%s/Downloads/" % (INTERNAL_STORAGE)): @@ -303,8 +278,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: @@ -323,7 +298,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -337,10 +312,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: @@ -348,11 +323,6 @@ def main(): sys.exit(1) else: if not instPKGs(): - print "inst" - print "inst" - print "inst" - print "inst" - print "inst" #askpolicyremoving() sys.exit(1) diff --git a/common/tct-content-tizen-tests/inst.xpk.py b/common/tct-content-tizen-tests/inst.xpk.py index c3b031d9a..3626cd23a 100755 --- a/common/tct-content-tizen-tests/inst.xpk.py +++ b/common/tct-content-tizen-tests/inst.xpk.py @@ -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 @@ -173,8 +173,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: @@ -193,7 +193,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -203,10 +203,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: diff --git a/common/tct-content-tizen-tests/pack.py b/common/tct-content-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-content-tizen-tests/pack.py +++ b/common/tct-content-tizen-tests/pack.py @@ -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: diff --git a/common/tct-convergence-tizen-tests/inst.apk.py b/common/tct-convergence-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-convergence-tizen-tests/inst.apk.py +++ b/common/tct-convergence-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-convergence-tizen-tests/inst.wgt.py b/common/tct-convergence-tizen-tests/inst.wgt.py index 0c4e2056a..1141c4c37 100755 --- a/common/tct-convergence-tizen-tests/inst.wgt.py +++ b/common/tct-convergence-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -173,8 +173,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: @@ -193,7 +193,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -205,10 +205,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: diff --git a/common/tct-convergence-tizen-tests/inst.xpk.py b/common/tct-convergence-tizen-tests/inst.xpk.py index c0c358ecc..9b2adfedd 100755 --- a/common/tct-convergence-tizen-tests/inst.xpk.py +++ b/common/tct-convergence-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -166,8 +166,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: @@ -186,7 +186,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -196,10 +196,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: diff --git a/common/tct-convergence-tizen-tests/pack.py b/common/tct-convergence-tizen-tests/pack.py index 08d55aafe..92866ab2e 100755 --- a/common/tct-convergence-tizen-tests/pack.py +++ b/common/tct-convergence-tizen-tests/pack.py @@ -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: diff --git a/common/tct-cors-w3c-tests/inst.apk.py b/common/tct-cors-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-cors-w3c-tests/inst.apk.py +++ b/common/tct-cors-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-cors-w3c-tests/inst.wgt.py b/common/tct-cors-w3c-tests/inst.wgt.py index 30dfea1b2..5df0b661c 100755 --- a/common/tct-cors-w3c-tests/inst.wgt.py +++ b/common/tct-cors-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-cors-w3c-tests/inst.xpk.py b/common/tct-cors-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-cors-w3c-tests/inst.xpk.py +++ b/common/tct-cors-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-cors-w3c-tests/pack.py b/common/tct-cors-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-cors-w3c-tests/pack.py +++ b/common/tct-cors-w3c-tests/pack.py @@ -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: diff --git a/common/tct-crypto-w3c-tests/inst.apk.py b/common/tct-crypto-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-crypto-w3c-tests/inst.apk.py +++ b/common/tct-crypto-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-crypto-w3c-tests/inst.wgt.py b/common/tct-crypto-w3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-crypto-w3c-tests/inst.wgt.py +++ b/common/tct-crypto-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-crypto-w3c-tests/inst.xpk.py b/common/tct-crypto-w3c-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-crypto-w3c-tests/inst.xpk.py +++ b/common/tct-crypto-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-crypto-w3c-tests/pack.py b/common/tct-crypto-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-crypto-w3c-tests/pack.py +++ b/common/tct-crypto-w3c-tests/pack.py @@ -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: diff --git a/common/tct-csp-w3c-tests/inst.apk.py b/common/tct-csp-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-csp-w3c-tests/inst.apk.py +++ b/common/tct-csp-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-csp-w3c-tests/inst.wgt.py b/common/tct-csp-w3c-tests/inst.wgt.py index 076b4489e..be3dfd026 100755 --- a/common/tct-csp-w3c-tests/inst.wgt.py +++ b/common/tct-csp-w3c-tests/inst.wgt.py @@ -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 @@ -184,8 +184,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: @@ -204,7 +204,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -216,10 +216,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: diff --git a/common/tct-csp-w3c-tests/inst.xpk.py b/common/tct-csp-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-csp-w3c-tests/inst.xpk.py +++ b/common/tct-csp-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-csp-w3c-tests/pack.py b/common/tct-csp-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-csp-w3c-tests/pack.py +++ b/common/tct-csp-w3c-tests/pack.py @@ -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: diff --git a/common/tct-customelement-w3c-tests/inst.apk.py b/common/tct-customelement-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-customelement-w3c-tests/inst.apk.py +++ b/common/tct-customelement-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-customelement-w3c-tests/inst.wgt.py b/common/tct-customelement-w3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-customelement-w3c-tests/inst.wgt.py +++ b/common/tct-customelement-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-customelement-w3c-tests/inst.xpk.py b/common/tct-customelement-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-customelement-w3c-tests/inst.xpk.py +++ b/common/tct-customelement-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-customelement-w3c-tests/pack.py b/common/tct-customelement-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-customelement-w3c-tests/pack.py +++ b/common/tct-customelement-w3c-tests/pack.py @@ -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: diff --git a/common/tct-datacontrol-tizen-tests/inst.apk.py b/common/tct-datacontrol-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-datacontrol-tizen-tests/inst.apk.py +++ b/common/tct-datacontrol-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-datacontrol-tizen-tests/inst.wgt.py b/common/tct-datacontrol-tizen-tests/inst.wgt.py index 919820675..4785d8b9b 100755 --- a/common/tct-datacontrol-tizen-tests/inst.wgt.py +++ b/common/tct-datacontrol-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -204,10 +204,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: diff --git a/common/tct-datacontrol-tizen-tests/inst.xpk.py b/common/tct-datacontrol-tizen-tests/inst.xpk.py index aa292c379..1e6b79908 100755 --- a/common/tct-datacontrol-tizen-tests/inst.xpk.py +++ b/common/tct-datacontrol-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-datacontrol-tizen-tests/pack.py b/common/tct-datacontrol-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-datacontrol-tizen-tests/pack.py +++ b/common/tct-datacontrol-tizen-tests/pack.py @@ -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: diff --git a/common/tct-device-cordova-tests/inst.apk.py b/common/tct-device-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-device-cordova-tests/inst.apk.py +++ b/common/tct-device-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-device-cordova-tests/inst.wgt.py b/common/tct-device-cordova-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-device-cordova-tests/inst.wgt.py +++ b/common/tct-device-cordova-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-device-cordova-tests/inst.xpk.py b/common/tct-device-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-device-cordova-tests/inst.xpk.py +++ b/common/tct-device-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-device-cordova-tests/pack.py b/common/tct-device-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-device-cordova-tests/pack.py +++ b/common/tct-device-cordova-tests/pack.py @@ -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: diff --git a/common/tct-devicemotion-cordova-tests/inst.apk.py b/common/tct-devicemotion-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-devicemotion-cordova-tests/inst.apk.py +++ b/common/tct-devicemotion-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-devicemotion-cordova-tests/inst.wgt.py b/common/tct-devicemotion-cordova-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-devicemotion-cordova-tests/inst.wgt.py +++ b/common/tct-devicemotion-cordova-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-devicemotion-cordova-tests/inst.xpk.py b/common/tct-devicemotion-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-devicemotion-cordova-tests/inst.xpk.py +++ b/common/tct-devicemotion-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-devicemotion-cordova-tests/pack.py b/common/tct-devicemotion-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-devicemotion-cordova-tests/pack.py +++ b/common/tct-devicemotion-cordova-tests/pack.py @@ -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: diff --git a/common/tct-deviceorientation-w3c-tests/inst.apk.py b/common/tct-deviceorientation-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-deviceorientation-w3c-tests/inst.apk.py +++ b/common/tct-deviceorientation-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-deviceorientation-w3c-tests/inst.wgt.py b/common/tct-deviceorientation-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-deviceorientation-w3c-tests/inst.wgt.py +++ b/common/tct-deviceorientation-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-deviceorientation-w3c-tests/inst.xpk.py b/common/tct-deviceorientation-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-deviceorientation-w3c-tests/inst.xpk.py +++ b/common/tct-deviceorientation-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-deviceorientation-w3c-tests/pack.py b/common/tct-deviceorientation-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-deviceorientation-w3c-tests/pack.py +++ b/common/tct-deviceorientation-w3c-tests/pack.py @@ -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: diff --git a/common/tct-dialogs-cordova-tests/inst.apk.py b/common/tct-dialogs-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-dialogs-cordova-tests/inst.apk.py +++ b/common/tct-dialogs-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-dialogs-cordova-tests/inst.wgt.py b/common/tct-dialogs-cordova-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-dialogs-cordova-tests/inst.wgt.py +++ b/common/tct-dialogs-cordova-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-dialogs-cordova-tests/inst.xpk.py b/common/tct-dialogs-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-dialogs-cordova-tests/inst.xpk.py +++ b/common/tct-dialogs-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-dialogs-cordova-tests/pack.py b/common/tct-dialogs-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-dialogs-cordova-tests/pack.py +++ b/common/tct-dialogs-cordova-tests/pack.py @@ -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: diff --git a/common/tct-dnd-html5-tests/inst.apk.py b/common/tct-dnd-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-dnd-html5-tests/inst.apk.py +++ b/common/tct-dnd-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-dnd-html5-tests/inst.wgt.py b/common/tct-dnd-html5-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-dnd-html5-tests/inst.wgt.py +++ b/common/tct-dnd-html5-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-dnd-html5-tests/inst.xpk.py b/common/tct-dnd-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-dnd-html5-tests/inst.xpk.py +++ b/common/tct-dnd-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-dnd-html5-tests/pack.py b/common/tct-dnd-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-dnd-html5-tests/pack.py +++ b/common/tct-dnd-html5-tests/pack.py @@ -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: diff --git a/common/tct-download-tizen-tests/inst.apk.py b/common/tct-download-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-download-tizen-tests/inst.apk.py +++ b/common/tct-download-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-download-tizen-tests/inst.wgt.py b/common/tct-download-tizen-tests/inst.wgt.py index dccbfe5eb..d2daaf7c4 100755 --- a/common/tct-download-tizen-tests/inst.wgt.py +++ b/common/tct-download-tizen-tests/inst.wgt.py @@ -10,7 +10,7 @@ import string import logging import Queue from optparse import OptionParser, make_option -import ConfigParser +import configparser from shellmanager import ShellManager time.sleep(3) @@ -20,7 +20,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) @@ -43,23 +43,23 @@ def getInternalStorage(): shell_mgr.write_cmd('export `tzplatform-get --user ' +PARAMETERS.user+' TZ_USER_CONTENT`', '', None) INTERNAL_STORAGE=shell_mgr.write_cmd('echo $TZ_USER_CONTENT','', None) INTERNAL_STORAGE=str(INTERNAL_STORAGE[len(INTERNAL_STORAGE)-1]) - print str(INTERNAL_STORAGE) + print (str(INTERNAL_STORAGE)) except Exception as ex: - print ex + print (ex) finally: shell_mgr.close_shellpipe() 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 @@ -216,8 +216,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: @@ -236,26 +236,23 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() - print "1" getInternalStorage() - print "2" - user_info = getUSERID() - print "3" + user_info = getUSERID() re_code = user_info[0] if re_code == 0 : global XW_ENV 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: diff --git a/common/tct-download-tizen-tests/inst.xpk.py b/common/tct-download-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-download-tizen-tests/inst.xpk.py +++ b/common/tct-download-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-download-tizen-tests/pack.py b/common/tct-download-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-download-tizen-tests/pack.py +++ b/common/tct-download-tizen-tests/pack.py @@ -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: diff --git a/common/tct-events-cordova-tests/inst.apk.py b/common/tct-events-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-events-cordova-tests/inst.apk.py +++ b/common/tct-events-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-events-cordova-tests/inst.wgt.py b/common/tct-events-cordova-tests/inst.wgt.py index 28b1eb42a..cdc72d3b3 100755 --- a/common/tct-events-cordova-tests/inst.wgt.py +++ b/common/tct-events-cordova-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -176,8 +176,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: @@ -196,7 +196,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -206,10 +206,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: diff --git a/common/tct-events-cordova-tests/inst.xpk.py b/common/tct-events-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-events-cordova-tests/inst.xpk.py +++ b/common/tct-events-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-events-cordova-tests/pack.py b/common/tct-events-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-events-cordova-tests/pack.py +++ b/common/tct-events-cordova-tests/pack.py @@ -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: diff --git a/common/tct-events-cordova-tests/tests.xml b/common/tct-events-cordova-tests/tests.xml index 53270edda..155fecf5b 100755 --- a/common/tct-events-cordova-tests/tests.xml +++ b/common/tct-events-cordova-tests/tests.xml @@ -91,7 +91,7 @@ TC is running - Click the "power" button or switch to a different application and then return to the test application. + Click the "power" button or switch to a different application and then return to the test application. TC is pass @@ -106,7 +106,7 @@ TC is running - Click the "power" button or switch to a different application and then return to the test application. + Click the "power" button or switch to a different application and then return to the test application. TC is pass diff --git a/common/tct-exif-tizen-tests/inst.apk.py b/common/tct-exif-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-exif-tizen-tests/inst.apk.py +++ b/common/tct-exif-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-exif-tizen-tests/inst.wgt.py b/common/tct-exif-tizen-tests/inst.wgt.py index d45898649..8ef95b07b 100755 --- a/common/tct-exif-tizen-tests/inst.wgt.py +++ b/common/tct-exif-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -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) userCheck() @@ -214,10 +214,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: diff --git a/common/tct-exif-tizen-tests/inst.xpk.py b/common/tct-exif-tizen-tests/inst.xpk.py index c3b031d9a..f1dff255b 100755 --- a/common/tct-exif-tizen-tests/inst.xpk.py +++ b/common/tct-exif-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -173,8 +173,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: @@ -193,7 +193,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -203,10 +203,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: diff --git a/common/tct-exif-tizen-tests/pack.py b/common/tct-exif-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-exif-tizen-tests/pack.py +++ b/common/tct-exif-tizen-tests/pack.py @@ -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: diff --git a/common/tct-extra-html5-tests/inst.apk.py b/common/tct-extra-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-extra-html5-tests/inst.apk.py +++ b/common/tct-extra-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-extra-html5-tests/inst.wgt.py b/common/tct-extra-html5-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-extra-html5-tests/inst.wgt.py +++ b/common/tct-extra-html5-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-extra-html5-tests/inst.xpk.py b/common/tct-extra-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-extra-html5-tests/inst.xpk.py +++ b/common/tct-extra-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-extra-html5-tests/pack.py b/common/tct-extra-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-extra-html5-tests/pack.py +++ b/common/tct-extra-html5-tests/pack.py @@ -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: diff --git a/common/tct-feedback-tizen-tests/inst.apk.py b/common/tct-feedback-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-feedback-tizen-tests/inst.apk.py +++ b/common/tct-feedback-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-feedback-tizen-tests/inst.wgt.py b/common/tct-feedback-tizen-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-feedback-tizen-tests/inst.wgt.py +++ b/common/tct-feedback-tizen-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-feedback-tizen-tests/inst.xpk.py b/common/tct-feedback-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-feedback-tizen-tests/inst.xpk.py +++ b/common/tct-feedback-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-feedback-tizen-tests/pack.py b/common/tct-feedback-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-feedback-tizen-tests/pack.py +++ b/common/tct-feedback-tizen-tests/pack.py @@ -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: diff --git a/common/tct-file-cordova-tests/inst.apk.py b/common/tct-file-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-file-cordova-tests/inst.apk.py +++ b/common/tct-file-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-file-cordova-tests/inst.wgt.py b/common/tct-file-cordova-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-file-cordova-tests/inst.wgt.py +++ b/common/tct-file-cordova-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-file-cordova-tests/inst.xpk.py b/common/tct-file-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-file-cordova-tests/inst.xpk.py +++ b/common/tct-file-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-file-cordova-tests/pack.py b/common/tct-file-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-file-cordova-tests/pack.py +++ b/common/tct-file-cordova-tests/pack.py @@ -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: diff --git a/common/tct-file-transfer-cordova-tests/inst.apk.py b/common/tct-file-transfer-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-file-transfer-cordova-tests/inst.apk.py +++ b/common/tct-file-transfer-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-file-transfer-cordova-tests/inst.wgt.py b/common/tct-file-transfer-cordova-tests/inst.wgt.py index 4bcbd777f..eee87514d 100755 --- a/common/tct-file-transfer-cordova-tests/inst.wgt.py +++ b/common/tct-file-transfer-cordova-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -208,8 +208,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: @@ -228,7 +228,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -240,10 +240,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: diff --git a/common/tct-file-transfer-cordova-tests/inst.xpk.py b/common/tct-file-transfer-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-file-transfer-cordova-tests/inst.xpk.py +++ b/common/tct-file-transfer-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-file-transfer-cordova-tests/pack.py b/common/tct-file-transfer-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-file-transfer-cordova-tests/pack.py +++ b/common/tct-file-transfer-cordova-tests/pack.py @@ -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: diff --git a/common/tct-fileapi-w3c-tests/inst.apk.py b/common/tct-fileapi-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-fileapi-w3c-tests/inst.apk.py +++ b/common/tct-fileapi-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-fileapi-w3c-tests/inst.wgt.py b/common/tct-fileapi-w3c-tests/inst.wgt.py index 84a331b62..275a9362d 100755 --- a/common/tct-fileapi-w3c-tests/inst.wgt.py +++ b/common/tct-fileapi-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-fileapi-w3c-tests/inst.xpk.py b/common/tct-fileapi-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-fileapi-w3c-tests/inst.xpk.py +++ b/common/tct-fileapi-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-fileapi-w3c-tests/pack.py b/common/tct-fileapi-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-fileapi-w3c-tests/pack.py +++ b/common/tct-fileapi-w3c-tests/pack.py @@ -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: diff --git a/common/tct-filesystem-tizen-tests/inst.apk.py b/common/tct-filesystem-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-filesystem-tizen-tests/inst.apk.py +++ b/common/tct-filesystem-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-filesystem-tizen-tests/inst.wgt.py b/common/tct-filesystem-tizen-tests/inst.wgt.py index 44e57cf17..d46e4924e 100755 --- a/common/tct-filesystem-tizen-tests/inst.wgt.py +++ b/common/tct-filesystem-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-filesystem-tizen-tests/inst.xpk.py b/common/tct-filesystem-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-filesystem-tizen-tests/inst.xpk.py +++ b/common/tct-filesystem-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-filesystem-tizen-tests/pack.py b/common/tct-filesystem-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-filesystem-tizen-tests/pack.py +++ b/common/tct-filesystem-tizen-tests/pack.py @@ -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: diff --git a/common/tct-flexiblebox-css3-tests/inst.apk.py b/common/tct-flexiblebox-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-flexiblebox-css3-tests/inst.apk.py +++ b/common/tct-flexiblebox-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-flexiblebox-css3-tests/inst.wgt.py b/common/tct-flexiblebox-css3-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-flexiblebox-css3-tests/inst.wgt.py +++ b/common/tct-flexiblebox-css3-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-flexiblebox-css3-tests/inst.xpk.py b/common/tct-flexiblebox-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-flexiblebox-css3-tests/inst.xpk.py +++ b/common/tct-flexiblebox-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-flexiblebox-css3-tests/pack.py b/common/tct-flexiblebox-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-flexiblebox-css3-tests/pack.py +++ b/common/tct-flexiblebox-css3-tests/pack.py @@ -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: diff --git a/common/tct-fmradio-tizen-tests/inst.apk.py b/common/tct-fmradio-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-fmradio-tizen-tests/inst.apk.py +++ b/common/tct-fmradio-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-fmradio-tizen-tests/inst.wgt.py b/common/tct-fmradio-tizen-tests/inst.wgt.py index dc5e8b8b3..c6d1ddce7 100755 --- a/common/tct-fmradio-tizen-tests/inst.wgt.py +++ b/common/tct-fmradio-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-fmradio-tizen-tests/inst.xpk.py b/common/tct-fmradio-tizen-tests/inst.xpk.py index aa292c379..1e6b79908 100755 --- a/common/tct-fmradio-tizen-tests/inst.xpk.py +++ b/common/tct-fmradio-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-fmradio-tizen-tests/pack.py b/common/tct-fmradio-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-fmradio-tizen-tests/pack.py +++ b/common/tct-fmradio-tizen-tests/pack.py @@ -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: diff --git a/common/tct-fonts-css3-tests/inst.apk.py b/common/tct-fonts-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-fonts-css3-tests/inst.apk.py +++ b/common/tct-fonts-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-fonts-css3-tests/inst.wgt.py b/common/tct-fonts-css3-tests/inst.wgt.py index 122ddbf63..795d087c4 100755 --- a/common/tct-fonts-css3-tests/inst.wgt.py +++ b/common/tct-fonts-css3-tests/inst.wgt.py @@ -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) @@ -34,14 +34,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 @@ -210,8 +210,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: @@ -230,7 +230,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -242,10 +242,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: diff --git a/common/tct-fonts-css3-tests/inst.xpk.py b/common/tct-fonts-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-fonts-css3-tests/inst.xpk.py +++ b/common/tct-fonts-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-fonts-css3-tests/pack.py b/common/tct-fonts-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-fonts-css3-tests/pack.py +++ b/common/tct-fonts-css3-tests/pack.py @@ -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: diff --git a/common/tct-forms-html5-tests/inst.apk.py b/common/tct-forms-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-forms-html5-tests/inst.apk.py +++ b/common/tct-forms-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-forms-html5-tests/inst.wgt.py b/common/tct-forms-html5-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-forms-html5-tests/inst.wgt.py +++ b/common/tct-forms-html5-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-forms-html5-tests/inst.xpk.py b/common/tct-forms-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-forms-html5-tests/inst.xpk.py +++ b/common/tct-forms-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-forms-html5-tests/pack.py b/common/tct-forms-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-forms-html5-tests/pack.py +++ b/common/tct-forms-html5-tests/pack.py @@ -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: diff --git a/common/tct-fullscreen-nonw3c-tests/inst.apk.py b/common/tct-fullscreen-nonw3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-fullscreen-nonw3c-tests/inst.apk.py +++ b/common/tct-fullscreen-nonw3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-fullscreen-nonw3c-tests/inst.wgt.py b/common/tct-fullscreen-nonw3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-fullscreen-nonw3c-tests/inst.wgt.py +++ b/common/tct-fullscreen-nonw3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-fullscreen-nonw3c-tests/inst.xpk.py b/common/tct-fullscreen-nonw3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-fullscreen-nonw3c-tests/inst.xpk.py +++ b/common/tct-fullscreen-nonw3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-fullscreen-nonw3c-tests/pack.py b/common/tct-fullscreen-nonw3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-fullscreen-nonw3c-tests/pack.py +++ b/common/tct-fullscreen-nonw3c-tests/pack.py @@ -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: diff --git a/common/tct-geoallow-w3c-tests/inst.apk.py b/common/tct-geoallow-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-geoallow-w3c-tests/inst.apk.py +++ b/common/tct-geoallow-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-geoallow-w3c-tests/inst.wgt.py b/common/tct-geoallow-w3c-tests/inst.wgt.py index d4fcbeb70..e210b7d43 100755 --- a/common/tct-geoallow-w3c-tests/inst.wgt.py +++ b/common/tct-geoallow-w3c-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-geoallow-w3c-tests/inst.xpk.py b/common/tct-geoallow-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-geoallow-w3c-tests/inst.xpk.py +++ b/common/tct-geoallow-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-geoallow-w3c-tests/pack.py b/common/tct-geoallow-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-geoallow-w3c-tests/pack.py +++ b/common/tct-geoallow-w3c-tests/pack.py @@ -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: diff --git a/common/tct-geodeny-w3c-tests/inst.apk.py b/common/tct-geodeny-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-geodeny-w3c-tests/inst.apk.py +++ b/common/tct-geodeny-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-geodeny-w3c-tests/inst.wgt.py b/common/tct-geodeny-w3c-tests/inst.wgt.py index d4fcbeb70..e210b7d43 100755 --- a/common/tct-geodeny-w3c-tests/inst.wgt.py +++ b/common/tct-geodeny-w3c-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-geodeny-w3c-tests/inst.xpk.py b/common/tct-geodeny-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-geodeny-w3c-tests/inst.xpk.py +++ b/common/tct-geodeny-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-geodeny-w3c-tests/pack.py b/common/tct-geodeny-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-geodeny-w3c-tests/pack.py +++ b/common/tct-geodeny-w3c-tests/pack.py @@ -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: diff --git a/common/tct-globalization-cordova-tests/inst.apk.py b/common/tct-globalization-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-globalization-cordova-tests/inst.apk.py +++ b/common/tct-globalization-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-globalization-cordova-tests/inst.wgt.py b/common/tct-globalization-cordova-tests/inst.wgt.py index 1f51fd5ad..9604b1805 100755 --- a/common/tct-globalization-cordova-tests/inst.wgt.py +++ b/common/tct-globalization-cordova-tests/inst.wgt.py @@ -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 @@ -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) userCheck() @@ -214,10 +214,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: diff --git a/common/tct-globalization-cordova-tests/inst.xpk.py b/common/tct-globalization-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-globalization-cordova-tests/inst.xpk.py +++ b/common/tct-globalization-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-globalization-cordova-tests/pack.py b/common/tct-globalization-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-globalization-cordova-tests/pack.py +++ b/common/tct-globalization-cordova-tests/pack.py @@ -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: diff --git a/common/tct-gumallow-w3c-tests/inst.apk.py b/common/tct-gumallow-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-gumallow-w3c-tests/inst.apk.py +++ b/common/tct-gumallow-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-gumallow-w3c-tests/inst.wgt.py b/common/tct-gumallow-w3c-tests/inst.wgt.py index d4fcbeb70..e210b7d43 100755 --- a/common/tct-gumallow-w3c-tests/inst.wgt.py +++ b/common/tct-gumallow-w3c-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-gumallow-w3c-tests/inst.xpk.py b/common/tct-gumallow-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-gumallow-w3c-tests/inst.xpk.py +++ b/common/tct-gumallow-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-gumallow-w3c-tests/pack.py b/common/tct-gumallow-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-gumallow-w3c-tests/pack.py +++ b/common/tct-gumallow-w3c-tests/pack.py @@ -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: diff --git a/common/tct-humanactivitymonitor-tizen-tests/inst.apk.py b/common/tct-humanactivitymonitor-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-humanactivitymonitor-tizen-tests/inst.apk.py +++ b/common/tct-humanactivitymonitor-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-humanactivitymonitor-tizen-tests/inst.wgt.py b/common/tct-humanactivitymonitor-tizen-tests/inst.wgt.py index 851f32dae..a235446b2 100755 --- a/common/tct-humanactivitymonitor-tizen-tests/inst.wgt.py +++ b/common/tct-humanactivitymonitor-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -208,8 +208,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: @@ -228,7 +228,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -240,10 +240,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: diff --git a/common/tct-humanactivitymonitor-tizen-tests/inst.xpk.py b/common/tct-humanactivitymonitor-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-humanactivitymonitor-tizen-tests/inst.xpk.py +++ b/common/tct-humanactivitymonitor-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-humanactivitymonitor-tizen-tests/pack.py b/common/tct-humanactivitymonitor-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-humanactivitymonitor-tizen-tests/pack.py +++ b/common/tct-humanactivitymonitor-tizen-tests/pack.py @@ -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: diff --git a/common/tct-ime-tizen-tests/inst.apk.py b/common/tct-ime-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-ime-tizen-tests/inst.apk.py +++ b/common/tct-ime-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-ime-tizen-tests/inst.wgt.py b/common/tct-ime-tizen-tests/inst.wgt.py index 10347d27d..5edd24343 100755 --- a/common/tct-ime-tizen-tests/inst.wgt.py +++ b/common/tct-ime-tizen-tests/inst.wgt.py @@ -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: diff --git a/common/tct-ime-tizen-tests/inst.xpk.py b/common/tct-ime-tizen-tests/inst.xpk.py index c904d861a..191f5ff62 100755 --- a/common/tct-ime-tizen-tests/inst.xpk.py +++ b/common/tct-ime-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -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: diff --git a/common/tct-ime-tizen-tests/pack.py b/common/tct-ime-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-ime-tizen-tests/pack.py +++ b/common/tct-ime-tizen-tests/pack.py @@ -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: diff --git a/common/tct-indexeddb-w3c-tests/inst.apk.py b/common/tct-indexeddb-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-indexeddb-w3c-tests/inst.apk.py +++ b/common/tct-indexeddb-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-indexeddb-w3c-tests/inst.wgt.py b/common/tct-indexeddb-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-indexeddb-w3c-tests/inst.wgt.py +++ b/common/tct-indexeddb-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-indexeddb-w3c-tests/inst.xpk.py b/common/tct-indexeddb-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-indexeddb-w3c-tests/inst.xpk.py +++ b/common/tct-indexeddb-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-indexeddb-w3c-tests/pack.py b/common/tct-indexeddb-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-indexeddb-w3c-tests/pack.py +++ b/common/tct-indexeddb-w3c-tests/pack.py @@ -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: diff --git a/common/tct-inputdevice-tizen-tests/inst.apk.py b/common/tct-inputdevice-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-inputdevice-tizen-tests/inst.apk.py +++ b/common/tct-inputdevice-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-inputdevice-tizen-tests/inst.wgt.py b/common/tct-inputdevice-tizen-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-inputdevice-tizen-tests/inst.wgt.py +++ b/common/tct-inputdevice-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-inputdevice-tizen-tests/inst.xpk.py b/common/tct-inputdevice-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-inputdevice-tizen-tests/inst.xpk.py +++ b/common/tct-inputdevice-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-inputdevice-tizen-tests/pack.py b/common/tct-inputdevice-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-inputdevice-tizen-tests/pack.py +++ b/common/tct-inputdevice-tizen-tests/pack.py @@ -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: diff --git a/common/tct-iotcon-tizen-tests/inst.apk.py b/common/tct-iotcon-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-iotcon-tizen-tests/inst.apk.py +++ b/common/tct-iotcon-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-iotcon-tizen-tests/inst.wgt.py b/common/tct-iotcon-tizen-tests/inst.wgt.py index 2a5d8ad03..76475d82b 100755 --- a/common/tct-iotcon-tizen-tests/inst.wgt.py +++ b/common/tct-iotcon-tizen-tests/inst.wgt.py @@ -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 @@ -192,8 +192,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: @@ -212,7 +212,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -224,10 +224,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: diff --git a/common/tct-iotcon-tizen-tests/inst.xpk.py b/common/tct-iotcon-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-iotcon-tizen-tests/inst.xpk.py +++ b/common/tct-iotcon-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-iotcon-tizen-tests/pack.py b/common/tct-iotcon-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-iotcon-tizen-tests/pack.py +++ b/common/tct-iotcon-tizen-tests/pack.py @@ -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: diff --git a/common/tct-jsenhance-html5-tests/inst.apk.py b/common/tct-jsenhance-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-jsenhance-html5-tests/inst.apk.py +++ b/common/tct-jsenhance-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-jsenhance-html5-tests/inst.wgt.py b/common/tct-jsenhance-html5-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-jsenhance-html5-tests/inst.wgt.py +++ b/common/tct-jsenhance-html5-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-jsenhance-html5-tests/inst.xpk.py b/common/tct-jsenhance-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-jsenhance-html5-tests/inst.xpk.py +++ b/common/tct-jsenhance-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-jsenhance-html5-tests/pack.py b/common/tct-jsenhance-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-jsenhance-html5-tests/pack.py +++ b/common/tct-jsenhance-html5-tests/pack.py @@ -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: diff --git a/common/tct-keymanager-tizen-tests/inst.apk.py b/common/tct-keymanager-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-keymanager-tizen-tests/inst.apk.py +++ b/common/tct-keymanager-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-keymanager-tizen-tests/inst.wgt.py b/common/tct-keymanager-tizen-tests/inst.wgt.py index dff1eedb2..4a54d50a3 100755 --- a/common/tct-keymanager-tizen-tests/inst.wgt.py +++ b/common/tct-keymanager-tizen-tests/inst.wgt.py @@ -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 @@ -187,8 +187,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: @@ -207,7 +207,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -219,10 +219,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: diff --git a/common/tct-keymanager-tizen-tests/inst.xpk.py b/common/tct-keymanager-tizen-tests/inst.xpk.py index bfad76c33..1c0e2dd03 100755 --- a/common/tct-keymanager-tizen-tests/inst.xpk.py +++ b/common/tct-keymanager-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/common/tct-keymanager-tizen-tests/pack.py b/common/tct-keymanager-tizen-tests/pack.py index 08d55aafe..92866ab2e 100755 --- a/common/tct-keymanager-tizen-tests/pack.py +++ b/common/tct-keymanager-tizen-tests/pack.py @@ -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: diff --git a/common/tct-media-cordova-tests/inst.apk.py b/common/tct-media-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-media-cordova-tests/inst.apk.py +++ b/common/tct-media-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-media-cordova-tests/inst.wgt.py b/common/tct-media-cordova-tests/inst.wgt.py index 36c333276..bd1954653 100755 --- a/common/tct-media-cordova-tests/inst.wgt.py +++ b/common/tct-media-cordova-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -210,8 +210,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: @@ -230,7 +230,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -242,10 +242,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: diff --git a/common/tct-media-cordova-tests/inst.xpk.py b/common/tct-media-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-media-cordova-tests/inst.xpk.py +++ b/common/tct-media-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-media-cordova-tests/pack.py b/common/tct-media-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-media-cordova-tests/pack.py +++ b/common/tct-media-cordova-tests/pack.py @@ -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: diff --git a/common/tct-mediacapture-w3c-tests/inst.apk.py b/common/tct-mediacapture-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mediacapture-w3c-tests/inst.apk.py +++ b/common/tct-mediacapture-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mediacapture-w3c-tests/inst.wgt.py b/common/tct-mediacapture-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-mediacapture-w3c-tests/inst.wgt.py +++ b/common/tct-mediacapture-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-mediacapture-w3c-tests/inst.xpk.py b/common/tct-mediacapture-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-mediacapture-w3c-tests/inst.xpk.py +++ b/common/tct-mediacapture-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-mediacapture-w3c-tests/pack.py b/common/tct-mediacapture-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-mediacapture-w3c-tests/pack.py +++ b/common/tct-mediacapture-w3c-tests/pack.py @@ -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: diff --git a/common/tct-mediacontroller-tizen-tests/inst.apk.py b/common/tct-mediacontroller-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mediacontroller-tizen-tests/inst.apk.py +++ b/common/tct-mediacontroller-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mediacontroller-tizen-tests/inst.wgt.py b/common/tct-mediacontroller-tizen-tests/inst.wgt.py index f35c72947..376418451 100755 --- a/common/tct-mediacontroller-tizen-tests/inst.wgt.py +++ b/common/tct-mediacontroller-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -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) userCheck() @@ -215,10 +215,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: diff --git a/common/tct-mediacontroller-tizen-tests/inst.xpk.py b/common/tct-mediacontroller-tizen-tests/inst.xpk.py index aa292c379..1e6b79908 100755 --- a/common/tct-mediacontroller-tizen-tests/inst.xpk.py +++ b/common/tct-mediacontroller-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mediacontroller-tizen-tests/pack.py b/common/tct-mediacontroller-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-mediacontroller-tizen-tests/pack.py +++ b/common/tct-mediacontroller-tizen-tests/pack.py @@ -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: diff --git a/common/tct-mediakey-tizen-tests/inst.apk.py b/common/tct-mediakey-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mediakey-tizen-tests/inst.apk.py +++ b/common/tct-mediakey-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mediakey-tizen-tests/inst.wgt.py b/common/tct-mediakey-tizen-tests/inst.wgt.py index 44e57cf17..d46e4924e 100755 --- a/common/tct-mediakey-tizen-tests/inst.wgt.py +++ b/common/tct-mediakey-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-mediakey-tizen-tests/inst.xpk.py b/common/tct-mediakey-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-mediakey-tizen-tests/inst.xpk.py +++ b/common/tct-mediakey-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-mediakey-tizen-tests/pack.py b/common/tct-mediakey-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-mediakey-tizen-tests/pack.py +++ b/common/tct-mediakey-tizen-tests/pack.py @@ -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: diff --git a/common/tct-mediaqueries-css3-tests/inst.apk.py b/common/tct-mediaqueries-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mediaqueries-css3-tests/inst.apk.py +++ b/common/tct-mediaqueries-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mediaqueries-css3-tests/inst.wgt.py b/common/tct-mediaqueries-css3-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-mediaqueries-css3-tests/inst.wgt.py +++ b/common/tct-mediaqueries-css3-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-mediaqueries-css3-tests/inst.xpk.py b/common/tct-mediaqueries-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-mediaqueries-css3-tests/inst.xpk.py +++ b/common/tct-mediaqueries-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-mediaqueries-css3-tests/pack.py b/common/tct-mediaqueries-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-mediaqueries-css3-tests/pack.py +++ b/common/tct-mediaqueries-css3-tests/pack.py @@ -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: diff --git a/common/tct-messageport-tizen-tests/inst.apk.py b/common/tct-messageport-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-messageport-tizen-tests/inst.apk.py +++ b/common/tct-messageport-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-messageport-tizen-tests/inst.wgt.py b/common/tct-messageport-tizen-tests/inst.wgt.py index 244c4552d..902845671 100755 --- a/common/tct-messageport-tizen-tests/inst.wgt.py +++ b/common/tct-messageport-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -184,8 +184,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: @@ -204,7 +204,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -216,10 +216,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: diff --git a/common/tct-messageport-tizen-tests/inst.xpk.py b/common/tct-messageport-tizen-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-messageport-tizen-tests/inst.xpk.py +++ b/common/tct-messageport-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-messageport-tizen-tests/pack.py b/common/tct-messageport-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-messageport-tizen-tests/pack.py +++ b/common/tct-messageport-tizen-tests/pack.py @@ -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: diff --git a/common/tct-messaging-email-tizen-tests/inst.apk.py b/common/tct-messaging-email-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-messaging-email-tizen-tests/inst.apk.py +++ b/common/tct-messaging-email-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-messaging-email-tizen-tests/inst.wgt.py b/common/tct-messaging-email-tizen-tests/inst.wgt.py index ea1c0dfa3..ec51f5207 100755 --- a/common/tct-messaging-email-tizen-tests/inst.wgt.py +++ b/common/tct-messaging-email-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -207,8 +207,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: @@ -227,7 +227,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -239,10 +239,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: diff --git a/common/tct-messaging-email-tizen-tests/inst.xpk.py b/common/tct-messaging-email-tizen-tests/inst.xpk.py index 2b5e3f2e1..4cd2306f2 100755 --- a/common/tct-messaging-email-tizen-tests/inst.xpk.py +++ b/common/tct-messaging-email-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/common/tct-messaging-email-tizen-tests/pack.py b/common/tct-messaging-email-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-messaging-email-tizen-tests/pack.py +++ b/common/tct-messaging-email-tizen-tests/pack.py @@ -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: diff --git a/common/tct-messaging-mms-tizen-tests/inst.apk.py b/common/tct-messaging-mms-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-messaging-mms-tizen-tests/inst.apk.py +++ b/common/tct-messaging-mms-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-messaging-mms-tizen-tests/inst.wgt.py b/common/tct-messaging-mms-tizen-tests/inst.wgt.py index 71805b47f..fd2e87dda 100755 --- a/common/tct-messaging-mms-tizen-tests/inst.wgt.py +++ b/common/tct-messaging-mms-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-messaging-mms-tizen-tests/inst.xpk.py b/common/tct-messaging-mms-tizen-tests/inst.xpk.py index 2b5e3f2e1..4cd2306f2 100755 --- a/common/tct-messaging-mms-tizen-tests/inst.xpk.py +++ b/common/tct-messaging-mms-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/common/tct-messaging-mms-tizen-tests/pack.py b/common/tct-messaging-mms-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-messaging-mms-tizen-tests/pack.py +++ b/common/tct-messaging-mms-tizen-tests/pack.py @@ -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: diff --git a/common/tct-messaging-sms-tizen-tests/inst.apk.py b/common/tct-messaging-sms-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-messaging-sms-tizen-tests/inst.apk.py +++ b/common/tct-messaging-sms-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-messaging-sms-tizen-tests/inst.wgt.py b/common/tct-messaging-sms-tizen-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/common/tct-messaging-sms-tizen-tests/inst.wgt.py +++ b/common/tct-messaging-sms-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-messaging-sms-tizen-tests/inst.xpk.py b/common/tct-messaging-sms-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-messaging-sms-tizen-tests/inst.xpk.py +++ b/common/tct-messaging-sms-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-messaging-sms-tizen-tests/pack.py b/common/tct-messaging-sms-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-messaging-sms-tizen-tests/pack.py +++ b/common/tct-messaging-sms-tizen-tests/pack.py @@ -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: diff --git a/common/tct-metadata-tizen-tests/inst.apk.py b/common/tct-metadata-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-metadata-tizen-tests/inst.apk.py +++ b/common/tct-metadata-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-metadata-tizen-tests/inst.wgt.py b/common/tct-metadata-tizen-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-metadata-tizen-tests/inst.wgt.py +++ b/common/tct-metadata-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-metadata-tizen-tests/inst.xpk.py b/common/tct-metadata-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-metadata-tizen-tests/inst.xpk.py +++ b/common/tct-metadata-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-metadata-tizen-tests/pack.py b/common/tct-metadata-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-metadata-tizen-tests/pack.py +++ b/common/tct-metadata-tizen-tests/pack.py @@ -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: diff --git a/common/tct-ml-tizen-tests/inst.apk.py b/common/tct-ml-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-ml-tizen-tests/inst.apk.py +++ b/common/tct-ml-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-ml-tizen-tests/inst.wgt.py b/common/tct-ml-tizen-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-ml-tizen-tests/inst.wgt.py +++ b/common/tct-ml-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-ml-tizen-tests/inst.xpk.py b/common/tct-ml-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-ml-tizen-tests/inst.xpk.py +++ b/common/tct-ml-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-ml-tizen-tests/pack.py b/common/tct-ml-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-ml-tizen-tests/pack.py +++ b/common/tct-ml-tizen-tests/pack.py @@ -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: diff --git a/common/tct-mlpipeline-tizen-tests/inst.apk.py b/common/tct-mlpipeline-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mlpipeline-tizen-tests/inst.apk.py +++ b/common/tct-mlpipeline-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mlpipeline-tizen-tests/inst.wgt.py b/common/tct-mlpipeline-tizen-tests/inst.wgt.py index 70534429f..ecdac7ff6 100755 --- a/common/tct-mlpipeline-tizen-tests/inst.wgt.py +++ b/common/tct-mlpipeline-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -204,8 +204,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: @@ -224,7 +224,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -236,10 +236,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: diff --git a/common/tct-mlpipeline-tizen-tests/inst.xpk.py b/common/tct-mlpipeline-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-mlpipeline-tizen-tests/inst.xpk.py +++ b/common/tct-mlpipeline-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-mlpipeline-tizen-tests/pack.py b/common/tct-mlpipeline-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-mlpipeline-tizen-tests/pack.py +++ b/common/tct-mlpipeline-tizen-tests/pack.py @@ -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: diff --git a/common/tct-mlsingleshot-tizen-tests/inst.apk.py b/common/tct-mlsingleshot-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mlsingleshot-tizen-tests/inst.apk.py +++ b/common/tct-mlsingleshot-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mlsingleshot-tizen-tests/inst.wgt.py b/common/tct-mlsingleshot-tizen-tests/inst.wgt.py index 39ee7a0c0..1459d2c88 100755 --- a/common/tct-mlsingleshot-tizen-tests/inst.wgt.py +++ b/common/tct-mlsingleshot-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -219,8 +219,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: @@ -239,7 +239,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -251,10 +251,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: diff --git a/common/tct-mlsingleshot-tizen-tests/inst.xpk.py b/common/tct-mlsingleshot-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-mlsingleshot-tizen-tests/inst.xpk.py +++ b/common/tct-mlsingleshot-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-mlsingleshot-tizen-tests/pack.py b/common/tct-mlsingleshot-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-mlsingleshot-tizen-tests/pack.py +++ b/common/tct-mlsingleshot-tizen-tests/pack.py @@ -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: diff --git a/common/tct-mse-w3c-tests/inst.apk.py b/common/tct-mse-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-mse-w3c-tests/inst.apk.py +++ b/common/tct-mse-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-mse-w3c-tests/inst.wgt.py b/common/tct-mse-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-mse-w3c-tests/inst.wgt.py +++ b/common/tct-mse-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-mse-w3c-tests/inst.xpk.py b/common/tct-mse-w3c-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-mse-w3c-tests/inst.xpk.py +++ b/common/tct-mse-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-mse-w3c-tests/pack.py b/common/tct-mse-w3c-tests/pack.py index d2ee57294..134a17a07 100755 --- a/common/tct-mse-w3c-tests/pack.py +++ b/common/tct-mse-w3c-tests/pack.py @@ -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: diff --git a/common/tct-multicolumn-css3-tests/inst.apk.py b/common/tct-multicolumn-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-multicolumn-css3-tests/inst.apk.py +++ b/common/tct-multicolumn-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-multicolumn-css3-tests/inst.wgt.py b/common/tct-multicolumn-css3-tests/inst.wgt.py index c7f89fd44..909755af3 100755 --- a/common/tct-multicolumn-css3-tests/inst.wgt.py +++ b/common/tct-multicolumn-css3-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-multicolumn-css3-tests/inst.xpk.py b/common/tct-multicolumn-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-multicolumn-css3-tests/inst.xpk.py +++ b/common/tct-multicolumn-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-multicolumn-css3-tests/pack.py b/common/tct-multicolumn-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-multicolumn-css3-tests/pack.py +++ b/common/tct-multicolumn-css3-tests/pack.py @@ -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: diff --git a/common/tct-namespace-tizen-tests/inst.apk.py b/common/tct-namespace-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-namespace-tizen-tests/inst.apk.py +++ b/common/tct-namespace-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-namespace-tizen-tests/inst.wgt.py b/common/tct-namespace-tizen-tests/inst.wgt.py index 44e57cf17..d46e4924e 100755 --- a/common/tct-namespace-tizen-tests/inst.wgt.py +++ b/common/tct-namespace-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-namespace-tizen-tests/inst.xpk.py b/common/tct-namespace-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-namespace-tizen-tests/inst.xpk.py +++ b/common/tct-namespace-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-namespace-tizen-tests/pack.py b/common/tct-namespace-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-namespace-tizen-tests/pack.py +++ b/common/tct-namespace-tizen-tests/pack.py @@ -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: diff --git a/common/tct-navigationtiming-w3c-tests/inst.apk.py b/common/tct-navigationtiming-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-navigationtiming-w3c-tests/inst.apk.py +++ b/common/tct-navigationtiming-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-navigationtiming-w3c-tests/inst.wgt.py b/common/tct-navigationtiming-w3c-tests/inst.wgt.py index dd614f265..b30f310f4 100755 --- a/common/tct-navigationtiming-w3c-tests/inst.wgt.py +++ b/common/tct-navigationtiming-w3c-tests/inst.wgt.py @@ -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 @@ -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) userCheck() @@ -215,10 +215,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: diff --git a/common/tct-navigationtiming-w3c-tests/inst.xpk.py b/common/tct-navigationtiming-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-navigationtiming-w3c-tests/inst.xpk.py +++ b/common/tct-navigationtiming-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-navigationtiming-w3c-tests/pack.py b/common/tct-navigationtiming-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-navigationtiming-w3c-tests/pack.py +++ b/common/tct-navigationtiming-w3c-tests/pack.py @@ -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: diff --git a/common/tct-network-information-cordova-tests/inst.apk.py b/common/tct-network-information-cordova-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-network-information-cordova-tests/inst.apk.py +++ b/common/tct-network-information-cordova-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-network-information-cordova-tests/inst.wgt.py b/common/tct-network-information-cordova-tests/inst.wgt.py index 128023f51..e8fac2aba 100755 --- a/common/tct-network-information-cordova-tests/inst.wgt.py +++ b/common/tct-network-information-cordova-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -201,8 +201,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: @@ -221,7 +221,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -233,10 +233,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: diff --git a/common/tct-network-information-cordova-tests/inst.xpk.py b/common/tct-network-information-cordova-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-network-information-cordova-tests/inst.xpk.py +++ b/common/tct-network-information-cordova-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-network-information-cordova-tests/pack.py b/common/tct-network-information-cordova-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-network-information-cordova-tests/pack.py +++ b/common/tct-network-information-cordova-tests/pack.py @@ -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: diff --git a/common/tct-networkbearerselection-tizen-tests/inst.apk.py b/common/tct-networkbearerselection-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-networkbearerselection-tizen-tests/inst.apk.py +++ b/common/tct-networkbearerselection-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-networkbearerselection-tizen-tests/inst.wgt.py b/common/tct-networkbearerselection-tizen-tests/inst.wgt.py index dc5e8b8b3..c6d1ddce7 100755 --- a/common/tct-networkbearerselection-tizen-tests/inst.wgt.py +++ b/common/tct-networkbearerselection-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-networkbearerselection-tizen-tests/inst.xpk.py b/common/tct-networkbearerselection-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-networkbearerselection-tizen-tests/inst.xpk.py +++ b/common/tct-networkbearerselection-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-networkbearerselection-tizen-tests/pack.py b/common/tct-networkbearerselection-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-networkbearerselection-tizen-tests/pack.py +++ b/common/tct-networkbearerselection-tizen-tests/pack.py @@ -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: diff --git a/common/tct-nfc-tizen-tests/inst.apk.py b/common/tct-nfc-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-nfc-tizen-tests/inst.apk.py +++ b/common/tct-nfc-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-nfc-tizen-tests/inst.wgt.py b/common/tct-nfc-tizen-tests/inst.wgt.py index 2dd4ce674..3f810e860 100755 --- a/common/tct-nfc-tizen-tests/inst.wgt.py +++ b/common/tct-nfc-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -199,8 +199,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: @@ -219,7 +219,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -231,10 +231,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: diff --git a/common/tct-nfc-tizen-tests/inst.xpk.py b/common/tct-nfc-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-nfc-tizen-tests/inst.xpk.py +++ b/common/tct-nfc-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-nfc-tizen-tests/pack.py b/common/tct-nfc-tizen-tests/pack.py index 0ba04d037..ed803130a 100755 --- a/common/tct-nfc-tizen-tests/pack.py +++ b/common/tct-nfc-tizen-tests/pack.py @@ -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: @@ -940,7 +940,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: diff --git a/common/tct-notification-tizen-tests/inst.apk.py b/common/tct-notification-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-notification-tizen-tests/inst.apk.py +++ b/common/tct-notification-tizen-tests/inst.apk.py @@ -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: diff --git a/common/tct-notification-tizen-tests/inst.wgt.py b/common/tct-notification-tizen-tests/inst.wgt.py index 802b9e785..d40f6c0d4 100755 --- a/common/tct-notification-tizen-tests/inst.wgt.py +++ b/common/tct-notification-tizen-tests/inst.wgt.py @@ -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 @@ -197,8 +197,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: @@ -217,7 +217,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -229,10 +229,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: diff --git a/common/tct-notification-tizen-tests/inst.xpk.py b/common/tct-notification-tizen-tests/inst.xpk.py index c904d861a..7e0d91324 100755 --- a/common/tct-notification-tizen-tests/inst.xpk.py +++ b/common/tct-notification-tizen-tests/inst.xpk.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -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: diff --git a/common/tct-notification-tizen-tests/pack.py b/common/tct-notification-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-notification-tizen-tests/pack.py +++ b/common/tct-notification-tizen-tests/pack.py @@ -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: diff --git a/common/tct-notification-w3c-tests/inst.apk.py b/common/tct-notification-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-notification-w3c-tests/inst.apk.py +++ b/common/tct-notification-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-notification-w3c-tests/inst.wgt.py b/common/tct-notification-w3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-notification-w3c-tests/inst.wgt.py +++ b/common/tct-notification-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-notification-w3c-tests/inst.xpk.py b/common/tct-notification-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-notification-w3c-tests/inst.xpk.py +++ b/common/tct-notification-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-notification-w3c-tests/pack.py b/common/tct-notification-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-notification-w3c-tests/pack.py +++ b/common/tct-notification-w3c-tests/pack.py @@ -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: diff --git a/common/tct-package-tizen-tests/inst.apk.py b/common/tct-package-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-package-tizen-tests/inst.apk.py +++ b/common/tct-package-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-package-tizen-tests/inst.wgt.py b/common/tct-package-tizen-tests/inst.wgt.py index 26774c69d..d6e2e20f3 100755 --- a/common/tct-package-tizen-tests/inst.wgt.py +++ b/common/tct-package-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-package-tizen-tests/inst.xpk.py b/common/tct-package-tizen-tests/inst.xpk.py index 22a25cec5..0af149613 100755 --- a/common/tct-package-tizen-tests/inst.xpk.py +++ b/common/tct-package-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-package-tizen-tests/pack.py b/common/tct-package-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-package-tizen-tests/pack.py +++ b/common/tct-package-tizen-tests/pack.py @@ -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: diff --git a/common/tct-pagevisibility-w3c-tests/inst.apk.py b/common/tct-pagevisibility-w3c-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-pagevisibility-w3c-tests/inst.apk.py +++ b/common/tct-pagevisibility-w3c-tests/inst.apk.py @@ -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: diff --git a/common/tct-pagevisibility-w3c-tests/inst.wgt.py b/common/tct-pagevisibility-w3c-tests/inst.wgt.py index 93ac8ad71..670f31e95 100755 --- a/common/tct-pagevisibility-w3c-tests/inst.wgt.py +++ b/common/tct-pagevisibility-w3c-tests/inst.wgt.py @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-pagevisibility-w3c-tests/inst.xpk.py b/common/tct-pagevisibility-w3c-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/common/tct-pagevisibility-w3c-tests/inst.xpk.py +++ b/common/tct-pagevisibility-w3c-tests/inst.xpk.py @@ -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: diff --git a/common/tct-pagevisibility-w3c-tests/pack.py b/common/tct-pagevisibility-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-pagevisibility-w3c-tests/pack.py +++ b/common/tct-pagevisibility-w3c-tests/pack.py @@ -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: diff --git a/common/tct-playerutil-tizen-tests/inst.apk.py b/common/tct-playerutil-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-playerutil-tizen-tests/inst.apk.py +++ b/common/tct-playerutil-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-playerutil-tizen-tests/inst.wgt.py b/common/tct-playerutil-tizen-tests/inst.wgt.py index c7f89fd44..909755af3 100755 --- a/common/tct-playerutil-tizen-tests/inst.wgt.py +++ b/common/tct-playerutil-tizen-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-playerutil-tizen-tests/inst.xpk.py b/common/tct-playerutil-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-playerutil-tizen-tests/inst.xpk.py +++ b/common/tct-playerutil-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-playerutil-tizen-tests/pack.py b/common/tct-playerutil-tizen-tests/pack.py index 08d55aafe..92866ab2e 100755 --- a/common/tct-playerutil-tizen-tests/pack.py +++ b/common/tct-playerutil-tizen-tests/pack.py @@ -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: diff --git a/common/tct-power-tizen-tests/inst.apk.py b/common/tct-power-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-power-tizen-tests/inst.apk.py +++ b/common/tct-power-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-power-tizen-tests/inst.wgt.py b/common/tct-power-tizen-tests/inst.wgt.py index ca95382d7..ee60af745 100755 --- a/common/tct-power-tizen-tests/inst.wgt.py +++ b/common/tct-power-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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: diff --git a/common/tct-power-tizen-tests/inst.xpk.py b/common/tct-power-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-power-tizen-tests/inst.xpk.py +++ b/common/tct-power-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-power-tizen-tests/pack.py b/common/tct-power-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-power-tizen-tests/pack.py +++ b/common/tct-power-tizen-tests/pack.py @@ -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: diff --git a/common/tct-preference-tizen-tests/inst.apk.py b/common/tct-preference-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-preference-tizen-tests/inst.apk.py +++ b/common/tct-preference-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-preference-tizen-tests/inst.wgt.py b/common/tct-preference-tizen-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-preference-tizen-tests/inst.wgt.py +++ b/common/tct-preference-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-preference-tizen-tests/inst.xpk.py b/common/tct-preference-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-preference-tizen-tests/inst.xpk.py +++ b/common/tct-preference-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-preference-tizen-tests/pack.py b/common/tct-preference-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-preference-tizen-tests/pack.py +++ b/common/tct-preference-tizen-tests/pack.py @@ -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: diff --git a/common/tct-privacyprivilege-tizen-tests/inst.apk.py b/common/tct-privacyprivilege-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-privacyprivilege-tizen-tests/inst.apk.py +++ b/common/tct-privacyprivilege-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-privacyprivilege-tizen-tests/inst.wgt.py b/common/tct-privacyprivilege-tizen-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/common/tct-privacyprivilege-tizen-tests/inst.wgt.py +++ b/common/tct-privacyprivilege-tizen-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-privacyprivilege-tizen-tests/inst.xpk.py b/common/tct-privacyprivilege-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-privacyprivilege-tizen-tests/inst.xpk.py +++ b/common/tct-privacyprivilege-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-privacyprivilege-tizen-tests/pack.py b/common/tct-privacyprivilege-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-privacyprivilege-tizen-tests/pack.py +++ b/common/tct-privacyprivilege-tizen-tests/pack.py @@ -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: diff --git a/common/tct-privilege-tizen-tests/inst.apk.py b/common/tct-privilege-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-privilege-tizen-tests/inst.apk.py +++ b/common/tct-privilege-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-privilege-tizen-tests/inst.wgt.py b/common/tct-privilege-tizen-tests/inst.wgt.py index 44e57cf17..d46e4924e 100755 --- a/common/tct-privilege-tizen-tests/inst.wgt.py +++ b/common/tct-privilege-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-privilege-tizen-tests/inst.xpk.py b/common/tct-privilege-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-privilege-tizen-tests/inst.xpk.py +++ b/common/tct-privilege-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-privilege-tizen-tests/pack.py b/common/tct-privilege-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-privilege-tizen-tests/pack.py +++ b/common/tct-privilege-tizen-tests/pack.py @@ -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: diff --git a/common/tct-push-tizen-tests/inst.apk.py b/common/tct-push-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-push-tizen-tests/inst.apk.py +++ b/common/tct-push-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-push-tizen-tests/inst.wgt.py b/common/tct-push-tizen-tests/inst.wgt.py index e32732b34..8e0d9ef1a 100755 --- a/common/tct-push-tizen-tests/inst.wgt.py +++ b/common/tct-push-tizen-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/common/tct-push-tizen-tests/inst.xpk.py b/common/tct-push-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-push-tizen-tests/inst.xpk.py +++ b/common/tct-push-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-push-tizen-tests/pack.py b/common/tct-push-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-push-tizen-tests/pack.py +++ b/common/tct-push-tizen-tests/pack.py @@ -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: diff --git a/common/tct-push-w3c-tests/inst.apk.py b/common/tct-push-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/common/tct-push-w3c-tests/inst.apk.py +++ b/common/tct-push-w3c-tests/inst.apk.py @@ -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: diff --git a/common/tct-push-w3c-tests/inst.wgt.py b/common/tct-push-w3c-tests/inst.wgt.py index 145211488..36be2eb51 100755 --- a/common/tct-push-w3c-tests/inst.wgt.py +++ b/common/tct-push-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-push-w3c-tests/inst.xpk.py b/common/tct-push-w3c-tests/inst.xpk.py index 85b97b93f..3c5075e3e 100755 --- a/common/tct-push-w3c-tests/inst.xpk.py +++ b/common/tct-push-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/common/tct-push-w3c-tests/pack.py b/common/tct-push-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-push-w3c-tests/pack.py +++ b/common/tct-push-w3c-tests/pack.py @@ -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: diff --git a/common/tct-sandbox-html5-tests/inst.apk.py b/common/tct-sandbox-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-sandbox-html5-tests/inst.apk.py +++ b/common/tct-sandbox-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-sandbox-html5-tests/inst.wgt.py b/common/tct-sandbox-html5-tests/inst.wgt.py index 9c17c1ad7..d442317ad 100755 --- a/common/tct-sandbox-html5-tests/inst.wgt.py +++ b/common/tct-sandbox-html5-tests/inst.wgt.py @@ -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 @@ -185,8 +185,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: @@ -205,7 +205,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -217,10 +217,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: diff --git a/common/tct-sandbox-html5-tests/inst.xpk.py b/common/tct-sandbox-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-sandbox-html5-tests/inst.xpk.py +++ b/common/tct-sandbox-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-sandbox-html5-tests/pack.py b/common/tct-sandbox-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-sandbox-html5-tests/pack.py +++ b/common/tct-sandbox-html5-tests/pack.py @@ -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: diff --git a/common/tct-screenorientation-w3c-tests/inst.apk.py b/common/tct-screenorientation-w3c-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-screenorientation-w3c-tests/inst.apk.py +++ b/common/tct-screenorientation-w3c-tests/inst.apk.py @@ -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: diff --git a/common/tct-screenorientation-w3c-tests/inst.wgt.py b/common/tct-screenorientation-w3c-tests/inst.wgt.py index 93ac8ad71..670f31e95 100755 --- a/common/tct-screenorientation-w3c-tests/inst.wgt.py +++ b/common/tct-screenorientation-w3c-tests/inst.wgt.py @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-screenorientation-w3c-tests/inst.xpk.py b/common/tct-screenorientation-w3c-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/common/tct-screenorientation-w3c-tests/inst.xpk.py +++ b/common/tct-screenorientation-w3c-tests/inst.xpk.py @@ -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: diff --git a/common/tct-screenorientation-w3c-tests/pack.py b/common/tct-screenorientation-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-screenorientation-w3c-tests/pack.py +++ b/common/tct-screenorientation-w3c-tests/pack.py @@ -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: diff --git a/common/tct-secureelement-tizen-tests/inst.apk.py b/common/tct-secureelement-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-secureelement-tizen-tests/inst.apk.py +++ b/common/tct-secureelement-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-secureelement-tizen-tests/inst.wgt.py b/common/tct-secureelement-tizen-tests/inst.wgt.py index d4d5dc5df..d88ca1890 100755 --- a/common/tct-secureelement-tizen-tests/inst.wgt.py +++ b/common/tct-secureelement-tizen-tests/inst.wgt.py @@ -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 @@ -202,8 +202,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: @@ -222,7 +222,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -234,10 +234,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: diff --git a/common/tct-secureelement-tizen-tests/inst.xpk.py b/common/tct-secureelement-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-secureelement-tizen-tests/inst.xpk.py +++ b/common/tct-secureelement-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-secureelement-tizen-tests/pack.py b/common/tct-secureelement-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-secureelement-tizen-tests/pack.py +++ b/common/tct-secureelement-tizen-tests/pack.py @@ -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: diff --git a/common/tct-security-tcs-tests/inst.apk.py b/common/tct-security-tcs-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-security-tcs-tests/inst.apk.py +++ b/common/tct-security-tcs-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-security-tcs-tests/inst.wgt.py b/common/tct-security-tcs-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-security-tcs-tests/inst.wgt.py +++ b/common/tct-security-tcs-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-security-tcs-tests/inst.xpk.py b/common/tct-security-tcs-tests/inst.xpk.py index c0c358ecc..9b2adfedd 100755 --- a/common/tct-security-tcs-tests/inst.xpk.py +++ b/common/tct-security-tcs-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -166,8 +166,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: @@ -186,7 +186,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -196,10 +196,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: diff --git a/common/tct-security-tcs-tests/pack.py b/common/tct-security-tcs-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-security-tcs-tests/pack.py +++ b/common/tct-security-tcs-tests/pack.py @@ -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: diff --git a/common/tct-selectorslevel1-w3c-tests/inst.apk.py b/common/tct-selectorslevel1-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-selectorslevel1-w3c-tests/inst.apk.py +++ b/common/tct-selectorslevel1-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-selectorslevel1-w3c-tests/inst.wgt.py b/common/tct-selectorslevel1-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-selectorslevel1-w3c-tests/inst.wgt.py +++ b/common/tct-selectorslevel1-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-selectorslevel1-w3c-tests/inst.xpk.py b/common/tct-selectorslevel1-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-selectorslevel1-w3c-tests/inst.xpk.py +++ b/common/tct-selectorslevel1-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-selectorslevel1-w3c-tests/pack.py b/common/tct-selectorslevel1-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-selectorslevel1-w3c-tests/pack.py +++ b/common/tct-selectorslevel1-w3c-tests/pack.py @@ -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: diff --git a/common/tct-selectorslevel2-w3c-tests/inst.apk.py b/common/tct-selectorslevel2-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-selectorslevel2-w3c-tests/inst.apk.py +++ b/common/tct-selectorslevel2-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-selectorslevel2-w3c-tests/inst.wgt.py b/common/tct-selectorslevel2-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-selectorslevel2-w3c-tests/inst.wgt.py +++ b/common/tct-selectorslevel2-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-selectorslevel2-w3c-tests/inst.xpk.py b/common/tct-selectorslevel2-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-selectorslevel2-w3c-tests/inst.xpk.py +++ b/common/tct-selectorslevel2-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-selectorslevel2-w3c-tests/pack.py b/common/tct-selectorslevel2-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-selectorslevel2-w3c-tests/pack.py +++ b/common/tct-selectorslevel2-w3c-tests/pack.py @@ -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: diff --git a/common/tct-sensor-tizen-tests/inst.apk.py b/common/tct-sensor-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-sensor-tizen-tests/inst.apk.py +++ b/common/tct-sensor-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-sensor-tizen-tests/inst.wgt.py b/common/tct-sensor-tizen-tests/inst.wgt.py index 3ef2cf1df..a25e5a554 100755 --- a/common/tct-sensor-tizen-tests/inst.wgt.py +++ b/common/tct-sensor-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -207,8 +207,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: @@ -227,7 +227,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -239,10 +239,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: diff --git a/common/tct-sensor-tizen-tests/inst.xpk.py b/common/tct-sensor-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-sensor-tizen-tests/inst.xpk.py +++ b/common/tct-sensor-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-sensor-tizen-tests/pack.py b/common/tct-sensor-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-sensor-tizen-tests/pack.py +++ b/common/tct-sensor-tizen-tests/pack.py @@ -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: diff --git a/common/tct-serviceworkers-w3c-tests/inst.apk.py b/common/tct-serviceworkers-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-serviceworkers-w3c-tests/inst.apk.py +++ b/common/tct-serviceworkers-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-serviceworkers-w3c-tests/inst.wgt.py b/common/tct-serviceworkers-w3c-tests/inst.wgt.py index f0baddaf5..92dd9055d 100755 --- a/common/tct-serviceworkers-w3c-tests/inst.wgt.py +++ b/common/tct-serviceworkers-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -185,8 +185,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: @@ -205,7 +205,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -217,10 +217,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: diff --git a/common/tct-serviceworkers-w3c-tests/inst.xpk.py b/common/tct-serviceworkers-w3c-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-serviceworkers-w3c-tests/inst.xpk.py +++ b/common/tct-serviceworkers-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-serviceworkers-w3c-tests/pack.py b/common/tct-serviceworkers-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-serviceworkers-w3c-tests/pack.py +++ b/common/tct-serviceworkers-w3c-tests/pack.py @@ -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: diff --git a/common/tct-sessionhistory-html5-tests/inst.apk.py b/common/tct-sessionhistory-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-sessionhistory-html5-tests/inst.apk.py +++ b/common/tct-sessionhistory-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-sessionhistory-html5-tests/inst.wgt.py b/common/tct-sessionhistory-html5-tests/inst.wgt.py index 7a271b8be..218f1a491 100755 --- a/common/tct-sessionhistory-html5-tests/inst.wgt.py +++ b/common/tct-sessionhistory-html5-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-sessionhistory-html5-tests/inst.xpk.py b/common/tct-sessionhistory-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-sessionhistory-html5-tests/inst.xpk.py +++ b/common/tct-sessionhistory-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-sessionhistory-html5-tests/pack.py b/common/tct-sessionhistory-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-sessionhistory-html5-tests/pack.py +++ b/common/tct-sessionhistory-html5-tests/pack.py @@ -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: diff --git a/common/tct-sound-tizen-tests/inst.apk.py b/common/tct-sound-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-sound-tizen-tests/inst.apk.py +++ b/common/tct-sound-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-sound-tizen-tests/inst.wgt.py b/common/tct-sound-tizen-tests/inst.wgt.py index 18690763e..c3285e19c 100755 --- a/common/tct-sound-tizen-tests/inst.wgt.py +++ b/common/tct-sound-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -192,8 +192,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: @@ -212,7 +212,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -224,10 +224,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: diff --git a/common/tct-sound-tizen-tests/inst.xpk.py b/common/tct-sound-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-sound-tizen-tests/inst.xpk.py +++ b/common/tct-sound-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-sound-tizen-tests/pack.py b/common/tct-sound-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-sound-tizen-tests/pack.py +++ b/common/tct-sound-tizen-tests/pack.py @@ -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: diff --git a/common/tct-speech-w3c-tests/inst.apk.py b/common/tct-speech-w3c-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-speech-w3c-tests/inst.apk.py +++ b/common/tct-speech-w3c-tests/inst.apk.py @@ -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: diff --git a/common/tct-speech-w3c-tests/inst.wgt.py b/common/tct-speech-w3c-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/common/tct-speech-w3c-tests/inst.wgt.py +++ b/common/tct-speech-w3c-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/common/tct-speech-w3c-tests/inst.xpk.py b/common/tct-speech-w3c-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/common/tct-speech-w3c-tests/inst.xpk.py +++ b/common/tct-speech-w3c-tests/inst.xpk.py @@ -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: diff --git a/common/tct-speech-w3c-tests/pack.py b/common/tct-speech-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-speech-w3c-tests/pack.py +++ b/common/tct-speech-w3c-tests/pack.py @@ -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: diff --git a/common/tct-sse-w3c-tests/inst.apk.py b/common/tct-sse-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-sse-w3c-tests/inst.apk.py +++ b/common/tct-sse-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-sse-w3c-tests/inst.wgt.py b/common/tct-sse-w3c-tests/inst.wgt.py index f0b99779f..82e9260d7 100755 --- a/common/tct-sse-w3c-tests/inst.wgt.py +++ b/common/tct-sse-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -192,8 +192,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: @@ -212,7 +212,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -224,10 +224,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: diff --git a/common/tct-sse-w3c-tests/inst.xpk.py b/common/tct-sse-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-sse-w3c-tests/inst.xpk.py +++ b/common/tct-sse-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-sse-w3c-tests/pack.py b/common/tct-sse-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-sse-w3c-tests/pack.py +++ b/common/tct-sse-w3c-tests/pack.py @@ -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: diff --git a/common/tct-svg-html5-tests/inst.apk.py b/common/tct-svg-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-svg-html5-tests/inst.apk.py +++ b/common/tct-svg-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-svg-html5-tests/inst.wgt.py b/common/tct-svg-html5-tests/inst.wgt.py index 5b1718da1..68c913eef 100755 --- a/common/tct-svg-html5-tests/inst.wgt.py +++ b/common/tct-svg-html5-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-svg-html5-tests/inst.xpk.py b/common/tct-svg-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-svg-html5-tests/inst.xpk.py +++ b/common/tct-svg-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-svg-html5-tests/pack.py b/common/tct-svg-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-svg-html5-tests/pack.py +++ b/common/tct-svg-html5-tests/pack.py @@ -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: diff --git a/common/tct-systeminfo-tizen-tests/inst.apk.py b/common/tct-systeminfo-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-systeminfo-tizen-tests/inst.apk.py +++ b/common/tct-systeminfo-tizen-tests/inst.apk.py @@ -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: diff --git a/common/tct-systeminfo-tizen-tests/inst.wgt.py b/common/tct-systeminfo-tizen-tests/inst.wgt.py index 93ac8ad71..670f31e95 100755 --- a/common/tct-systeminfo-tizen-tests/inst.wgt.py +++ b/common/tct-systeminfo-tizen-tests/inst.wgt.py @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-systeminfo-tizen-tests/inst.xpk.py b/common/tct-systeminfo-tizen-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/common/tct-systeminfo-tizen-tests/inst.xpk.py +++ b/common/tct-systeminfo-tizen-tests/inst.xpk.py @@ -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: diff --git a/common/tct-systeminfo-tizen-tests/pack.py b/common/tct-systeminfo-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-systeminfo-tizen-tests/pack.py +++ b/common/tct-systeminfo-tizen-tests/pack.py @@ -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: diff --git a/common/tct-systemsetting-tizen-tests/inst.apk.py b/common/tct-systemsetting-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-systemsetting-tizen-tests/inst.apk.py +++ b/common/tct-systemsetting-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-systemsetting-tizen-tests/inst.wgt.py b/common/tct-systemsetting-tizen-tests/inst.wgt.py index f09fdf912..e82b9aae1 100755 --- a/common/tct-systemsetting-tizen-tests/inst.wgt.py +++ b/common/tct-systemsetting-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/common/tct-systemsetting-tizen-tests/inst.xpk.py b/common/tct-systemsetting-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-systemsetting-tizen-tests/inst.xpk.py +++ b/common/tct-systemsetting-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-systemsetting-tizen-tests/pack.py b/common/tct-systemsetting-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-systemsetting-tizen-tests/pack.py +++ b/common/tct-systemsetting-tizen-tests/pack.py @@ -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: diff --git a/common/tct-template-w3c-tests/inst.apk.py b/common/tct-template-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-template-w3c-tests/inst.apk.py +++ b/common/tct-template-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-template-w3c-tests/inst.wgt.py b/common/tct-template-w3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-template-w3c-tests/inst.wgt.py +++ b/common/tct-template-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-template-w3c-tests/inst.xpk.py b/common/tct-template-w3c-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-template-w3c-tests/inst.xpk.py +++ b/common/tct-template-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-template-w3c-tests/pack.py b/common/tct-template-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-template-w3c-tests/pack.py +++ b/common/tct-template-w3c-tests/pack.py @@ -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: diff --git a/common/tct-text-css3-tests/inst.apk.py b/common/tct-text-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-text-css3-tests/inst.apk.py +++ b/common/tct-text-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-text-css3-tests/inst.wgt.py b/common/tct-text-css3-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-text-css3-tests/inst.wgt.py +++ b/common/tct-text-css3-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-text-css3-tests/inst.xpk.py b/common/tct-text-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-text-css3-tests/inst.xpk.py +++ b/common/tct-text-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-text-css3-tests/pack.py b/common/tct-text-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-text-css3-tests/pack.py +++ b/common/tct-text-css3-tests/pack.py @@ -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: diff --git a/common/tct-time-tizen-tests/inst.apk.py b/common/tct-time-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-time-tizen-tests/inst.apk.py +++ b/common/tct-time-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-time-tizen-tests/inst.wgt.py b/common/tct-time-tizen-tests/inst.wgt.py index 44e57cf17..d46e4924e 100755 --- a/common/tct-time-tizen-tests/inst.wgt.py +++ b/common/tct-time-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-time-tizen-tests/inst.xpk.py b/common/tct-time-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-time-tizen-tests/inst.xpk.py +++ b/common/tct-time-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-time-tizen-tests/pack.py b/common/tct-time-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-time-tizen-tests/pack.py +++ b/common/tct-time-tizen-tests/pack.py @@ -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: diff --git a/common/tct-tizen-tizen-tests/inst.apk.py b/common/tct-tizen-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-tizen-tizen-tests/inst.apk.py +++ b/common/tct-tizen-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-tizen-tizen-tests/inst.wgt.py b/common/tct-tizen-tizen-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-tizen-tizen-tests/inst.wgt.py +++ b/common/tct-tizen-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-tizen-tizen-tests/inst.xpk.py b/common/tct-tizen-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-tizen-tizen-tests/inst.xpk.py +++ b/common/tct-tizen-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-tizen-tizen-tests/pack.py b/common/tct-tizen-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-tizen-tizen-tests/pack.py +++ b/common/tct-tizen-tizen-tests/pack.py @@ -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: diff --git a/common/tct-touchevent-w3c-tests/inst.apk.py b/common/tct-touchevent-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-touchevent-w3c-tests/inst.apk.py +++ b/common/tct-touchevent-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-touchevent-w3c-tests/inst.wgt.py b/common/tct-touchevent-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-touchevent-w3c-tests/inst.wgt.py +++ b/common/tct-touchevent-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-touchevent-w3c-tests/inst.xpk.py b/common/tct-touchevent-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-touchevent-w3c-tests/inst.xpk.py +++ b/common/tct-touchevent-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-touchevent-w3c-tests/pack.py b/common/tct-touchevent-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-touchevent-w3c-tests/pack.py +++ b/common/tct-touchevent-w3c-tests/pack.py @@ -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: diff --git a/common/tct-transitions-css3-tests/inst.apk.py b/common/tct-transitions-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-transitions-css3-tests/inst.apk.py +++ b/common/tct-transitions-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-transitions-css3-tests/inst.wgt.py b/common/tct-transitions-css3-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-transitions-css3-tests/inst.wgt.py +++ b/common/tct-transitions-css3-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-transitions-css3-tests/inst.xpk.py b/common/tct-transitions-css3-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-transitions-css3-tests/inst.xpk.py +++ b/common/tct-transitions-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-transitions-css3-tests/pack.py b/common/tct-transitions-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-transitions-css3-tests/pack.py +++ b/common/tct-transitions-css3-tests/pack.py @@ -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: diff --git a/common/tct-tv-audiocontrol-tizen-tests/inst.apk.py b/common/tct-tv-audiocontrol-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-tv-audiocontrol-tizen-tests/inst.apk.py +++ b/common/tct-tv-audiocontrol-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-tv-audiocontrol-tizen-tests/inst.wgt.py b/common/tct-tv-audiocontrol-tizen-tests/inst.wgt.py index 54b678a51..54f3b9117 100755 --- a/common/tct-tv-audiocontrol-tizen-tests/inst.wgt.py +++ b/common/tct-tv-audiocontrol-tizen-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/common/tct-tv-audiocontrol-tizen-tests/inst.xpk.py b/common/tct-tv-audiocontrol-tizen-tests/inst.xpk.py index 1835f7b99..7f4003410 100755 --- a/common/tct-tv-audiocontrol-tizen-tests/inst.xpk.py +++ b/common/tct-tv-audiocontrol-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/common/tct-tv-audiocontrol-tizen-tests/pack.py b/common/tct-tv-audiocontrol-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-tv-audiocontrol-tizen-tests/pack.py +++ b/common/tct-tv-audiocontrol-tizen-tests/pack.py @@ -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: diff --git a/common/tct-tv-channel-tizen-tests/inst.apk.py b/common/tct-tv-channel-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-tv-channel-tizen-tests/inst.apk.py +++ b/common/tct-tv-channel-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-tv-channel-tizen-tests/inst.wgt.py b/common/tct-tv-channel-tizen-tests/inst.wgt.py index 145211488..36be2eb51 100755 --- a/common/tct-tv-channel-tizen-tests/inst.wgt.py +++ b/common/tct-tv-channel-tizen-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-tv-channel-tizen-tests/inst.xpk.py b/common/tct-tv-channel-tizen-tests/inst.xpk.py index a5295f0ab..245e3b7c2 100755 --- a/common/tct-tv-channel-tizen-tests/inst.xpk.py +++ b/common/tct-tv-channel-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/common/tct-tv-channel-tizen-tests/pack.py b/common/tct-tv-channel-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-tv-channel-tizen-tests/pack.py +++ b/common/tct-tv-channel-tizen-tests/pack.py @@ -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: diff --git a/common/tct-tv-displaycontrol-tizen-tests/inst.apk.py b/common/tct-tv-displaycontrol-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-tv-displaycontrol-tizen-tests/inst.apk.py +++ b/common/tct-tv-displaycontrol-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-tv-displaycontrol-tizen-tests/inst.wgt.py b/common/tct-tv-displaycontrol-tizen-tests/inst.wgt.py index 145211488..36be2eb51 100755 --- a/common/tct-tv-displaycontrol-tizen-tests/inst.wgt.py +++ b/common/tct-tv-displaycontrol-tizen-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-tv-displaycontrol-tizen-tests/inst.xpk.py b/common/tct-tv-displaycontrol-tizen-tests/inst.xpk.py index d9ea2dfa9..0729cd4a6 100755 --- a/common/tct-tv-displaycontrol-tizen-tests/inst.xpk.py +++ b/common/tct-tv-displaycontrol-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,14 @@ PKG_SRC_DIR = "" 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 @@ -178,8 +178,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: diff --git a/common/tct-tv-displaycontrol-tizen-tests/pack.py b/common/tct-tv-displaycontrol-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-tv-displaycontrol-tizen-tests/pack.py +++ b/common/tct-tv-displaycontrol-tizen-tests/pack.py @@ -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: diff --git a/common/tct-tv-info-tizen-tests/inst.apk.py b/common/tct-tv-info-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-tv-info-tizen-tests/inst.apk.py +++ b/common/tct-tv-info-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-tv-info-tizen-tests/inst.wgt.py b/common/tct-tv-info-tizen-tests/inst.wgt.py index a4eb99140..bb8ad4b67 100755 --- a/common/tct-tv-info-tizen-tests/inst.wgt.py +++ b/common/tct-tv-info-tizen-tests/inst.wgt.py @@ -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 @@ -185,8 +185,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: @@ -205,7 +205,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -217,10 +217,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: diff --git a/common/tct-tv-info-tizen-tests/inst.xpk.py b/common/tct-tv-info-tizen-tests/inst.xpk.py index d9ea2dfa9..0729cd4a6 100755 --- a/common/tct-tv-info-tizen-tests/inst.xpk.py +++ b/common/tct-tv-info-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,14 @@ PKG_SRC_DIR = "" 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 @@ -178,8 +178,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: diff --git a/common/tct-tv-info-tizen-tests/pack.py b/common/tct-tv-info-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-tv-info-tizen-tests/pack.py +++ b/common/tct-tv-info-tizen-tests/pack.py @@ -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: diff --git a/common/tct-tv-window-tizen-tests/inst.apk.py b/common/tct-tv-window-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-tv-window-tizen-tests/inst.apk.py +++ b/common/tct-tv-window-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-tv-window-tizen-tests/inst.wgt.py b/common/tct-tv-window-tizen-tests/inst.wgt.py index 2c16cb57b..d4f6ce479 100755 --- a/common/tct-tv-window-tizen-tests/inst.wgt.py +++ b/common/tct-tv-window-tizen-tests/inst.wgt.py @@ -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: diff --git a/common/tct-tv-window-tizen-tests/inst.xpk.py b/common/tct-tv-window-tizen-tests/inst.xpk.py index 1835f7b99..7f4003410 100755 --- a/common/tct-tv-window-tizen-tests/inst.xpk.py +++ b/common/tct-tv-window-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -import ConfigParser +from optparse import OptionParser, make_option +import configparser SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -21,14 +21,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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/common/tct-tv-window-tizen-tests/pack.py b/common/tct-tv-window-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-tv-window-tizen-tests/pack.py +++ b/common/tct-tv-window-tizen-tests/pack.py @@ -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: diff --git a/common/tct-typedarrays-nonw3c-tests/inst.apk.py b/common/tct-typedarrays-nonw3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-typedarrays-nonw3c-tests/inst.apk.py +++ b/common/tct-typedarrays-nonw3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-typedarrays-nonw3c-tests/inst.wgt.py b/common/tct-typedarrays-nonw3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-typedarrays-nonw3c-tests/inst.wgt.py +++ b/common/tct-typedarrays-nonw3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-typedarrays-nonw3c-tests/inst.xpk.py b/common/tct-typedarrays-nonw3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-typedarrays-nonw3c-tests/inst.xpk.py +++ b/common/tct-typedarrays-nonw3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-typedarrays-nonw3c-tests/pack.py b/common/tct-typedarrays-nonw3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-typedarrays-nonw3c-tests/pack.py +++ b/common/tct-typedarrays-nonw3c-tests/pack.py @@ -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: diff --git a/common/tct-ui-css3-tests/inst.apk.py b/common/tct-ui-css3-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-ui-css3-tests/inst.apk.py +++ b/common/tct-ui-css3-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-ui-css3-tests/inst.wgt.py b/common/tct-ui-css3-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-ui-css3-tests/inst.wgt.py +++ b/common/tct-ui-css3-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-ui-css3-tests/inst.xpk.py b/common/tct-ui-css3-tests/inst.xpk.py index aa292c379..1e6b79908 100755 --- a/common/tct-ui-css3-tests/inst.xpk.py +++ b/common/tct-ui-css3-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-ui-css3-tests/pack.py b/common/tct-ui-css3-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-ui-css3-tests/pack.py +++ b/common/tct-ui-css3-tests/pack.py @@ -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: diff --git a/common/tct-vibration-w3c-tests/inst.apk.py b/common/tct-vibration-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-vibration-w3c-tests/inst.apk.py +++ b/common/tct-vibration-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-vibration-w3c-tests/inst.wgt.py b/common/tct-vibration-w3c-tests/inst.wgt.py index 8ed577c13..21f138a35 100755 --- a/common/tct-vibration-w3c-tests/inst.wgt.py +++ b/common/tct-vibration-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-vibration-w3c-tests/inst.xpk.py b/common/tct-vibration-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-vibration-w3c-tests/inst.xpk.py +++ b/common/tct-vibration-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-vibration-w3c-tests/pack.py b/common/tct-vibration-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-vibration-w3c-tests/pack.py +++ b/common/tct-vibration-w3c-tests/pack.py @@ -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: diff --git a/common/tct-video-html5-tests/inst.apk.py b/common/tct-video-html5-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-video-html5-tests/inst.apk.py +++ b/common/tct-video-html5-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-video-html5-tests/inst.wgt.py b/common/tct-video-html5-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-video-html5-tests/inst.wgt.py +++ b/common/tct-video-html5-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-video-html5-tests/inst.xpk.py b/common/tct-video-html5-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-video-html5-tests/inst.xpk.py +++ b/common/tct-video-html5-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-video-html5-tests/pack.py b/common/tct-video-html5-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-video-html5-tests/pack.py +++ b/common/tct-video-html5-tests/pack.py @@ -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: diff --git a/common/tct-voicecontrol-tizen-tests/inst.apk.py b/common/tct-voicecontrol-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-voicecontrol-tizen-tests/inst.apk.py +++ b/common/tct-voicecontrol-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-voicecontrol-tizen-tests/inst.wgt.py b/common/tct-voicecontrol-tizen-tests/inst.wgt.py index 257e5c264..bac23c006 100755 --- a/common/tct-voicecontrol-tizen-tests/inst.wgt.py +++ b/common/tct-voicecontrol-tizen-tests/inst.wgt.py @@ -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 @@ -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) userCheck() @@ -214,10 +214,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: diff --git a/common/tct-voicecontrol-tizen-tests/inst.xpk.py b/common/tct-voicecontrol-tizen-tests/inst.xpk.py index c0c358ecc..9b2adfedd 100755 --- a/common/tct-voicecontrol-tizen-tests/inst.xpk.py +++ b/common/tct-voicecontrol-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -166,8 +166,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: @@ -186,7 +186,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -196,10 +196,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: diff --git a/common/tct-voicecontrol-tizen-tests/pack.py b/common/tct-voicecontrol-tizen-tests/pack.py index 08d55aafe..92866ab2e 100755 --- a/common/tct-voicecontrol-tizen-tests/pack.py +++ b/common/tct-voicecontrol-tizen-tests/pack.py @@ -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: diff --git a/common/tct-webaudio-w3c-tests/inst.apk.py b/common/tct-webaudio-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-webaudio-w3c-tests/inst.apk.py +++ b/common/tct-webaudio-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-webaudio-w3c-tests/inst.wgt.py b/common/tct-webaudio-w3c-tests/inst.wgt.py index 93ac8ad71..3bcf73639 100755 --- a/common/tct-webaudio-w3c-tests/inst.wgt.py +++ b/common/tct-webaudio-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-webaudio-w3c-tests/inst.xpk.py b/common/tct-webaudio-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-webaudio-w3c-tests/inst.xpk.py +++ b/common/tct-webaudio-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-webaudio-w3c-tests/pack.py b/common/tct-webaudio-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-webaudio-w3c-tests/pack.py +++ b/common/tct-webaudio-w3c-tests/pack.py @@ -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: diff --git a/common/tct-webgl-nonw3c-tests/inst.apk.py b/common/tct-webgl-nonw3c-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/common/tct-webgl-nonw3c-tests/inst.apk.py +++ b/common/tct-webgl-nonw3c-tests/inst.apk.py @@ -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: diff --git a/common/tct-webgl-nonw3c-tests/inst.wgt.py b/common/tct-webgl-nonw3c-tests/inst.wgt.py index dd614f265..b30f310f4 100755 --- a/common/tct-webgl-nonw3c-tests/inst.wgt.py +++ b/common/tct-webgl-nonw3c-tests/inst.wgt.py @@ -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 @@ -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) userCheck() @@ -215,10 +215,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: diff --git a/common/tct-webgl-nonw3c-tests/inst.xpk.py b/common/tct-webgl-nonw3c-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/common/tct-webgl-nonw3c-tests/inst.xpk.py +++ b/common/tct-webgl-nonw3c-tests/inst.xpk.py @@ -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: diff --git a/common/tct-webgl-nonw3c-tests/pack.py b/common/tct-webgl-nonw3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-webgl-nonw3c-tests/pack.py +++ b/common/tct-webgl-nonw3c-tests/pack.py @@ -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: diff --git a/common/tct-webmessaging-w3c-tests/inst.apk.py b/common/tct-webmessaging-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-webmessaging-w3c-tests/inst.apk.py +++ b/common/tct-webmessaging-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-webmessaging-w3c-tests/inst.wgt.py b/common/tct-webmessaging-w3c-tests/inst.wgt.py index 46b3b4aa3..138e838a5 100755 --- a/common/tct-webmessaging-w3c-tests/inst.wgt.py +++ b/common/tct-webmessaging-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -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 @@ -184,8 +184,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: @@ -204,7 +204,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -216,10 +216,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: diff --git a/common/tct-webmessaging-w3c-tests/inst.xpk.py b/common/tct-webmessaging-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-webmessaging-w3c-tests/inst.xpk.py +++ b/common/tct-webmessaging-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-webmessaging-w3c-tests/pack.py b/common/tct-webmessaging-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-webmessaging-w3c-tests/pack.py +++ b/common/tct-webmessaging-w3c-tests/pack.py @@ -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: diff --git a/common/tct-websetting-tizen-tests/inst.apk.py b/common/tct-websetting-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-websetting-tizen-tests/inst.apk.py +++ b/common/tct-websetting-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-websetting-tizen-tests/inst.wgt.py b/common/tct-websetting-tizen-tests/inst.wgt.py index 5b1718da1..68c913eef 100755 --- a/common/tct-websetting-tizen-tests/inst.wgt.py +++ b/common/tct-websetting-tizen-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-websetting-tizen-tests/inst.xpk.py b/common/tct-websetting-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-websetting-tizen-tests/inst.xpk.py +++ b/common/tct-websetting-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-websetting-tizen-tests/pack.py b/common/tct-websetting-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-websetting-tizen-tests/pack.py +++ b/common/tct-websetting-tizen-tests/pack.py @@ -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: diff --git a/common/tct-websocket-w3c-tests/inst.apk.py b/common/tct-websocket-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-websocket-w3c-tests/inst.apk.py +++ b/common/tct-websocket-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-websocket-w3c-tests/inst.wgt.py b/common/tct-websocket-w3c-tests/inst.wgt.py index 9c17c1ad7..d442317ad 100755 --- a/common/tct-websocket-w3c-tests/inst.wgt.py +++ b/common/tct-websocket-w3c-tests/inst.wgt.py @@ -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 @@ -185,8 +185,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: @@ -205,7 +205,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -217,10 +217,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: diff --git a/common/tct-websocket-w3c-tests/inst.xpk.py b/common/tct-websocket-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-websocket-w3c-tests/inst.xpk.py +++ b/common/tct-websocket-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-websocket-w3c-tests/pack.py b/common/tct-websocket-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-websocket-w3c-tests/pack.py +++ b/common/tct-websocket-w3c-tests/pack.py @@ -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: diff --git a/common/tct-webstorage-w3c-tests/inst.apk.py b/common/tct-webstorage-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-webstorage-w3c-tests/inst.apk.py +++ b/common/tct-webstorage-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-webstorage-w3c-tests/inst.wgt.py b/common/tct-webstorage-w3c-tests/inst.wgt.py index c7f89fd44..909755af3 100755 --- a/common/tct-webstorage-w3c-tests/inst.wgt.py +++ b/common/tct-webstorage-w3c-tests/inst.wgt.py @@ -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 @@ -191,8 +191,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: @@ -211,7 +211,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +223,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: diff --git a/common/tct-webstorage-w3c-tests/inst.xpk.py b/common/tct-webstorage-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-webstorage-w3c-tests/inst.xpk.py +++ b/common/tct-webstorage-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-webstorage-w3c-tests/pack.py b/common/tct-webstorage-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-webstorage-w3c-tests/pack.py +++ b/common/tct-webstorage-w3c-tests/pack.py @@ -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: diff --git a/common/tct-webwidget-w3c-tests/inst.apk.py b/common/tct-webwidget-w3c-tests/inst.apk.py index d5f9fbb96..d636bee03 100755 --- a/common/tct-webwidget-w3c-tests/inst.apk.py +++ b/common/tct-webwidget-w3c-tests/inst.apk.py @@ -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: diff --git a/common/tct-webwidget-w3c-tests/inst.wgt.py b/common/tct-webwidget-w3c-tests/inst.wgt.py index 31bd49daf..1c685e357 100755 --- a/common/tct-webwidget-w3c-tests/inst.wgt.py +++ b/common/tct-webwidget-w3c-tests/inst.wgt.py @@ -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: diff --git a/common/tct-webwidget-w3c-tests/inst.xpk.py b/common/tct-webwidget-w3c-tests/inst.xpk.py index f70351a9b..ace8cbba9 100755 --- a/common/tct-webwidget-w3c-tests/inst.xpk.py +++ b/common/tct-webwidget-w3c-tests/inst.xpk.py @@ -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: diff --git a/common/tct-webwidget-w3c-tests/pack.py b/common/tct-webwidget-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-webwidget-w3c-tests/pack.py +++ b/common/tct-webwidget-w3c-tests/pack.py @@ -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: diff --git a/common/tct-wgtapi01-w3c-tests/inst.apk.py b/common/tct-wgtapi01-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-wgtapi01-w3c-tests/inst.apk.py +++ b/common/tct-wgtapi01-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-wgtapi01-w3c-tests/inst.wgt.py b/common/tct-wgtapi01-w3c-tests/inst.wgt.py index 9dff63be5..302423c2a 100755 --- a/common/tct-wgtapi01-w3c-tests/inst.wgt.py +++ b/common/tct-wgtapi01-w3c-tests/inst.wgt.py @@ -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 @@ -187,8 +187,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: @@ -207,7 +207,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -219,10 +219,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: diff --git a/common/tct-wgtapi01-w3c-tests/inst.xpk.py b/common/tct-wgtapi01-w3c-tests/inst.xpk.py index 453aef60b..296a5a3e7 100755 --- a/common/tct-wgtapi01-w3c-tests/inst.xpk.py +++ b/common/tct-wgtapi01-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -174,8 +174,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: @@ -194,7 +194,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -204,10 +204,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: diff --git a/common/tct-wgtapi01-w3c-tests/pack.py b/common/tct-wgtapi01-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-wgtapi01-w3c-tests/pack.py +++ b/common/tct-wgtapi01-w3c-tests/pack.py @@ -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: diff --git a/common/tct-wgtapi02-w3c-tests/inst.apk.py b/common/tct-wgtapi02-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-wgtapi02-w3c-tests/inst.apk.py +++ b/common/tct-wgtapi02-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-wgtapi02-w3c-tests/inst.wgt.py b/common/tct-wgtapi02-w3c-tests/inst.wgt.py index 145211488..36be2eb51 100755 --- a/common/tct-wgtapi02-w3c-tests/inst.wgt.py +++ b/common/tct-wgtapi02-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-wgtapi02-w3c-tests/inst.xpk.py b/common/tct-wgtapi02-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-wgtapi02-w3c-tests/inst.xpk.py +++ b/common/tct-wgtapi02-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-wgtapi02-w3c-tests/pack.py b/common/tct-wgtapi02-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-wgtapi02-w3c-tests/pack.py +++ b/common/tct-wgtapi02-w3c-tests/pack.py @@ -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: diff --git a/common/tct-widget01-w3c-tests/inst.apk.py b/common/tct-widget01-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-widget01-w3c-tests/inst.apk.py +++ b/common/tct-widget01-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-widget01-w3c-tests/inst.wgt.py b/common/tct-widget01-w3c-tests/inst.wgt.py index 9dff63be5..302423c2a 100755 --- a/common/tct-widget01-w3c-tests/inst.wgt.py +++ b/common/tct-widget01-w3c-tests/inst.wgt.py @@ -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 @@ -187,8 +187,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: @@ -207,7 +207,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -219,10 +219,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: diff --git a/common/tct-widget01-w3c-tests/inst.xpk.py b/common/tct-widget01-w3c-tests/inst.xpk.py index 453aef60b..296a5a3e7 100755 --- a/common/tct-widget01-w3c-tests/inst.xpk.py +++ b/common/tct-widget01-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -174,8 +174,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: @@ -194,7 +194,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -204,10 +204,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: diff --git a/common/tct-widget01-w3c-tests/pack.py b/common/tct-widget01-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-widget01-w3c-tests/pack.py +++ b/common/tct-widget01-w3c-tests/pack.py @@ -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: diff --git a/common/tct-widget02-w3c-tests/inst.apk.py b/common/tct-widget02-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-widget02-w3c-tests/inst.apk.py +++ b/common/tct-widget02-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-widget02-w3c-tests/inst.wgt.py b/common/tct-widget02-w3c-tests/inst.wgt.py index 31bd49daf..1c685e357 100755 --- a/common/tct-widget02-w3c-tests/inst.wgt.py +++ b/common/tct-widget02-w3c-tests/inst.wgt.py @@ -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: diff --git a/common/tct-widget02-w3c-tests/inst.xpk.py b/common/tct-widget02-w3c-tests/inst.xpk.py index aa292c379..1e6b79908 100755 --- a/common/tct-widget02-w3c-tests/inst.xpk.py +++ b/common/tct-widget02-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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: diff --git a/common/tct-widget02-w3c-tests/pack.py b/common/tct-widget02-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-widget02-w3c-tests/pack.py +++ b/common/tct-widget02-w3c-tests/pack.py @@ -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: diff --git a/common/tct-widgetpolicy-w3c-tests/inst.apk.py b/common/tct-widgetpolicy-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-widgetpolicy-w3c-tests/inst.apk.py +++ b/common/tct-widgetpolicy-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-widgetpolicy-w3c-tests/inst.wgt.py b/common/tct-widgetpolicy-w3c-tests/inst.wgt.py index 6d00172cd..138a08bfe 100755 --- a/common/tct-widgetpolicy-w3c-tests/inst.wgt.py +++ b/common/tct-widgetpolicy-w3c-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/common/tct-widgetpolicy-w3c-tests/inst.xpk.py b/common/tct-widgetpolicy-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-widgetpolicy-w3c-tests/inst.xpk.py +++ b/common/tct-widgetpolicy-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-widgetpolicy-w3c-tests/pack.py b/common/tct-widgetpolicy-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-widgetpolicy-w3c-tests/pack.py +++ b/common/tct-widgetpolicy-w3c-tests/pack.py @@ -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: diff --git a/common/tct-widgetservice-tizen-tests/inst.apk.py b/common/tct-widgetservice-tizen-tests/inst.apk.py index d5f9fbb96..d636bee03 100755 --- a/common/tct-widgetservice-tizen-tests/inst.apk.py +++ b/common/tct-widgetservice-tizen-tests/inst.apk.py @@ -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: diff --git a/common/tct-widgetservice-tizen-tests/inst.wgt.py b/common/tct-widgetservice-tizen-tests/inst.wgt.py index 5e4c91713..3bcf73639 100755 --- a/common/tct-widgetservice-tizen-tests/inst.wgt.py +++ b/common/tct-widgetservice-tizen-tests/inst.wgt.py @@ -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 @@ -190,8 +190,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: @@ -210,7 +210,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -222,10 +222,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: diff --git a/common/tct-widgetservice-tizen-tests/inst.xpk.py b/common/tct-widgetservice-tizen-tests/inst.xpk.py index f70351a9b..ace8cbba9 100755 --- a/common/tct-widgetservice-tizen-tests/inst.xpk.py +++ b/common/tct-widgetservice-tizen-tests/inst.xpk.py @@ -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: diff --git a/common/tct-widgetservice-tizen-tests/pack.py b/common/tct-widgetservice-tizen-tests/pack.py index c20c9326d..d725d5685 100755 --- a/common/tct-widgetservice-tizen-tests/pack.py +++ b/common/tct-widgetservice-tizen-tests/pack.py @@ -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: @@ -957,7 +957,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: diff --git a/common/tct-woff-w3c-tests/inst.apk.py b/common/tct-woff-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-woff-w3c-tests/inst.apk.py +++ b/common/tct-woff-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-woff-w3c-tests/inst.wgt.py b/common/tct-woff-w3c-tests/inst.wgt.py index d7b962bfa..0f5e3baa1 100755 --- a/common/tct-woff-w3c-tests/inst.wgt.py +++ b/common/tct-woff-w3c-tests/inst.wgt.py @@ -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 @@ -189,8 +189,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: @@ -209,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +221,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: diff --git a/common/tct-woff-w3c-tests/inst.xpk.py b/common/tct-woff-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-woff-w3c-tests/inst.xpk.py +++ b/common/tct-woff-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-woff-w3c-tests/pack.py b/common/tct-woff-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-woff-w3c-tests/pack.py +++ b/common/tct-woff-w3c-tests/pack.py @@ -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: diff --git a/common/tct-workers-w3c-tests/inst.apk.py b/common/tct-workers-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-workers-w3c-tests/inst.apk.py +++ b/common/tct-workers-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-workers-w3c-tests/inst.wgt.py b/common/tct-workers-w3c-tests/inst.wgt.py index 225affe5a..b50fcca5d 100755 --- a/common/tct-workers-w3c-tests/inst.wgt.py +++ b/common/tct-workers-w3c-tests/inst.wgt.py @@ -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) @@ -29,18 +29,18 @@ def userCheck(): GLOVAL_OPT="--global" else: GLOVAL_OPT="" - + 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 @@ -64,8 +64,6 @@ def getUSERID(): return doCMD(cmd) - - def getPKGID(pkg_name=None): if PARAMETERS.mode == "SDB": cmd = "sdb -s %s shell %s" % ( @@ -191,8 +189,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: @@ -211,7 +209,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -223,10 +221,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: diff --git a/common/tct-workers-w3c-tests/inst.xpk.py b/common/tct-workers-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-workers-w3c-tests/inst.xpk.py +++ b/common/tct-workers-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-workers-w3c-tests/pack.py b/common/tct-workers-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-workers-w3c-tests/pack.py +++ b/common/tct-workers-w3c-tests/pack.py @@ -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: diff --git a/common/tct-xmlhttprequest-w3c-tests/inst.apk.py b/common/tct-xmlhttprequest-w3c-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/common/tct-xmlhttprequest-w3c-tests/inst.apk.py +++ b/common/tct-xmlhttprequest-w3c-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/common/tct-xmlhttprequest-w3c-tests/inst.wgt.py b/common/tct-xmlhttprequest-w3c-tests/inst.wgt.py index 88104a59d..8123675e6 100755 --- a/common/tct-xmlhttprequest-w3c-tests/inst.wgt.py +++ b/common/tct-xmlhttprequest-w3c-tests/inst.wgt.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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) @@ -30,16 +30,17 @@ def userCheck(): else: GLOVAL_OPT="" + 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 @@ -63,8 +64,6 @@ def getUSERID(): return doCMD(cmd) - - def getPKGID(pkg_name=None): if PARAMETERS.mode == "SDB": cmd = "sdb -s %s shell %s" % ( @@ -189,8 +188,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: @@ -209,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -221,10 +220,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: diff --git a/common/tct-xmlhttprequest-w3c-tests/inst.xpk.py b/common/tct-xmlhttprequest-w3c-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/common/tct-xmlhttprequest-w3c-tests/inst.xpk.py +++ b/common/tct-xmlhttprequest-w3c-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/common/tct-xmlhttprequest-w3c-tests/pack.py b/common/tct-xmlhttprequest-w3c-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/common/tct-xmlhttprequest-w3c-tests/pack.py +++ b/common/tct-xmlhttprequest-w3c-tests/pack.py @@ -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: diff --git a/iot/tct-capability-tests/inst.apk.py b/iot/tct-capability-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/iot/tct-capability-tests/inst.apk.py +++ b/iot/tct-capability-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/iot/tct-capability-tests/inst.wgt.py b/iot/tct-capability-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/iot/tct-capability-tests/inst.wgt.py +++ b/iot/tct-capability-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/iot/tct-capability-tests/inst.xpk.py b/iot/tct-capability-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/iot/tct-capability-tests/inst.xpk.py +++ b/iot/tct-capability-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/iot/tct-capability-tests/pack.py b/iot/tct-capability-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/iot/tct-capability-tests/pack.py +++ b/iot/tct-capability-tests/pack.py @@ -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: diff --git a/iot/tct-deprecatedapi-tizen-tests/inst.apk.py b/iot/tct-deprecatedapi-tizen-tests/inst.apk.py index 31210db16..d636bee03 100755 --- a/iot/tct-deprecatedapi-tizen-tests/inst.apk.py +++ b/iot/tct-deprecatedapi-tizen-tests/inst.apk.py @@ -6,8 +6,8 @@ import glob import time import sys import subprocess -from optparse import OptionParser, make_option -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: diff --git a/iot/tct-deprecatedapi-tizen-tests/inst.wgt.py b/iot/tct-deprecatedapi-tizen-tests/inst.wgt.py index e32732b34..8e0d9ef1a 100755 --- a/iot/tct-deprecatedapi-tizen-tests/inst.wgt.py +++ b/iot/tct-deprecatedapi-tizen-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/iot/tct-deprecatedapi-tizen-tests/inst.xpk.py b/iot/tct-deprecatedapi-tizen-tests/inst.xpk.py index 211d24c73..ace8cbba9 100755 --- a/iot/tct-deprecatedapi-tizen-tests/inst.xpk.py +++ b/iot/tct-deprecatedapi-tizen-tests/inst.xpk.py @@ -7,8 +7,8 @@ import time import sys import subprocess import string -from optparse import OptionParser, make_option -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 @@ -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: diff --git a/iot/tct-deprecatedapi-tizen-tests/pack.py b/iot/tct-deprecatedapi-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/iot/tct-deprecatedapi-tizen-tests/pack.py +++ b/iot/tct-deprecatedapi-tizen-tests/pack.py @@ -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: diff --git a/ivi/tct-2dtransforms-css3-tests/inst.apk.py b/ivi/tct-2dtransforms-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-2dtransforms-css3-tests/inst.apk.py +++ b/ivi/tct-2dtransforms-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-2dtransforms-css3-tests/inst.wgt.py b/ivi/tct-2dtransforms-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-2dtransforms-css3-tests/inst.wgt.py +++ b/ivi/tct-2dtransforms-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-2dtransforms-css3-tests/inst.xpk.py b/ivi/tct-2dtransforms-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-2dtransforms-css3-tests/inst.xpk.py +++ b/ivi/tct-2dtransforms-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-3dtransforms-css3-tests/inst.apk.py b/ivi/tct-3dtransforms-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-3dtransforms-css3-tests/inst.apk.py +++ b/ivi/tct-3dtransforms-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-3dtransforms-css3-tests/inst.wgt.py b/ivi/tct-3dtransforms-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-3dtransforms-css3-tests/inst.wgt.py +++ b/ivi/tct-3dtransforms-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-3dtransforms-css3-tests/inst.xpk.py b/ivi/tct-3dtransforms-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-3dtransforms-css3-tests/inst.xpk.py +++ b/ivi/tct-3dtransforms-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-alarm-tizen-tests/inst.apk.py b/ivi/tct-alarm-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-alarm-tizen-tests/inst.apk.py +++ b/ivi/tct-alarm-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-alarm-tizen-tests/inst.wgt.py b/ivi/tct-alarm-tizen-tests/inst.wgt.py index 9b50ab82d..905410740 100755 --- a/ivi/tct-alarm-tizen-tests/inst.wgt.py +++ b/ivi/tct-alarm-tizen-tests/inst.wgt.py @@ -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 @@ -160,8 +160,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: @@ -180,7 +180,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -190,10 +190,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: diff --git a/ivi/tct-alarm-tizen-tests/inst.xpk.py b/ivi/tct-alarm-tizen-tests/inst.xpk.py index 2b58ff607..635947096 100755 --- a/ivi/tct-alarm-tizen-tests/inst.xpk.py +++ b/ivi/tct-alarm-tizen-tests/inst.xpk.py @@ -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 @@ -162,8 +162,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: @@ -182,7 +182,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -192,10 +192,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: diff --git a/ivi/tct-animations-css3-tests/inst.apk.py b/ivi/tct-animations-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-animations-css3-tests/inst.apk.py +++ b/ivi/tct-animations-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-animations-css3-tests/inst.wgt.py b/ivi/tct-animations-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-animations-css3-tests/inst.wgt.py +++ b/ivi/tct-animations-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-animations-css3-tests/inst.xpk.py b/ivi/tct-animations-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-animations-css3-tests/inst.xpk.py +++ b/ivi/tct-animations-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-animationtiming-w3c-tests/inst.apk.py b/ivi/tct-animationtiming-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-animationtiming-w3c-tests/inst.apk.py +++ b/ivi/tct-animationtiming-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-animationtiming-w3c-tests/inst.wgt.py b/ivi/tct-animationtiming-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-animationtiming-w3c-tests/inst.wgt.py +++ b/ivi/tct-animationtiming-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-animationtiming-w3c-tests/inst.xpk.py b/ivi/tct-animationtiming-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-animationtiming-w3c-tests/inst.xpk.py +++ b/ivi/tct-animationtiming-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-appcache-html5-tests/inst.apk.py b/ivi/tct-appcache-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-appcache-html5-tests/inst.apk.py +++ b/ivi/tct-appcache-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-appcache-html5-tests/inst.wgt.py b/ivi/tct-appcache-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-appcache-html5-tests/inst.wgt.py +++ b/ivi/tct-appcache-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-appcache-html5-tests/inst.xpk.py b/ivi/tct-appcache-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-appcache-html5-tests/inst.xpk.py +++ b/ivi/tct-appcache-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-appcontrol-tizen-tests/inst.apk.py b/ivi/tct-appcontrol-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-appcontrol-tizen-tests/inst.apk.py +++ b/ivi/tct-appcontrol-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-appcontrol-tizen-tests/inst.wgt.py b/ivi/tct-appcontrol-tizen-tests/inst.wgt.py index f328736e3..3a6af9945 100755 --- a/ivi/tct-appcontrol-tizen-tests/inst.wgt.py +++ b/ivi/tct-appcontrol-tizen-tests/inst.wgt.py @@ -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 @@ -175,8 +175,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: @@ -195,7 +195,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -205,10 +205,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: diff --git a/ivi/tct-appcontrol-tizen-tests/inst.xpk.py b/ivi/tct-appcontrol-tizen-tests/inst.xpk.py index 7fd565644..68a7a7cb4 100755 --- a/ivi/tct-appcontrol-tizen-tests/inst.xpk.py +++ b/ivi/tct-appcontrol-tizen-tests/inst.xpk.py @@ -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 @@ -175,8 +175,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: @@ -195,7 +195,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -205,10 +205,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: diff --git a/ivi/tct-application-tizen-tests/inst.apk.py b/ivi/tct-application-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-application-tizen-tests/inst.apk.py +++ b/ivi/tct-application-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-application-tizen-tests/inst.wgt.py b/ivi/tct-application-tizen-tests/inst.wgt.py index 24141f7f4..ec7da2954 100755 --- a/ivi/tct-application-tizen-tests/inst.wgt.py +++ b/ivi/tct-application-tizen-tests/inst.wgt.py @@ -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: diff --git a/ivi/tct-application-tizen-tests/inst.xpk.py b/ivi/tct-application-tizen-tests/inst.xpk.py index ccd694af4..fbe31c492 100755 --- a/ivi/tct-application-tizen-tests/inst.xpk.py +++ b/ivi/tct-application-tizen-tests/inst.xpk.py @@ -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: diff --git a/ivi/tct-audio-html5-tests/inst.apk.py b/ivi/tct-audio-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-audio-html5-tests/inst.apk.py +++ b/ivi/tct-audio-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-audio-html5-tests/inst.wgt.py b/ivi/tct-audio-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-audio-html5-tests/inst.wgt.py +++ b/ivi/tct-audio-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-audio-html5-tests/inst.xpk.py b/ivi/tct-audio-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-audio-html5-tests/inst.xpk.py +++ b/ivi/tct-audio-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-backgrounds-css3-tests/inst.apk.py b/ivi/tct-backgrounds-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-backgrounds-css3-tests/inst.apk.py +++ b/ivi/tct-backgrounds-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-backgrounds-css3-tests/inst.wgt.py b/ivi/tct-backgrounds-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-backgrounds-css3-tests/inst.wgt.py +++ b/ivi/tct-backgrounds-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-backgrounds-css3-tests/inst.xpk.py b/ivi/tct-backgrounds-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-backgrounds-css3-tests/inst.xpk.py +++ b/ivi/tct-backgrounds-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-bluetooth-tizen-tests/inst.apk.py b/ivi/tct-bluetooth-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-bluetooth-tizen-tests/inst.apk.py +++ b/ivi/tct-bluetooth-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-bluetooth-tizen-tests/inst.wgt.py b/ivi/tct-bluetooth-tizen-tests/inst.wgt.py index d26375e71..59454337a 100755 --- a/ivi/tct-bluetooth-tizen-tests/inst.wgt.py +++ b/ivi/tct-bluetooth-tizen-tests/inst.wgt.py @@ -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 @@ -162,8 +162,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: @@ -182,7 +182,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -192,10 +192,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: diff --git a/ivi/tct-bluetooth-tizen-tests/inst.xpk.py b/ivi/tct-bluetooth-tizen-tests/inst.xpk.py index 2b58ff607..635947096 100755 --- a/ivi/tct-bluetooth-tizen-tests/inst.xpk.py +++ b/ivi/tct-bluetooth-tizen-tests/inst.xpk.py @@ -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 @@ -162,8 +162,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: @@ -182,7 +182,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -192,10 +192,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: diff --git a/ivi/tct-bookmark-tizen-tests/inst.apk.py b/ivi/tct-bookmark-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-bookmark-tizen-tests/inst.apk.py +++ b/ivi/tct-bookmark-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-bookmark-tizen-tests/inst.wgt.py b/ivi/tct-bookmark-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-bookmark-tizen-tests/inst.wgt.py +++ b/ivi/tct-bookmark-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-bookmark-tizen-tests/inst.xpk.py b/ivi/tct-bookmark-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-bookmark-tizen-tests/inst.xpk.py +++ b/ivi/tct-bookmark-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-browserstate-html5-tests/inst.apk.py b/ivi/tct-browserstate-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-browserstate-html5-tests/inst.apk.py +++ b/ivi/tct-browserstate-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-browserstate-html5-tests/inst.wgt.py b/ivi/tct-browserstate-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-browserstate-html5-tests/inst.wgt.py +++ b/ivi/tct-browserstate-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-browserstate-html5-tests/inst.xpk.py b/ivi/tct-browserstate-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-browserstate-html5-tests/inst.xpk.py +++ b/ivi/tct-browserstate-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-canvas-html5-tests/inst.apk.py b/ivi/tct-canvas-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-canvas-html5-tests/inst.apk.py +++ b/ivi/tct-canvas-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-canvas-html5-tests/inst.wgt.py b/ivi/tct-canvas-html5-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-canvas-html5-tests/inst.wgt.py +++ b/ivi/tct-canvas-html5-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-canvas-html5-tests/inst.xpk.py b/ivi/tct-canvas-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-canvas-html5-tests/inst.xpk.py +++ b/ivi/tct-canvas-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-capability-tests/inst.apk.py b/ivi/tct-capability-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-capability-tests/inst.apk.py +++ b/ivi/tct-capability-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-capability-tests/inst.wgt.py b/ivi/tct-capability-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-capability-tests/inst.wgt.py +++ b/ivi/tct-capability-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-capability-tests/inst.xpk.py b/ivi/tct-capability-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-capability-tests/inst.xpk.py +++ b/ivi/tct-capability-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-clipboard-w3c-tests/inst.apk.py b/ivi/tct-clipboard-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-clipboard-w3c-tests/inst.apk.py +++ b/ivi/tct-clipboard-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-clipboard-w3c-tests/inst.wgt.py b/ivi/tct-clipboard-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-clipboard-w3c-tests/inst.wgt.py +++ b/ivi/tct-clipboard-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-clipboard-w3c-tests/inst.xpk.py b/ivi/tct-clipboard-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-clipboard-w3c-tests/inst.xpk.py +++ b/ivi/tct-clipboard-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-colors-css3-tests/inst.apk.py b/ivi/tct-colors-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-colors-css3-tests/inst.apk.py +++ b/ivi/tct-colors-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-colors-css3-tests/inst.wgt.py b/ivi/tct-colors-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-colors-css3-tests/inst.wgt.py +++ b/ivi/tct-colors-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-colors-css3-tests/inst.xpk.py b/ivi/tct-colors-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-colors-css3-tests/inst.xpk.py +++ b/ivi/tct-colors-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-content-tizen-tests/inst.apk.py b/ivi/tct-content-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-content-tizen-tests/inst.apk.py +++ b/ivi/tct-content-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-content-tizen-tests/inst.wgt.py b/ivi/tct-content-tizen-tests/inst.wgt.py index 9cf8713a3..99d1a488c 100755 --- a/ivi/tct-content-tizen-tests/inst.wgt.py +++ b/ivi/tct-content-tizen-tests/inst.wgt.py @@ -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 @@ -169,8 +169,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: @@ -189,7 +189,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -199,10 +199,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: diff --git a/ivi/tct-content-tizen-tests/inst.xpk.py b/ivi/tct-content-tizen-tests/inst.xpk.py index 489c5efc9..9604d7898 100755 --- a/ivi/tct-content-tizen-tests/inst.xpk.py +++ b/ivi/tct-content-tizen-tests/inst.xpk.py @@ -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 @@ -169,8 +169,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: @@ -189,7 +189,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -199,10 +199,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: diff --git a/ivi/tct-cors-w3c-tests/inst.apk.py b/ivi/tct-cors-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-cors-w3c-tests/inst.apk.py +++ b/ivi/tct-cors-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-cors-w3c-tests/inst.wgt.py b/ivi/tct-cors-w3c-tests/inst.wgt.py index e4ea5495f..89d4de707 100755 --- a/ivi/tct-cors-w3c-tests/inst.wgt.py +++ b/ivi/tct-cors-w3c-tests/inst.wgt.py @@ -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: diff --git a/ivi/tct-cors-w3c-tests/inst.xpk.py b/ivi/tct-cors-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-cors-w3c-tests/inst.xpk.py +++ b/ivi/tct-cors-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-csp-w3c-tests/inst.apk.py b/ivi/tct-csp-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-csp-w3c-tests/inst.apk.py +++ b/ivi/tct-csp-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-csp-w3c-tests/inst.wgt.py b/ivi/tct-csp-w3c-tests/inst.wgt.py index a7ea7b578..109ff4430 100755 --- a/ivi/tct-csp-w3c-tests/inst.wgt.py +++ b/ivi/tct-csp-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-csp-w3c-tests/inst.xpk.py b/ivi/tct-csp-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-csp-w3c-tests/inst.xpk.py +++ b/ivi/tct-csp-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-dnd-html5-tests/inst.apk.py b/ivi/tct-dnd-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-dnd-html5-tests/inst.apk.py +++ b/ivi/tct-dnd-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-dnd-html5-tests/inst.wgt.py b/ivi/tct-dnd-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-dnd-html5-tests/inst.wgt.py +++ b/ivi/tct-dnd-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-dnd-html5-tests/inst.xpk.py b/ivi/tct-dnd-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-dnd-html5-tests/inst.xpk.py +++ b/ivi/tct-dnd-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-download-tizen-tests/inst.apk.py b/ivi/tct-download-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-download-tizen-tests/inst.apk.py +++ b/ivi/tct-download-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-download-tizen-tests/inst.wgt.py b/ivi/tct-download-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-download-tizen-tests/inst.wgt.py +++ b/ivi/tct-download-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-download-tizen-tests/inst.xpk.py b/ivi/tct-download-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-download-tizen-tests/inst.xpk.py +++ b/ivi/tct-download-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-extra-html5-tests/inst.apk.py b/ivi/tct-extra-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-extra-html5-tests/inst.apk.py +++ b/ivi/tct-extra-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-extra-html5-tests/inst.wgt.py b/ivi/tct-extra-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-extra-html5-tests/inst.wgt.py +++ b/ivi/tct-extra-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-extra-html5-tests/inst.xpk.py b/ivi/tct-extra-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-extra-html5-tests/inst.xpk.py +++ b/ivi/tct-extra-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-fileapi-w3c-tests/inst.apk.py b/ivi/tct-fileapi-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-fileapi-w3c-tests/inst.apk.py +++ b/ivi/tct-fileapi-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-fileapi-w3c-tests/inst.wgt.py b/ivi/tct-fileapi-w3c-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-fileapi-w3c-tests/inst.wgt.py +++ b/ivi/tct-fileapi-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-fileapi-w3c-tests/inst.xpk.py b/ivi/tct-fileapi-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-fileapi-w3c-tests/inst.xpk.py +++ b/ivi/tct-fileapi-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-filesystem-tizen-tests/inst.apk.py b/ivi/tct-filesystem-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-filesystem-tizen-tests/inst.apk.py +++ b/ivi/tct-filesystem-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-filesystem-tizen-tests/inst.wgt.py b/ivi/tct-filesystem-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-filesystem-tizen-tests/inst.wgt.py +++ b/ivi/tct-filesystem-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-filesystem-tizen-tests/inst.xpk.py b/ivi/tct-filesystem-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-filesystem-tizen-tests/inst.xpk.py +++ b/ivi/tct-filesystem-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-filesystemapi-w3c-tests/inst.apk.py b/ivi/tct-filesystemapi-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-filesystemapi-w3c-tests/inst.apk.py +++ b/ivi/tct-filesystemapi-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-filesystemapi-w3c-tests/inst.wgt.py b/ivi/tct-filesystemapi-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-filesystemapi-w3c-tests/inst.wgt.py +++ b/ivi/tct-filesystemapi-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-filesystemapi-w3c-tests/inst.xpk.py b/ivi/tct-filesystemapi-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-filesystemapi-w3c-tests/inst.xpk.py +++ b/ivi/tct-filesystemapi-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-filewriterapi-w3c-tests/inst.apk.py b/ivi/tct-filewriterapi-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-filewriterapi-w3c-tests/inst.apk.py +++ b/ivi/tct-filewriterapi-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-filewriterapi-w3c-tests/inst.wgt.py b/ivi/tct-filewriterapi-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-filewriterapi-w3c-tests/inst.wgt.py +++ b/ivi/tct-filewriterapi-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-filewriterapi-w3c-tests/inst.xpk.py b/ivi/tct-filewriterapi-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-filewriterapi-w3c-tests/inst.xpk.py +++ b/ivi/tct-filewriterapi-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-flexiblebox-css3-tests/inst.apk.py b/ivi/tct-flexiblebox-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-flexiblebox-css3-tests/inst.apk.py +++ b/ivi/tct-flexiblebox-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-flexiblebox-css3-tests/inst.wgt.py b/ivi/tct-flexiblebox-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-flexiblebox-css3-tests/inst.wgt.py +++ b/ivi/tct-flexiblebox-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-flexiblebox-css3-tests/inst.xpk.py b/ivi/tct-flexiblebox-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-flexiblebox-css3-tests/inst.xpk.py +++ b/ivi/tct-flexiblebox-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-fonts-css3-tests/inst.apk.py b/ivi/tct-fonts-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-fonts-css3-tests/inst.apk.py +++ b/ivi/tct-fonts-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-fonts-css3-tests/inst.wgt.py b/ivi/tct-fonts-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-fonts-css3-tests/inst.wgt.py +++ b/ivi/tct-fonts-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-fonts-css3-tests/inst.xpk.py b/ivi/tct-fonts-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-fonts-css3-tests/inst.xpk.py +++ b/ivi/tct-fonts-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-forms-html5-tests/inst.apk.py b/ivi/tct-forms-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-forms-html5-tests/inst.apk.py +++ b/ivi/tct-forms-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-forms-html5-tests/inst.wgt.py b/ivi/tct-forms-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-forms-html5-tests/inst.wgt.py +++ b/ivi/tct-forms-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-forms-html5-tests/inst.xpk.py b/ivi/tct-forms-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-forms-html5-tests/inst.xpk.py +++ b/ivi/tct-forms-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-fullscreen-nonw3c-tests/inst.apk.py b/ivi/tct-fullscreen-nonw3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-fullscreen-nonw3c-tests/inst.apk.py +++ b/ivi/tct-fullscreen-nonw3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-fullscreen-nonw3c-tests/inst.wgt.py b/ivi/tct-fullscreen-nonw3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-fullscreen-nonw3c-tests/inst.wgt.py +++ b/ivi/tct-fullscreen-nonw3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-fullscreen-nonw3c-tests/inst.xpk.py b/ivi/tct-fullscreen-nonw3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-fullscreen-nonw3c-tests/inst.xpk.py +++ b/ivi/tct-fullscreen-nonw3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-geoallow-w3c-tests/inst.apk.py b/ivi/tct-geoallow-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-geoallow-w3c-tests/inst.apk.py +++ b/ivi/tct-geoallow-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-geoallow-w3c-tests/inst.wgt.py b/ivi/tct-geoallow-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-geoallow-w3c-tests/inst.wgt.py +++ b/ivi/tct-geoallow-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-geoallow-w3c-tests/inst.xpk.py b/ivi/tct-geoallow-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-geoallow-w3c-tests/inst.xpk.py +++ b/ivi/tct-geoallow-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-geodeny-w3c-tests/inst.apk.py b/ivi/tct-geodeny-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-geodeny-w3c-tests/inst.apk.py +++ b/ivi/tct-geodeny-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-geodeny-w3c-tests/inst.wgt.py b/ivi/tct-geodeny-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-geodeny-w3c-tests/inst.wgt.py +++ b/ivi/tct-geodeny-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-geodeny-w3c-tests/inst.xpk.py b/ivi/tct-geodeny-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-geodeny-w3c-tests/inst.xpk.py +++ b/ivi/tct-geodeny-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-getcapabilities/inst.apk.py b/ivi/tct-getcapabilities/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-getcapabilities/inst.apk.py +++ b/ivi/tct-getcapabilities/inst.apk.py @@ -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: diff --git a/ivi/tct-getcapabilities/inst.wgt.py b/ivi/tct-getcapabilities/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-getcapabilities/inst.wgt.py +++ b/ivi/tct-getcapabilities/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-getcapabilities/inst.xpk.py b/ivi/tct-getcapabilities/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-getcapabilities/inst.xpk.py +++ b/ivi/tct-getcapabilities/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-gumallow-w3c-tests/inst.apk.py b/ivi/tct-gumallow-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-gumallow-w3c-tests/inst.apk.py +++ b/ivi/tct-gumallow-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-gumallow-w3c-tests/inst.wgt.py b/ivi/tct-gumallow-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-gumallow-w3c-tests/inst.wgt.py +++ b/ivi/tct-gumallow-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-gumallow-w3c-tests/inst.xpk.py b/ivi/tct-gumallow-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-gumallow-w3c-tests/inst.xpk.py +++ b/ivi/tct-gumallow-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-indexeddb-w3c-tests/inst.apk.py b/ivi/tct-indexeddb-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-indexeddb-w3c-tests/inst.apk.py +++ b/ivi/tct-indexeddb-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-indexeddb-w3c-tests/inst.wgt.py b/ivi/tct-indexeddb-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-indexeddb-w3c-tests/inst.wgt.py +++ b/ivi/tct-indexeddb-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-indexeddb-w3c-tests/inst.xpk.py b/ivi/tct-indexeddb-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-indexeddb-w3c-tests/inst.xpk.py +++ b/ivi/tct-indexeddb-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-jsenhance-html5-tests/inst.apk.py b/ivi/tct-jsenhance-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-jsenhance-html5-tests/inst.apk.py +++ b/ivi/tct-jsenhance-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-jsenhance-html5-tests/inst.wgt.py b/ivi/tct-jsenhance-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-jsenhance-html5-tests/inst.wgt.py +++ b/ivi/tct-jsenhance-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-jsenhance-html5-tests/inst.xpk.py b/ivi/tct-jsenhance-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-jsenhance-html5-tests/inst.xpk.py +++ b/ivi/tct-jsenhance-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-mediaqueries-css3-tests/inst.apk.py b/ivi/tct-mediaqueries-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-mediaqueries-css3-tests/inst.apk.py +++ b/ivi/tct-mediaqueries-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-mediaqueries-css3-tests/inst.wgt.py b/ivi/tct-mediaqueries-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-mediaqueries-css3-tests/inst.wgt.py +++ b/ivi/tct-mediaqueries-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-mediaqueries-css3-tests/inst.xpk.py b/ivi/tct-mediaqueries-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-mediaqueries-css3-tests/inst.xpk.py +++ b/ivi/tct-mediaqueries-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-messageport-tizen-tests/inst.apk.py b/ivi/tct-messageport-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-messageport-tizen-tests/inst.apk.py +++ b/ivi/tct-messageport-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-messageport-tizen-tests/inst.wgt.py b/ivi/tct-messageport-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-messageport-tizen-tests/inst.wgt.py +++ b/ivi/tct-messageport-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-messageport-tizen-tests/inst.xpk.py b/ivi/tct-messageport-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-messageport-tizen-tests/inst.xpk.py +++ b/ivi/tct-messageport-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-multicolumn-css3-tests/inst.apk.py b/ivi/tct-multicolumn-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-multicolumn-css3-tests/inst.apk.py +++ b/ivi/tct-multicolumn-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-multicolumn-css3-tests/inst.wgt.py b/ivi/tct-multicolumn-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-multicolumn-css3-tests/inst.wgt.py +++ b/ivi/tct-multicolumn-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-multicolumn-css3-tests/inst.xpk.py b/ivi/tct-multicolumn-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-multicolumn-css3-tests/inst.xpk.py +++ b/ivi/tct-multicolumn-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-namespace-tizen-tests/inst.apk.py b/ivi/tct-namespace-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-namespace-tizen-tests/inst.apk.py +++ b/ivi/tct-namespace-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-namespace-tizen-tests/inst.wgt.py b/ivi/tct-namespace-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-namespace-tizen-tests/inst.wgt.py +++ b/ivi/tct-namespace-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-namespace-tizen-tests/inst.xpk.py b/ivi/tct-namespace-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-namespace-tizen-tests/inst.xpk.py +++ b/ivi/tct-namespace-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-navigationtiming-w3c-tests/inst.apk.py b/ivi/tct-navigationtiming-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-navigationtiming-w3c-tests/inst.apk.py +++ b/ivi/tct-navigationtiming-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-navigationtiming-w3c-tests/inst.wgt.py b/ivi/tct-navigationtiming-w3c-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-navigationtiming-w3c-tests/inst.wgt.py +++ b/ivi/tct-navigationtiming-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-navigationtiming-w3c-tests/inst.xpk.py b/ivi/tct-navigationtiming-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-navigationtiming-w3c-tests/inst.xpk.py +++ b/ivi/tct-navigationtiming-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-notification-tizen-tests/inst.apk.py b/ivi/tct-notification-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-notification-tizen-tests/inst.apk.py +++ b/ivi/tct-notification-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-notification-tizen-tests/inst.wgt.py b/ivi/tct-notification-tizen-tests/inst.wgt.py index 58fa04cbf..ceefce39d 100755 --- a/ivi/tct-notification-tizen-tests/inst.wgt.py +++ b/ivi/tct-notification-tizen-tests/inst.wgt.py @@ -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 @@ -184,8 +184,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: @@ -204,7 +204,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -214,10 +214,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: diff --git a/ivi/tct-notification-tizen-tests/inst.xpk.py b/ivi/tct-notification-tizen-tests/inst.xpk.py index 24c306935..1d56a7d91 100755 --- a/ivi/tct-notification-tizen-tests/inst.xpk.py +++ b/ivi/tct-notification-tizen-tests/inst.xpk.py @@ -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 @@ -184,8 +184,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: @@ -204,7 +204,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -214,10 +214,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: diff --git a/ivi/tct-notification-w3c-tests/inst.apk.py b/ivi/tct-notification-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-notification-w3c-tests/inst.apk.py +++ b/ivi/tct-notification-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-notification-w3c-tests/inst.wgt.py b/ivi/tct-notification-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-notification-w3c-tests/inst.wgt.py +++ b/ivi/tct-notification-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-notification-w3c-tests/inst.xpk.py b/ivi/tct-notification-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-notification-w3c-tests/inst.xpk.py +++ b/ivi/tct-notification-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-package-tizen-tests/inst.apk.py b/ivi/tct-package-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-package-tizen-tests/inst.apk.py +++ b/ivi/tct-package-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-package-tizen-tests/inst.wgt.py b/ivi/tct-package-tizen-tests/inst.wgt.py index 6fce2fba5..3f6a9265e 100755 --- a/ivi/tct-package-tizen-tests/inst.wgt.py +++ b/ivi/tct-package-tizen-tests/inst.wgt.py @@ -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 @@ -176,8 +176,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: @@ -196,7 +196,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -206,10 +206,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: diff --git a/ivi/tct-package-tizen-tests/inst.xpk.py b/ivi/tct-package-tizen-tests/inst.xpk.py index 25ce6831d..3ec8311ff 100755 --- a/ivi/tct-package-tizen-tests/inst.xpk.py +++ b/ivi/tct-package-tizen-tests/inst.xpk.py @@ -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 @@ -176,8 +176,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: @@ -196,7 +196,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -206,10 +206,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: diff --git a/ivi/tct-pagevisibility-w3c-tests/inst.apk.py b/ivi/tct-pagevisibility-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-pagevisibility-w3c-tests/inst.apk.py +++ b/ivi/tct-pagevisibility-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-pagevisibility-w3c-tests/inst.wgt.py b/ivi/tct-pagevisibility-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-pagevisibility-w3c-tests/inst.wgt.py +++ b/ivi/tct-pagevisibility-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-pagevisibility-w3c-tests/inst.xpk.py b/ivi/tct-pagevisibility-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-pagevisibility-w3c-tests/inst.xpk.py +++ b/ivi/tct-pagevisibility-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-power-tizen-tests/inst.apk.py b/ivi/tct-power-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-power-tizen-tests/inst.apk.py +++ b/ivi/tct-power-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-power-tizen-tests/inst.wgt.py b/ivi/tct-power-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-power-tizen-tests/inst.wgt.py +++ b/ivi/tct-power-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-power-tizen-tests/inst.xpk.py b/ivi/tct-power-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-power-tizen-tests/inst.xpk.py +++ b/ivi/tct-power-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-privilege-tizen-tests/inst.apk.py b/ivi/tct-privilege-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-privilege-tizen-tests/inst.apk.py +++ b/ivi/tct-privilege-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-privilege-tizen-tests/inst.wgt.py b/ivi/tct-privilege-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-privilege-tizen-tests/inst.wgt.py +++ b/ivi/tct-privilege-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-privilege-tizen-tests/inst.xpk.py b/ivi/tct-privilege-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-privilege-tizen-tests/inst.xpk.py +++ b/ivi/tct-privilege-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-sandbox-html5-tests/inst.apk.py b/ivi/tct-sandbox-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-sandbox-html5-tests/inst.apk.py +++ b/ivi/tct-sandbox-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-sandbox-html5-tests/inst.wgt.py b/ivi/tct-sandbox-html5-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-sandbox-html5-tests/inst.wgt.py +++ b/ivi/tct-sandbox-html5-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-sandbox-html5-tests/inst.xpk.py b/ivi/tct-sandbox-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-sandbox-html5-tests/inst.xpk.py +++ b/ivi/tct-sandbox-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-screenorientation-w3c-tests/inst.apk.py b/ivi/tct-screenorientation-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-screenorientation-w3c-tests/inst.apk.py +++ b/ivi/tct-screenorientation-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-screenorientation-w3c-tests/inst.wgt.py b/ivi/tct-screenorientation-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-screenorientation-w3c-tests/inst.wgt.py +++ b/ivi/tct-screenorientation-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-screenorientation-w3c-tests/inst.xpk.py b/ivi/tct-screenorientation-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-screenorientation-w3c-tests/inst.xpk.py +++ b/ivi/tct-screenorientation-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-security-tcs-tests/inst.apk.py b/ivi/tct-security-tcs-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-security-tcs-tests/inst.apk.py +++ b/ivi/tct-security-tcs-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-security-tcs-tests/inst.wgt.py b/ivi/tct-security-tcs-tests/inst.wgt.py index d26375e71..59454337a 100755 --- a/ivi/tct-security-tcs-tests/inst.wgt.py +++ b/ivi/tct-security-tcs-tests/inst.wgt.py @@ -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 @@ -162,8 +162,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: @@ -182,7 +182,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -192,10 +192,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: diff --git a/ivi/tct-security-tcs-tests/inst.xpk.py b/ivi/tct-security-tcs-tests/inst.xpk.py index 2b58ff607..635947096 100755 --- a/ivi/tct-security-tcs-tests/inst.xpk.py +++ b/ivi/tct-security-tcs-tests/inst.xpk.py @@ -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 @@ -162,8 +162,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: @@ -182,7 +182,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -192,10 +192,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: diff --git a/ivi/tct-selectorslevel1-w3c-tests/inst.apk.py b/ivi/tct-selectorslevel1-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-selectorslevel1-w3c-tests/inst.apk.py +++ b/ivi/tct-selectorslevel1-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-selectorslevel1-w3c-tests/inst.wgt.py b/ivi/tct-selectorslevel1-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-selectorslevel1-w3c-tests/inst.wgt.py +++ b/ivi/tct-selectorslevel1-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-selectorslevel1-w3c-tests/inst.xpk.py b/ivi/tct-selectorslevel1-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-selectorslevel1-w3c-tests/inst.xpk.py +++ b/ivi/tct-selectorslevel1-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-selectorslevel2-w3c-tests/inst.apk.py b/ivi/tct-selectorslevel2-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-selectorslevel2-w3c-tests/inst.apk.py +++ b/ivi/tct-selectorslevel2-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-selectorslevel2-w3c-tests/inst.wgt.py b/ivi/tct-selectorslevel2-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-selectorslevel2-w3c-tests/inst.wgt.py +++ b/ivi/tct-selectorslevel2-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-selectorslevel2-w3c-tests/inst.xpk.py b/ivi/tct-selectorslevel2-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-selectorslevel2-w3c-tests/inst.xpk.py +++ b/ivi/tct-selectorslevel2-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-sessionhistory-html5-tests/inst.apk.py b/ivi/tct-sessionhistory-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-sessionhistory-html5-tests/inst.apk.py +++ b/ivi/tct-sessionhistory-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-sessionhistory-html5-tests/inst.wgt.py b/ivi/tct-sessionhistory-html5-tests/inst.wgt.py index c21cdecda..f11e570b7 100755 --- a/ivi/tct-sessionhistory-html5-tests/inst.wgt.py +++ b/ivi/tct-sessionhistory-html5-tests/inst.wgt.py @@ -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: diff --git a/ivi/tct-sessionhistory-html5-tests/inst.xpk.py b/ivi/tct-sessionhistory-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-sessionhistory-html5-tests/inst.xpk.py +++ b/ivi/tct-sessionhistory-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-sse-w3c-tests/inst.apk.py b/ivi/tct-sse-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-sse-w3c-tests/inst.apk.py +++ b/ivi/tct-sse-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-sse-w3c-tests/inst.wgt.py b/ivi/tct-sse-w3c-tests/inst.wgt.py index afef62e72..ebb8353d1 100755 --- a/ivi/tct-sse-w3c-tests/inst.wgt.py +++ b/ivi/tct-sse-w3c-tests/inst.wgt.py @@ -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 @@ -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) user_info = getUSERID() @@ -210,10 +210,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: diff --git a/ivi/tct-sse-w3c-tests/inst.xpk.py b/ivi/tct-sse-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-sse-w3c-tests/inst.xpk.py +++ b/ivi/tct-sse-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-svg-html5-tests/inst.apk.py b/ivi/tct-svg-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-svg-html5-tests/inst.apk.py +++ b/ivi/tct-svg-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-svg-html5-tests/inst.wgt.py b/ivi/tct-svg-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-svg-html5-tests/inst.wgt.py +++ b/ivi/tct-svg-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-svg-html5-tests/inst.xpk.py b/ivi/tct-svg-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-svg-html5-tests/inst.xpk.py +++ b/ivi/tct-svg-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-systeminfo-tizen-tests/inst.apk.py b/ivi/tct-systeminfo-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-systeminfo-tizen-tests/inst.apk.py +++ b/ivi/tct-systeminfo-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-systeminfo-tizen-tests/inst.wgt.py b/ivi/tct-systeminfo-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-systeminfo-tizen-tests/inst.wgt.py +++ b/ivi/tct-systeminfo-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-systeminfo-tizen-tests/inst.xpk.py b/ivi/tct-systeminfo-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-systeminfo-tizen-tests/inst.xpk.py +++ b/ivi/tct-systeminfo-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-systemsetting-tizen-tests/inst.apk.py b/ivi/tct-systemsetting-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-systemsetting-tizen-tests/inst.apk.py +++ b/ivi/tct-systemsetting-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-systemsetting-tizen-tests/inst.wgt.py b/ivi/tct-systemsetting-tizen-tests/inst.wgt.py index e7aeac9ec..f2417bdad 100755 --- a/ivi/tct-systemsetting-tizen-tests/inst.wgt.py +++ b/ivi/tct-systemsetting-tizen-tests/inst.wgt.py @@ -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 @@ -169,8 +169,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: @@ -189,7 +189,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -199,10 +199,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: diff --git a/ivi/tct-systemsetting-tizen-tests/inst.xpk.py b/ivi/tct-systemsetting-tizen-tests/inst.xpk.py index 8a8ed798d..cadbfcc44 100755 --- a/ivi/tct-systemsetting-tizen-tests/inst.xpk.py +++ b/ivi/tct-systemsetting-tizen-tests/inst.xpk.py @@ -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 @@ -169,8 +169,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: @@ -189,7 +189,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -199,10 +199,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: diff --git a/ivi/tct-testconfig/inst.apk.py b/ivi/tct-testconfig/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-testconfig/inst.apk.py +++ b/ivi/tct-testconfig/inst.apk.py @@ -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: diff --git a/ivi/tct-testconfig/inst.wgt.py b/ivi/tct-testconfig/inst.wgt.py index 183d9078e..87ca4d612 100755 --- a/ivi/tct-testconfig/inst.wgt.py +++ b/ivi/tct-testconfig/inst.wgt.py @@ -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 @@ -139,8 +139,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: @@ -159,7 +159,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -169,10 +169,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: diff --git a/ivi/tct-testconfig/inst.xpk.py b/ivi/tct-testconfig/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-testconfig/inst.xpk.py +++ b/ivi/tct-testconfig/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-time-tizen-tests/inst.apk.py b/ivi/tct-time-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-time-tizen-tests/inst.apk.py +++ b/ivi/tct-time-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-time-tizen-tests/inst.wgt.py b/ivi/tct-time-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-time-tizen-tests/inst.wgt.py +++ b/ivi/tct-time-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-time-tizen-tests/inst.xpk.py b/ivi/tct-time-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-time-tizen-tests/inst.xpk.py +++ b/ivi/tct-time-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-tizen-tizen-tests/inst.apk.py b/ivi/tct-tizen-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-tizen-tizen-tests/inst.apk.py +++ b/ivi/tct-tizen-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-tizen-tizen-tests/inst.wgt.py b/ivi/tct-tizen-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-tizen-tizen-tests/inst.wgt.py +++ b/ivi/tct-tizen-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-tizen-tizen-tests/inst.xpk.py b/ivi/tct-tizen-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-tizen-tizen-tests/inst.xpk.py +++ b/ivi/tct-tizen-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-touchevent-w3c-tests/inst.apk.py b/ivi/tct-touchevent-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-touchevent-w3c-tests/inst.apk.py +++ b/ivi/tct-touchevent-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-touchevent-w3c-tests/inst.wgt.py b/ivi/tct-touchevent-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-touchevent-w3c-tests/inst.wgt.py +++ b/ivi/tct-touchevent-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-touchevent-w3c-tests/inst.xpk.py b/ivi/tct-touchevent-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-touchevent-w3c-tests/inst.xpk.py +++ b/ivi/tct-touchevent-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-transitions-css3-tests/inst.apk.py b/ivi/tct-transitions-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-transitions-css3-tests/inst.apk.py +++ b/ivi/tct-transitions-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-transitions-css3-tests/inst.wgt.py b/ivi/tct-transitions-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-transitions-css3-tests/inst.wgt.py +++ b/ivi/tct-transitions-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-transitions-css3-tests/inst.xpk.py b/ivi/tct-transitions-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-transitions-css3-tests/inst.xpk.py +++ b/ivi/tct-transitions-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-typedarrays-nonw3c-tests/inst.apk.py b/ivi/tct-typedarrays-nonw3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-typedarrays-nonw3c-tests/inst.apk.py +++ b/ivi/tct-typedarrays-nonw3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-typedarrays-nonw3c-tests/inst.wgt.py b/ivi/tct-typedarrays-nonw3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-typedarrays-nonw3c-tests/inst.wgt.py +++ b/ivi/tct-typedarrays-nonw3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-typedarrays-nonw3c-tests/inst.xpk.py b/ivi/tct-typedarrays-nonw3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-typedarrays-nonw3c-tests/inst.xpk.py +++ b/ivi/tct-typedarrays-nonw3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-ui-css3-tests/inst.apk.py b/ivi/tct-ui-css3-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-ui-css3-tests/inst.apk.py +++ b/ivi/tct-ui-css3-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-ui-css3-tests/inst.wgt.py b/ivi/tct-ui-css3-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-ui-css3-tests/inst.wgt.py +++ b/ivi/tct-ui-css3-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-ui-css3-tests/inst.xpk.py b/ivi/tct-ui-css3-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-ui-css3-tests/inst.xpk.py +++ b/ivi/tct-ui-css3-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-video-html5-tests/inst.apk.py b/ivi/tct-video-html5-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-video-html5-tests/inst.apk.py +++ b/ivi/tct-video-html5-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-video-html5-tests/inst.wgt.py b/ivi/tct-video-html5-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-video-html5-tests/inst.wgt.py +++ b/ivi/tct-video-html5-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-video-html5-tests/inst.xpk.py b/ivi/tct-video-html5-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-video-html5-tests/inst.xpk.py +++ b/ivi/tct-video-html5-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-webaudio-w3c-tests/inst.apk.py b/ivi/tct-webaudio-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-webaudio-w3c-tests/inst.apk.py +++ b/ivi/tct-webaudio-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-webaudio-w3c-tests/inst.wgt.py b/ivi/tct-webaudio-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-webaudio-w3c-tests/inst.wgt.py +++ b/ivi/tct-webaudio-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-webaudio-w3c-tests/inst.xpk.py b/ivi/tct-webaudio-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-webaudio-w3c-tests/inst.xpk.py +++ b/ivi/tct-webaudio-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-webdatabase-w3c-tests/inst.apk.py b/ivi/tct-webdatabase-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-webdatabase-w3c-tests/inst.apk.py +++ b/ivi/tct-webdatabase-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-webdatabase-w3c-tests/inst.wgt.py b/ivi/tct-webdatabase-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-webdatabase-w3c-tests/inst.wgt.py +++ b/ivi/tct-webdatabase-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-webdatabase-w3c-tests/inst.xpk.py b/ivi/tct-webdatabase-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-webdatabase-w3c-tests/inst.xpk.py +++ b/ivi/tct-webdatabase-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-webgl-nonw3c-tests/inst.apk.py b/ivi/tct-webgl-nonw3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-webgl-nonw3c-tests/inst.apk.py +++ b/ivi/tct-webgl-nonw3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-webgl-nonw3c-tests/inst.wgt.py b/ivi/tct-webgl-nonw3c-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-webgl-nonw3c-tests/inst.wgt.py +++ b/ivi/tct-webgl-nonw3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-webgl-nonw3c-tests/inst.xpk.py b/ivi/tct-webgl-nonw3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-webgl-nonw3c-tests/inst.xpk.py +++ b/ivi/tct-webgl-nonw3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-webmessaging-w3c-tests/inst.apk.py b/ivi/tct-webmessaging-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-webmessaging-w3c-tests/inst.apk.py +++ b/ivi/tct-webmessaging-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-webmessaging-w3c-tests/inst.wgt.py b/ivi/tct-webmessaging-w3c-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-webmessaging-w3c-tests/inst.wgt.py +++ b/ivi/tct-webmessaging-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-webmessaging-w3c-tests/inst.xpk.py b/ivi/tct-webmessaging-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-webmessaging-w3c-tests/inst.xpk.py +++ b/ivi/tct-webmessaging-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-websetting-tizen-tests/inst.apk.py b/ivi/tct-websetting-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-websetting-tizen-tests/inst.apk.py +++ b/ivi/tct-websetting-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-websetting-tizen-tests/inst.wgt.py b/ivi/tct-websetting-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-websetting-tizen-tests/inst.wgt.py +++ b/ivi/tct-websetting-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-websetting-tizen-tests/inst.xpk.py b/ivi/tct-websetting-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-websetting-tizen-tests/inst.xpk.py +++ b/ivi/tct-websetting-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-websocket-w3c-tests/inst.apk.py b/ivi/tct-websocket-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-websocket-w3c-tests/inst.apk.py +++ b/ivi/tct-websocket-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-websocket-w3c-tests/inst.wgt.py b/ivi/tct-websocket-w3c-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-websocket-w3c-tests/inst.wgt.py +++ b/ivi/tct-websocket-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-websocket-w3c-tests/inst.xpk.py b/ivi/tct-websocket-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-websocket-w3c-tests/inst.xpk.py +++ b/ivi/tct-websocket-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-webstorage-w3c-tests/inst.apk.py b/ivi/tct-webstorage-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-webstorage-w3c-tests/inst.apk.py +++ b/ivi/tct-webstorage-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-webstorage-w3c-tests/inst.wgt.py b/ivi/tct-webstorage-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-webstorage-w3c-tests/inst.wgt.py +++ b/ivi/tct-webstorage-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-webstorage-w3c-tests/inst.xpk.py b/ivi/tct-webstorage-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-webstorage-w3c-tests/inst.xpk.py +++ b/ivi/tct-webstorage-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-wgtapi01-w3c-tests/inst.apk.py b/ivi/tct-wgtapi01-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-wgtapi01-w3c-tests/inst.apk.py +++ b/ivi/tct-wgtapi01-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-wgtapi01-w3c-tests/inst.wgt.py b/ivi/tct-wgtapi01-w3c-tests/inst.wgt.py index fedb04beb..5b9572769 100755 --- a/ivi/tct-wgtapi01-w3c-tests/inst.wgt.py +++ b/ivi/tct-wgtapi01-w3c-tests/inst.wgt.py @@ -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 @@ -170,8 +170,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: @@ -190,7 +190,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -200,10 +200,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: diff --git a/ivi/tct-wgtapi01-w3c-tests/inst.xpk.py b/ivi/tct-wgtapi01-w3c-tests/inst.xpk.py index 8e14d7da5..60a188baa 100755 --- a/ivi/tct-wgtapi01-w3c-tests/inst.xpk.py +++ b/ivi/tct-wgtapi01-w3c-tests/inst.xpk.py @@ -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 @@ -170,8 +170,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: @@ -190,7 +190,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -200,10 +200,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: diff --git a/ivi/tct-wgtapi02-w3c-tests/inst.apk.py b/ivi/tct-wgtapi02-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-wgtapi02-w3c-tests/inst.apk.py +++ b/ivi/tct-wgtapi02-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-wgtapi02-w3c-tests/inst.wgt.py b/ivi/tct-wgtapi02-w3c-tests/inst.wgt.py index 43f110bce..617c1f44c 100755 --- a/ivi/tct-wgtapi02-w3c-tests/inst.wgt.py +++ b/ivi/tct-wgtapi02-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-wgtapi02-w3c-tests/inst.xpk.py b/ivi/tct-wgtapi02-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-wgtapi02-w3c-tests/inst.xpk.py +++ b/ivi/tct-wgtapi02-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-widget01-w3c-tests/inst.apk.py b/ivi/tct-widget01-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-widget01-w3c-tests/inst.apk.py +++ b/ivi/tct-widget01-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-widget01-w3c-tests/inst.wgt.py b/ivi/tct-widget01-w3c-tests/inst.wgt.py index fedb04beb..5b9572769 100755 --- a/ivi/tct-widget01-w3c-tests/inst.wgt.py +++ b/ivi/tct-widget01-w3c-tests/inst.wgt.py @@ -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 @@ -170,8 +170,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: @@ -190,7 +190,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -200,10 +200,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: diff --git a/ivi/tct-widget01-w3c-tests/inst.xpk.py b/ivi/tct-widget01-w3c-tests/inst.xpk.py index 8e14d7da5..60a188baa 100755 --- a/ivi/tct-widget01-w3c-tests/inst.xpk.py +++ b/ivi/tct-widget01-w3c-tests/inst.xpk.py @@ -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 @@ -170,8 +170,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: @@ -190,7 +190,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -200,10 +200,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: diff --git a/ivi/tct-widget02-w3c-tests/inst.apk.py b/ivi/tct-widget02-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-widget02-w3c-tests/inst.apk.py +++ b/ivi/tct-widget02-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-widget02-w3c-tests/inst.wgt.py b/ivi/tct-widget02-w3c-tests/inst.wgt.py index 7574ae1d7..773707bb2 100755 --- a/ivi/tct-widget02-w3c-tests/inst.wgt.py +++ b/ivi/tct-widget02-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-widget02-w3c-tests/inst.xpk.py b/ivi/tct-widget02-w3c-tests/inst.xpk.py index 6bc5749c3..88d4d47ed 100755 --- a/ivi/tct-widget02-w3c-tests/inst.xpk.py +++ b/ivi/tct-widget02-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-widgetpolicy-w3c-tests/inst.apk.py b/ivi/tct-widgetpolicy-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-widgetpolicy-w3c-tests/inst.apk.py +++ b/ivi/tct-widgetpolicy-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-widgetpolicy-w3c-tests/inst.wgt.py b/ivi/tct-widgetpolicy-w3c-tests/inst.wgt.py index dc5c11750..b7ded0857 100755 --- a/ivi/tct-widgetpolicy-w3c-tests/inst.wgt.py +++ b/ivi/tct-widgetpolicy-w3c-tests/inst.wgt.py @@ -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 @@ -172,8 +172,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: @@ -192,7 +192,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -202,10 +202,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: diff --git a/ivi/tct-widgetpolicy-w3c-tests/inst.xpk.py b/ivi/tct-widgetpolicy-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-widgetpolicy-w3c-tests/inst.xpk.py +++ b/ivi/tct-widgetpolicy-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-woff-w3c-tests/inst.apk.py b/ivi/tct-woff-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-woff-w3c-tests/inst.apk.py +++ b/ivi/tct-woff-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-woff-w3c-tests/inst.wgt.py b/ivi/tct-woff-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-woff-w3c-tests/inst.wgt.py +++ b/ivi/tct-woff-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-woff-w3c-tests/inst.xpk.py b/ivi/tct-woff-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-woff-w3c-tests/inst.xpk.py +++ b/ivi/tct-woff-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-workers-w3c-tests/inst.apk.py b/ivi/tct-workers-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-workers-w3c-tests/inst.apk.py +++ b/ivi/tct-workers-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-workers-w3c-tests/inst.wgt.py b/ivi/tct-workers-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/tct-workers-w3c-tests/inst.wgt.py +++ b/ivi/tct-workers-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/tct-workers-w3c-tests/inst.xpk.py b/ivi/tct-workers-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-workers-w3c-tests/inst.xpk.py +++ b/ivi/tct-workers-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/tct-xmlhttprequest-w3c-tests/inst.apk.py b/ivi/tct-xmlhttprequest-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/tct-xmlhttprequest-w3c-tests/inst.apk.py +++ b/ivi/tct-xmlhttprequest-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/tct-xmlhttprequest-w3c-tests/inst.wgt.py b/ivi/tct-xmlhttprequest-w3c-tests/inst.wgt.py index db5440cb7..8515a88b8 100755 --- a/ivi/tct-xmlhttprequest-w3c-tests/inst.wgt.py +++ b/ivi/tct-xmlhttprequest-w3c-tests/inst.wgt.py @@ -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: diff --git a/ivi/tct-xmlhttprequest-w3c-tests/inst.xpk.py b/ivi/tct-xmlhttprequest-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/tct-xmlhttprequest-w3c-tests/inst.xpk.py +++ b/ivi/tct-xmlhttprequest-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-hrtime-w3c-tests/inst.apk.py b/ivi/webapi-hrtime-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-hrtime-w3c-tests/inst.apk.py +++ b/ivi/webapi-hrtime-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-hrtime-w3c-tests/inst.wgt.py b/ivi/webapi-hrtime-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-hrtime-w3c-tests/inst.wgt.py +++ b/ivi/webapi-hrtime-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-hrtime-w3c-tests/inst.xpk.py b/ivi/webapi-hrtime-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-hrtime-w3c-tests/inst.xpk.py +++ b/ivi/webapi-hrtime-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-nfc-w3c-tests/inst.apk.py b/ivi/webapi-nfc-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-nfc-w3c-tests/inst.apk.py +++ b/ivi/webapi-nfc-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-nfc-w3c-tests/inst.wgt.py b/ivi/webapi-nfc-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-nfc-w3c-tests/inst.wgt.py +++ b/ivi/webapi-nfc-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-nfc-w3c-tests/inst.xpk.py b/ivi/webapi-nfc-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-nfc-w3c-tests/inst.xpk.py +++ b/ivi/webapi-nfc-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-performancetimeline-w3c-tests/inst.apk.py b/ivi/webapi-performancetimeline-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-performancetimeline-w3c-tests/inst.apk.py +++ b/ivi/webapi-performancetimeline-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-performancetimeline-w3c-tests/inst.wgt.py b/ivi/webapi-performancetimeline-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-performancetimeline-w3c-tests/inst.wgt.py +++ b/ivi/webapi-performancetimeline-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-performancetimeline-w3c-tests/inst.xpk.py b/ivi/webapi-performancetimeline-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-performancetimeline-w3c-tests/inst.xpk.py +++ b/ivi/webapi-performancetimeline-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-resourcetiming-w3c-tests/inst.apk.py b/ivi/webapi-resourcetiming-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-resourcetiming-w3c-tests/inst.apk.py +++ b/ivi/webapi-resourcetiming-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-resourcetiming-w3c-tests/inst.wgt.py b/ivi/webapi-resourcetiming-w3c-tests/inst.wgt.py index eedbf8845..929bf5c3f 100755 --- a/ivi/webapi-resourcetiming-w3c-tests/inst.wgt.py +++ b/ivi/webapi-resourcetiming-w3c-tests/inst.wgt.py @@ -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: diff --git a/ivi/webapi-resourcetiming-w3c-tests/inst.xpk.py b/ivi/webapi-resourcetiming-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-resourcetiming-w3c-tests/inst.xpk.py +++ b/ivi/webapi-resourcetiming-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-speechapi-tizen-tests/inst.apk.py b/ivi/webapi-speechapi-tizen-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-speechapi-tizen-tests/inst.apk.py +++ b/ivi/webapi-speechapi-tizen-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-speechapi-tizen-tests/inst.wgt.py b/ivi/webapi-speechapi-tizen-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-speechapi-tizen-tests/inst.wgt.py +++ b/ivi/webapi-speechapi-tizen-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-speechapi-tizen-tests/inst.xpk.py b/ivi/webapi-speechapi-tizen-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-speechapi-tizen-tests/inst.xpk.py +++ b/ivi/webapi-speechapi-tizen-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-usertiming-w3c-tests/inst.apk.py b/ivi/webapi-usertiming-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-usertiming-w3c-tests/inst.apk.py +++ b/ivi/webapi-usertiming-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-usertiming-w3c-tests/inst.wgt.py b/ivi/webapi-usertiming-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-usertiming-w3c-tests/inst.wgt.py +++ b/ivi/webapi-usertiming-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-usertiming-w3c-tests/inst.xpk.py b/ivi/webapi-usertiming-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-usertiming-w3c-tests/inst.xpk.py +++ b/ivi/webapi-usertiming-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-vehicleinfo-ivi-tests/inst.apk.py b/ivi/webapi-vehicleinfo-ivi-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-vehicleinfo-ivi-tests/inst.apk.py +++ b/ivi/webapi-vehicleinfo-ivi-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-vehicleinfo-ivi-tests/inst.wgt.py b/ivi/webapi-vehicleinfo-ivi-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-vehicleinfo-ivi-tests/inst.wgt.py +++ b/ivi/webapi-vehicleinfo-ivi-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-vehicleinfo-ivi-tests/inst.xpk.py b/ivi/webapi-vehicleinfo-ivi-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-vehicleinfo-ivi-tests/inst.xpk.py +++ b/ivi/webapi-vehicleinfo-ivi-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/ivi/webapi-webrtc-w3c-tests/inst.apk.py b/ivi/webapi-webrtc-w3c-tests/inst.apk.py index a13f660a9..5fcedb9d9 100755 --- a/ivi/webapi-webrtc-w3c-tests/inst.apk.py +++ b/ivi/webapi-webrtc-w3c-tests/inst.apk.py @@ -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: diff --git a/ivi/webapi-webrtc-w3c-tests/inst.wgt.py b/ivi/webapi-webrtc-w3c-tests/inst.wgt.py index 918e9561d..44eca3371 100755 --- a/ivi/webapi-webrtc-w3c-tests/inst.wgt.py +++ b/ivi/webapi-webrtc-w3c-tests/inst.wgt.py @@ -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 @@ -178,8 +178,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: @@ -198,7 +198,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) user_info = getUSERID() @@ -208,10 +208,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: diff --git a/ivi/webapi-webrtc-w3c-tests/inst.xpk.py b/ivi/webapi-webrtc-w3c-tests/inst.xpk.py index 62f961bb9..11cdd8e23 100755 --- a/ivi/webapi-webrtc-w3c-tests/inst.xpk.py +++ b/ivi/webapi-webrtc-w3c-tests/inst.xpk.py @@ -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 @@ -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) user_info = getUSERID() @@ -209,10 +209,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: diff --git a/mobile/tct-capability-tests/inst.apk.py b/mobile/tct-capability-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/mobile/tct-capability-tests/inst.apk.py +++ b/mobile/tct-capability-tests/inst.apk.py @@ -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: diff --git a/mobile/tct-capability-tests/inst.wgt.py b/mobile/tct-capability-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/mobile/tct-capability-tests/inst.wgt.py +++ b/mobile/tct-capability-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/mobile/tct-capability-tests/inst.xpk.py b/mobile/tct-capability-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/mobile/tct-capability-tests/inst.xpk.py +++ b/mobile/tct-capability-tests/inst.xpk.py @@ -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: diff --git a/mobile/tct-capability-tests/pack.py b/mobile/tct-capability-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/mobile/tct-capability-tests/pack.py +++ b/mobile/tct-capability-tests/pack.py @@ -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: diff --git a/mobile/tct-deprecatedapi-tizen-tests/inst.apk.py b/mobile/tct-deprecatedapi-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/mobile/tct-deprecatedapi-tizen-tests/inst.apk.py +++ b/mobile/tct-deprecatedapi-tizen-tests/inst.apk.py @@ -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: diff --git a/mobile/tct-deprecatedapi-tizen-tests/inst.wgt.py b/mobile/tct-deprecatedapi-tizen-tests/inst.wgt.py index e32732b34..8e0d9ef1a 100755 --- a/mobile/tct-deprecatedapi-tizen-tests/inst.wgt.py +++ b/mobile/tct-deprecatedapi-tizen-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/mobile/tct-deprecatedapi-tizen-tests/inst.xpk.py b/mobile/tct-deprecatedapi-tizen-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/mobile/tct-deprecatedapi-tizen-tests/inst.xpk.py +++ b/mobile/tct-deprecatedapi-tizen-tests/inst.xpk.py @@ -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: diff --git a/mobile/tct-deprecatedapi-tizen-tests/pack.py b/mobile/tct-deprecatedapi-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/mobile/tct-deprecatedapi-tizen-tests/pack.py +++ b/mobile/tct-deprecatedapi-tizen-tests/pack.py @@ -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: diff --git a/tools/build/pack.py b/tools/build/pack.py index e48cdc174..22bf5e2a1 100755 --- a/tools/build/pack.py +++ b/tools/build/pack.py @@ -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: diff --git a/tools/coverage/stats.py b/tools/coverage/stats.py index e10865f47..10a22ab09 100755 --- a/tools/coverage/stats.py +++ b/tools/coverage/stats.py @@ -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() diff --git a/tools/xml/csv2xml.py b/tools/xml/csv2xml.py index 4447e4d65..bdfdb207d 100755 --- a/tools/xml/csv2xml.py +++ b/tools/xml/csv2xml.py @@ -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 | 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]]() diff --git a/tools/xml/xml2csv.py b/tools/xml/xml2csv.py index 07de9c35a..5a6d3ba2c 100755 --- a/tools/xml/xml2csv.py +++ b/tools/xml/xml2csv.py @@ -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) @@ -152,7 +152,7 @@ def echo_about(): This function will print the user guide and stop toolkit. """ about = 'xml2csv V1.0\n-c | 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: { diff --git a/tools/xml/xmlverifier.py b/tools/xml/xmlverifier.py index 4165ec9d6..9794b2c8b 100755 --- a/tools/xml/xmlverifier.py +++ b/tools/xml/xmlverifier.py @@ -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 | 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]]() diff --git a/tv/tct-capability-tests/inst.apk.py b/tv/tct-capability-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/tv/tct-capability-tests/inst.apk.py +++ b/tv/tct-capability-tests/inst.apk.py @@ -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: diff --git a/tv/tct-capability-tests/inst.wgt.py b/tv/tct-capability-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/tv/tct-capability-tests/inst.wgt.py +++ b/tv/tct-capability-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/tv/tct-capability-tests/inst.xpk.py b/tv/tct-capability-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/tv/tct-capability-tests/inst.xpk.py +++ b/tv/tct-capability-tests/inst.xpk.py @@ -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: diff --git a/tv/tct-capability-tests/pack.py b/tv/tct-capability-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/tv/tct-capability-tests/pack.py +++ b/tv/tct-capability-tests/pack.py @@ -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: diff --git a/tv/tct-deprecatedapi-tizen-tests/inst.apk.py b/tv/tct-deprecatedapi-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/tv/tct-deprecatedapi-tizen-tests/inst.apk.py +++ b/tv/tct-deprecatedapi-tizen-tests/inst.apk.py @@ -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: diff --git a/tv/tct-deprecatedapi-tizen-tests/inst.wgt.py b/tv/tct-deprecatedapi-tizen-tests/inst.wgt.py index e32732b34..8e0d9ef1a 100755 --- a/tv/tct-deprecatedapi-tizen-tests/inst.wgt.py +++ b/tv/tct-deprecatedapi-tizen-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/tv/tct-deprecatedapi-tizen-tests/inst.xpk.py b/tv/tct-deprecatedapi-tizen-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/tv/tct-deprecatedapi-tizen-tests/inst.xpk.py +++ b/tv/tct-deprecatedapi-tizen-tests/inst.xpk.py @@ -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: diff --git a/tv/tct-deprecatedapi-tizen-tests/pack.py b/tv/tct-deprecatedapi-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/tv/tct-deprecatedapi-tizen-tests/pack.py +++ b/tv/tct-deprecatedapi-tizen-tests/pack.py @@ -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: diff --git a/wearable/tct-capability-tests/inst.apk.py b/wearable/tct-capability-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/wearable/tct-capability-tests/inst.apk.py +++ b/wearable/tct-capability-tests/inst.apk.py @@ -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: diff --git a/wearable/tct-capability-tests/inst.wgt.py b/wearable/tct-capability-tests/inst.wgt.py index ef38eb600..6e0726097 100755 --- a/wearable/tct-capability-tests/inst.wgt.py +++ b/wearable/tct-capability-tests/inst.wgt.py @@ -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) @@ -37,7 +37,7 @@ def askpolicyremoving(): if file.endswith(".wgt"): pkg_id = getPKGID(os.path.basename(os.path.splitext(file)[0])) - print pkg_id + print (pkg_id) print (os.getcwd()) print (os.path.dirname(os.path.realpath(__file__)) ) if not doRemoteCopy("%s/askpolicy.sh" % SCRIPT_DIR, "%s" % (SRC_DIR)): @@ -49,14 +49,14 @@ def askpolicyremoving(): 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 @@ -205,8 +205,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: @@ -225,7 +225,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -237,10 +237,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: diff --git a/wearable/tct-capability-tests/inst.xpk.py b/wearable/tct-capability-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/wearable/tct-capability-tests/inst.xpk.py +++ b/wearable/tct-capability-tests/inst.xpk.py @@ -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: diff --git a/wearable/tct-capability-tests/pack.py b/wearable/tct-capability-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/wearable/tct-capability-tests/pack.py +++ b/wearable/tct-capability-tests/pack.py @@ -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: diff --git a/wearable/tct-deprecatedapi-tizen-tests/inst.apk.py b/wearable/tct-deprecatedapi-tizen-tests/inst.apk.py index 31210db16..997d98f37 100755 --- a/wearable/tct-deprecatedapi-tizen-tests/inst.apk.py +++ b/wearable/tct-deprecatedapi-tizen-tests/inst.apk.py @@ -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: diff --git a/wearable/tct-deprecatedapi-tizen-tests/inst.wgt.py b/wearable/tct-deprecatedapi-tizen-tests/inst.wgt.py index e32732b34..8e0d9ef1a 100755 --- a/wearable/tct-deprecatedapi-tizen-tests/inst.wgt.py +++ b/wearable/tct-deprecatedapi-tizen-tests/inst.wgt.py @@ -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 @@ -188,8 +188,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: @@ -208,7 +208,7 @@ def main(): PARAMETERS.mode = "SSH" if not PARAMETERS.device: - print "No device provided" + print ("No device provided") sys.exit(1) userCheck() @@ -220,10 +220,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: diff --git a/wearable/tct-deprecatedapi-tizen-tests/inst.xpk.py b/wearable/tct-deprecatedapi-tizen-tests/inst.xpk.py index 211d24c73..dccbae7e9 100755 --- a/wearable/tct-deprecatedapi-tizen-tests/inst.xpk.py +++ b/wearable/tct-deprecatedapi-tizen-tests/inst.xpk.py @@ -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: diff --git a/wearable/tct-deprecatedapi-tizen-tests/pack.py b/wearable/tct-deprecatedapi-tizen-tests/pack.py index e29187a0b..f1f0cb470 100755 --- a/wearable/tct-deprecatedapi-tizen-tests/pack.py +++ b/wearable/tct-deprecatedapi-tizen-tests/pack.py @@ -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: