# Import from <root>/scripts
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
-from build.common import *
+from ctsbuild.common import *
class Device:
def __init__(self, serial, product, model, device):
if len(line.strip()) == 0:
continue
- m = ptrn.match(line)
+ m = ptrn.match(line.decode('utf-8'))
if m == None:
print("WARNING: Failed to parse device info '%s'" % line)
continue
line = source.readline()
if len(line) == 0: # EOF
break;
- sink.write(prefix + line)
+ sink.write(prefix + line.decode('utf-8'))
process = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdoutJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stdout))
job.join()
if errorCode.error:
- raise errorCode.error[0], errorCode.error[1], errorCode.error[2]
+ raise errorCode.error[0](errorCode.error[1]).with_traceback(errorCode.error[2])
def uninstall (adbPath, packageName, extraArgs = [], printPrefix=""):
print(printPrefix + "Removing existing %s...\n" % packageName,)
print(printPrefix + "Installing %s...\n" % apkPath,)
execWithPrintPrefix([adbPath] + extraArgs + [
'install',
+ '-g',
apkPath
], printPrefix)
print(printPrefix + "Install complete\n",)
for i in range(0, len(devices)):
print("%3d: %16s %s" % ((i+1), devices[i].serial, devices[i].model))
- deviceNdx = int(raw_input("Choose device (1-%d): " % len(devices)))
+ deviceNdx = int(input("Choose device (1-%d): " % len(devices)))
installToDevice(devices[deviceNdx-1], args.adbPath, packageName, apkPath)
else:
devices = getDevices(args.adbPath)