Ejemplo n.º 1
0
def installToAllDevices (doParallel):
	devices = common.getDevices(common.ADB_BIN)
	installToDevices(devices, doParallel)
Ejemplo n.º 2
0
	devices = common.getDevices(common.ADB_BIN)
	installToDevices(devices, doParallel)

if __name__ == "__main__":
	parser = argparse.ArgumentParser()
	parser.add_argument('-p', '--parallel', dest='doParallel', action="store_true", help="Install package in parallel.")
	parser.add_argument('-s', '--serial', dest='serial', type=str, nargs='+', help="Install package to device with serial number.")
	parser.add_argument('-a', '--all', dest='all', action="store_true", help="Install to all devices.")

	args = parser.parse_args()

	if args.all:
		installToAllDevices(args.doParallel)
	else:
		if args.serial == None:
			devices = common.getDevices(common.ADB_BIN)
			if len(devices) == 0:
				common.die('No devices connected')
			elif len(devices) == 1:
				installToDevice(devices[0])
			else:
				print "More than one device connected:"
				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)))
				installToDevice(devices[deviceNdx-1])
		else:
			devices = common.getDevices(common.ADB_BIN)

			devices = [dev for dev in devices if dev.serial in args.serial]
Ejemplo n.º 3
0
		os.chdir(curDir)

def installToDevice (device):
	print "Installing to %s (%s)..." % (device.serial, device.model)
	install(['-s', device.serial])

def installToAllDevices ():
	devices = common.getDevices(common.ADB_BIN)
	for device in devices:
		installToDevice(device)

if __name__ == "__main__":
	if len(sys.argv) > 1:
		if sys.argv[1] == '-a':
			installToAllDevices()
		else:
			install(sys.argv[1:])
	else:
		devices = common.getDevices(common.ADB_BIN)
		if len(devices) == 0:
			common.die('No devices connected')
		elif len(devices) == 1:
			installToDevice(devices[0])
		else:
			print "More than one device connected:"
			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)))
			installToDevice(devices[deviceNdx-1])
Ejemplo n.º 4
0
def installToAllDevices ():
	devices = common.getDevices(common.ADB_BIN)
	for device in devices:
		installToDevice(device)
Ejemplo n.º 5
0
def installToAllDevices(doParallel):
    devices = common.getDevices(common.ADB_BIN)
    installToDevices(devices, doParallel)