adbOptions.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Zeuz_Python_Node 作者: AutomationSolutionz 项目源码 文件源码
def get_package_version(package, serial=''):
    sModuleInfo = inspect.stack()[0][3] + " : " + inspect.getmoduleinfo(__file__).name
    try:
        if serial != '': serial = '-s %s' % serial  # Prepare serial number with command line switch
        output = subprocess.check_output("adb %s shell pm dump %s" % (serial, package), shell=True)
        storageList = output.splitlines() # 
        for lines in storageList:
            if 'versionName' in lines: # Find first instance of this, should be the version we need
                line1 = lines
        output1 = line1.split('=')[1] # Version is on right side of equals sign
        CommonUtil.ExecLog(sModuleInfo, "Read %s has version %s" % (package, output1), 0)
        return output1.strip()

    except Exception:
        errMsg = "Unable to get package version"
        return CommonUtil.Exception_Handler(sys.exc_info(), None, errMsg)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号