import threading
import time
class base_thread(threading.Thread):
def __init__(self, func):
threading.Thread.__init__(self)
self.func = func
#print(type(self.func))
def run(self):
self.func
# -*- coding: utf-8 -*-
import os
import time
import sys
import glob
from Base.Threads import base_thread
#單文件安裝
def install(filename):
print(filename)
os.popen("adb install %s" % filename)
#批量安裝app,多線程安裝
def bact_install(dir):
if os.path.isdir(dir):
starttime = time.time()
filelist= glob.glob(dir + "*.apk")
threads = []
for i in range(0, len(filelist)):
threads.append(base_thread(install(filelist[i])))
for j in range(0, len(filelist)):
threads[j].start()
for k in range(0, len(filelist)):
threads[k].join()
print("總運行時間"+str(time.time() - starttime))
else:
print("目錄不存在")
sys.exit(0)
#卸載app
def uninstall(packageName):
os.popen("adb wait-for-device")
print("start uninstall...")
os.popen("adb uninstall %s" % packageName)
最后編輯于 :
?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。