apk_regex = None
-def apknameinfo(basename):
+def apknameinfo(filename):
global apk_regex
+ filename = os.path.basename(filename)
if apk_regex is None:
apk_regex = re.compile(r"^([a-zA-Z\.]+)_([0-9]+)\.apk$")
- m = apk_regex.match(basename)
+ m = apk_regex.match(filename)
try:
result = (m.group(1), m.group(2))
except AttributeError:
- raise Exception("Invalid apk name: %s" % basename)
+ raise Exception("Invalid apk name: %s" % filename)
return result
def getapkname(app, build):
sys.stderr.write(line)
sys.stderr.flush()
result.stderr += line
- time.sleep(0.2)
+ time.sleep(0.1)
p.communicate()
result.returncode = p.returncode
# Get the signed apk with the highest vercode
for apkfile in sorted(glob.glob(os.path.join(output_dir, '*.apk'))):
- apkfilename = os.path.basename(apkfile)
- appid, vercode = common.apknameinfo(apkfilename)
+ appid, vercode = common.apknameinfo(apkfile)
if appid not in apks:
continue
if vercodes[appid] and vc not in vercodes[appid]:
for apkfile in sorted(glob.glob(os.path.join(output_dir, '*.apk'))):
- apkfilename = os.path.basename(apkfile)
- appid, vercode = common.apknameinfo(apkfilename)
+ appid, vercode = common.apknameinfo(apkfile)
apks[appid] = apkfile
else:
if line.startswith("Failure"):
fail = line[9:-1]
if fail:
- raise Exception("Failed to install %s on %s: %s" % (
- apk, dev, fail))
+ if fail == "INSTALL_FAILED_ALREADY_EXISTS":
+ print "%s is already installed on %s." % (apk, dev)
+ else:
+ raise Exception("Failed to install %s on %s: %s" % (
+ apk, dev, fail))
print "\nFinished"