Skip to content

Commit

Permalink
change bundle pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Nov 25, 2021
1 parent 790bcfb commit bc04b92
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 10 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,8 @@ perf.stop()
## DEVELOP
See [DEVELOP](DEVELOP.md)

Python code style(ZH): https://zh-google-styleguide.readthedocs.io/en/latest/google-python-styleguide/python_style_rules/#comments

## Alternatives
- Go implemented: https://github.com/electricbubble/gidevice

Expand Down
15 changes: 15 additions & 0 deletions scripts/simple-capture.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
#

if test $(whoami) != "root"
then
sudo "$0"
exit
fi

mv /var/run/usbmuxd /var/run/usbmuxd-orig
trap "mv /var/run/usbmuxd-orig /var/run/usbmuxd" EXIT

socat -t100 -x -v UNIX-LISTEN:/var/run/usbmuxd,mode=777,reuseaddr,fork UNIX-CONNECT:/var/run/usbmuxd-orig


5 changes: 3 additions & 2 deletions tests/test_ipautil.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
"""Created on Mon Jan 25 2021 10:38:39 by codeskyblue
"""

import pytest
from tidevice._ipautil import IPAReader, IPAError



@pytest.mark.skip("ipa file removed from git")
def test_get_infoplist(wda_filepath: str):
ir = IPAReader(wda_filepath)
assert ir.get_bundle_id() == "com.facebook.WebDriverAgentRunner.xctrunner"

data = ir.get_mobileprovision()
assert "Version" in data
assert data['Version'] == 1
assert data['Version'] == 1
15 changes: 8 additions & 7 deletions tidevice/_device.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,17 @@
import io
import logging
import os
import pprint
import pathlib
import re
import shutil
import ssl
import subprocess
import sys
import tempfile
import threading
import time
import typing
import uuid
import zipfile
from collections import namedtuple
from typing import Iterator, Optional, Tuple, Union

import requests
Expand All @@ -46,14 +44,17 @@
logger = logging.getLogger(LOG.main)


def pil_imread(data: Union[str, bytes, bytearray]) -> Image.Image:
""" Convert data to PIL.Image.Image """
def pil_imread(data: Union[str, pathlib.Path, bytes, bytearray]) -> Image.Image:
""" Convert data(path, binary) to PIL.Image.Image
Raises:
TypeError
"""
if isinstance(data, (bytes, bytearray)):
memory_fd = io.BytesIO(data)
im = Image.open(memory_fd)
im.load()
del (memory_fd)
del (data)
return im
elif isinstance(data, str):
return Image.open(data)
Expand Down Expand Up @@ -943,7 +944,7 @@ def _fnmatch_find_bundle_id(self, bundle_id: str) -> str:
key=lambda v: v != 'com.facebook.wda.irmarunner.xctrunner')
return bundle_ids[0]

def xctest(self, fuzzy_bundle_id="com.facebook.*.xctrunner", target_bundle_id=None, logger=None, env: dict={}):
def xctest(self, fuzzy_bundle_id="com.*.xctrunner", target_bundle_id=None, logger=None, env: dict={}):
"""
Launch xctrunner and wait until quit
Expand Down
2 changes: 1 addition & 1 deletion tidevice/_wdaproxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
class WDAService:
_DEFAULT_TIMEOUT = 30 # http request timeout

def __init__(self, d: Device, bundle_id: str = "com.facebook.*.xctrunner", env: dict={}, check_interval: float = 60):
def __init__(self, d: Device, bundle_id: str = "com.*.xctrunner", env: dict={}, check_interval: float = 60):
self._d = d
self._bundle_id = bundle_id
self._service = ThreadService(self._keep_wda_running)
Expand Down

0 comments on commit bc04b92

Please sign in to comment.