コード例 #1
0
ファイル: minicap.py プロジェクト: liuct/AutomatorX
def install(serialno=None, host=None, port=None):
    logger.info("Minicap install started!")
    
    adb = functools.partial(run_adb, serialno=serialno, host=host, port=port)

    # Figure out which ABI and SDK
    logger.info("Make temp dir ...")
    tmpdir = tempfile.mkdtemp(prefix='ins-minicap-')
    logger.debug(tmpdir)
    try:
        logger.info("Retrive device information ...")
        abi = adb('shell', 'getprop', 'ro.product.cpu.abi').strip()
        sdk = adb('shell', 'getprop', 'ro.build.version.sdk').strip()

        logger.info("Downloading minicap.so ....")
        url = "https://github.com/openstf/stf/raw/master/vendor/minicap/shared/android-"+sdk+"/"+abi+"/minicap.so"
        target_path = os.path.join(tmpdir, 'minicap.so')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        
        logger.info("Downloading minicap ....")
        url = "https://github.com/openstf/stf/raw/master/vendor/minicap/bin/"+abi+"/minicap"
        target_path = os.path.join(tmpdir, 'minicap')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        adb('shell', 'chmod', '0755', '/data/local/tmp/minicap')

        logger.info("Checking [dump device info] ...")
        print adb('shell', 'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -i')
        logger.info("Minicap install finished !")
    except Exception, e:
        logger.error(e)
コード例 #2
0
def download(filename, tmpdir, version, base_url=IMAGE_BASE_URL):
    if sys.platform == 'darwin':
        version = __alias.get(version, version)
        abs_path = os.path.join(IMAGE_BASE_DIR, version, filename)
        if os.path.exists(abs_path):
            return abs_path
    target_path = os.path.join(tmpdir, filename)
    source_url = base_url + '/'.join([version, filename])
    logger.info("Download %s/%s", version, filename)
    return http_download(source_url, target_path)
コード例 #3
0
def download(filename, tmpdir, version, base_url=IMAGE_BASE_URL):
    if sys.platform == 'darwin':
        version = __alias.get(version, version)
        abs_path = os.path.join(IMAGE_BASE_DIR, version, filename)
        if os.path.exists(abs_path):
            return abs_path
    target_path = os.path.join(tmpdir, filename)
    source_url = base_url + '/'.join([version, filename])
    logger.info("Download %s/%s", version, filename)
    return http_download(source_url, target_path)
コード例 #4
0
ファイル: install.py プロジェクト: codeskyblue/AutomatorX
def main(path, serial=None, host=None, port=None, start=False):
    adb = adbkit.Client(host, port).device(
        serial)  # adbutils.Adb(serial, host, port)

    # use qiniu paths
    if __apks.get(path):
        path = __apks.get(path)

    if re.match(r'^https?://', path):
        tmpdir = tempfile.mkdtemp(prefix='atx-install-')
        log.info("Create temp directory: %s", tmpdir)

        # FIXME(ssx): will not called when Ctrl+C pressed in windows git-bash
        atexit.register(clean, tmpdir)

        urlpath = path
        target = os.path.join(tmpdir, '_tmp.apk')
        path = target
        log.info("Download from: %s", urlpath)
        utils.http_download(urlpath, target)

    import atx.apkparse as apkparse
    manifest = apkparse.parse_apkfile(path)
    log.info("APK package name: %s", manifest.package_name)
    log.info("APK main activity: %s", manifest.main_activity)

    log.info("Push file to android device")
    adb_pushfile(adb, path, DEFAULT_REMOTE_PATH)

    log.info("Install ..., will take a few seconds")
    adb_must_install(adb, DEFAULT_REMOTE_PATH, manifest.package_name)
    log.info("Remove _tmp.apk")
    adb_remove(adb, DEFAULT_REMOTE_PATH)

    if start:
        log.info("Start app '%s'" % manifest.package_name)
        adb.raw_cmd('shell', 'am', 'start', '-n',
                    manifest.package_name+'/'+manifest.main_activity).wait()
    log.info("Success")
コード例 #5
0
ファイル: install.py プロジェクト: zzzyw-work/ATX
def main(path, serial=None, host=None, port=None, start=False):
    adb = adbkit.Client(host, port).device(
        serial)  # adbutils.Adb(serial, host, port)

    # use qiniu paths
    if __apks.get(path):
        path = __apks.get(path)

    if re.match(r'^https?://', path):
        tmpdir = tempfile.mkdtemp(prefix='atx-install-')
        log.info("Create temp directory: %s", tmpdir)

        # FIXME(ssx): will not called when Ctrl+C pressed in windows git-bash
        atexit.register(clean, tmpdir)

        urlpath = path
        target = os.path.join(tmpdir, '_tmp.apk')
        path = target
        log.info("Download from: %s", urlpath)
        utils.http_download(urlpath, target)

    import atx.apkparse as apkparse
    manifest = apkparse.parse_apkfile(path)
    log.info("APK package name: %s", manifest.package_name)
    log.info("APK main activity: %s", manifest.main_activity)

    log.info("Push file to android device")
    adb_pushfile(adb, path, DEFAULT_REMOTE_PATH)

    log.info("Install ..., will take a few seconds")
    adb_must_install(adb, DEFAULT_REMOTE_PATH, manifest.package_name)
    log.info("Remove _tmp.apk")
    adb_remove(adb, DEFAULT_REMOTE_PATH)

    if start:
        log.info("Start app '%s'" % manifest.package_name)
        adb.raw_cmd('shell', 'am', 'start', '-n', manifest.package_name + '/' +
                    manifest.main_activity).wait()
    log.info("Success")
コード例 #6
0
def install(serialno=None, host=None, port=None):
    logger.info("Minicap install started!")

    adb = functools.partial(run_adb, serialno=serialno, host=host, port=port)

    # Figure out which ABI and SDK
    logger.info("Make temp dir ...")
    tmpdir = tempfile.mkdtemp(prefix='ins-minicap-')
    logger.debug(tmpdir)
    try:
        logger.info("Retrive device information ...")
        abi = adb('shell', 'getprop', 'ro.product.cpu.abi').strip()
        sdk = adb('shell', 'getprop', 'ro.build.version.sdk').strip()

        logger.info("Downloading minicap.so ....")
        url = "https://github.com/openstf/stf/raw/master/vendor/minicap/shared/android-" + sdk + "/" + abi + "/minicap.so"
        target_path = os.path.join(tmpdir, 'minicap.so')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')

        logger.info("Downloading minicap ....")
        url = "https://github.com/openstf/stf/raw/master/vendor/minicap/bin/" + abi + "/minicap"
        target_path = os.path.join(tmpdir, 'minicap')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        adb('shell', 'chmod', '0755', '/data/local/tmp/minicap')

        logger.info("Checking [dump device info] ...")
        print adb(
            'shell',
            'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -i')
        logger.info("Minicap install finished !")
    except Exception, e:
        logger.error(e)
コード例 #7
0
def main(serialno=None, host=None, port=None):
    logger.info("Minicap install started!")

    adb = functools.partial(run_adb, serialno=serialno, host=host, port=port)

    # Figure out which ABI and SDK
    logger.info("Make temp dir ...")
    tmpdir = tempfile.mkdtemp(prefix='ins-minicap-')
    logger.debug(tmpdir)
    try:
        logger.info("Retrive device information ...")
        abi = adb('shell', 'getprop', 'ro.product.cpu.abi').strip()
        sdk = adb('shell', 'getprop', 'ro.build.version.sdk').strip()

        minicap_base_url = "https://github.com/codeskyblue/stf-binaries/raw/master/node_modules/minicap-prebuilt/prebuilt/"
        logger.info("Downloading minicap.so ....")
        url = minicap_base_url + abi + "/lib/android-" + sdk + "/minicap.so"
        target_path = os.path.join(tmpdir, 'minicap.so')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')

        logger.info("Downloading minicap ....")
        url = minicap_base_url + abi + "/bin/minicap"
        target_path = os.path.join(tmpdir, 'minicap')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        adb('shell', 'chmod', '0755', '/data/local/tmp/minicap')

        logger.info("Checking [dump device info] ...")
        print adb(
            'shell',
            'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -i')
        logger.info("Minicap install finished !")

        logger.info("Downloading minitouch ....")
        url = "https://github.com/codeskyblue/stf-binaries/raw/master/node_modules/minitouch-prebuilt/prebuilt/" + abi + "/bin/minitouch"
        target_path = os.path.join(tmpdir, 'minitouch')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        adb('shell', 'chmod', '0755', '/data/local/tmp/minitouch')

        logger.info("Checking [dump device info] ...")
        print adb('shell', '/data/local/tmp/minitouch -h')
        logger.info("Minitouch install successfully ^_^")

    except Exception, e:
        logger.error('error: %s', e)
コード例 #8
0
ファイル: minicap.py プロジェクト: codeskyblue/AutomatorX
def main(serialno=None, host=None, port=None):
    logger.info("Minicap install started!")
    
    adb = functools.partial(run_adb, serialno=serialno, host=host, port=port)

    # Figure out which ABI and SDK
    logger.info("Make temp dir ...")
    tmpdir = tempfile.mkdtemp(prefix='ins-minicap-')
    logger.debug(tmpdir)
    try:
        logger.info("Retrive device information ...")
        abi = adb('shell', 'getprop', 'ro.product.cpu.abi').strip()
        sdk = adb('shell', 'getprop', 'ro.build.version.sdk').strip()

        minicap_base_url = "https://github.com/codeskyblue/stf-binaries/raw/master/node_modules/minicap-prebuilt/prebuilt/"
        logger.info("Downloading minicap.so ....")
        url = minicap_base_url+abi+"/lib/android-"+sdk+"/minicap.so"
        target_path = os.path.join(tmpdir, 'minicap.so')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        
        logger.info("Downloading minicap ....")
        url = minicap_base_url+abi+"/bin/minicap"
        target_path = os.path.join(tmpdir, 'minicap')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        adb('shell', 'chmod', '0755', '/data/local/tmp/minicap')

        logger.info("Checking [dump device info] ...")
        print adb('shell', 'LD_LIBRARY_PATH=/data/local/tmp /data/local/tmp/minicap -i')
        logger.info("Minicap install finished !")

        logger.info("Downloading minitouch ....")
        url = "https://github.com/codeskyblue/stf-binaries/raw/master/node_modules/minitouch-prebuilt/prebuilt/"+abi+"/bin/minitouch"
        target_path = os.path.join(tmpdir, 'minitouch')
        http_download(url, target_path)
        logger.info("Push data to device ....")
        adb('push', target_path, '/data/local/tmp')
        adb('shell', 'chmod', '0755', '/data/local/tmp/minitouch')

        logger.info("Checking [dump device info] ...")
        print adb('shell', '/data/local/tmp/minitouch -h')
        logger.info("Minitouch install successfully ^_^")

    except Exception, e:
        logger.error('error: %s', e)
コード例 #9
0
ファイル: iosdeveloper.py プロジェクト: tazjel/AutomatorX
def download(filename, tmpdir, version, base_url=IMAGE_BASE_URL):
    target_path = os.path.join(tmpdir, filename)
    source_url = base_url + "/".join([version, filename])
    logger.info("Download %s/%s", version, filename)
    return http_download(source_url, target_path)
コード例 #10
0
ファイル: iosdeveloper.py プロジェクト: liuct/AutomatorX
def download(filename, tmpdir, version, base_url=IMAGE_BASE_URL):
    target_path = os.path.join(tmpdir, filename)
    source_url = base_url + '/'.join([version, filename])
    logger.info("Download %s/%s", version, filename)
    return http_download(source_url, target_path)