Skip to content

Commit

Permalink
fix python 3.6 support. fix #22
Browse files Browse the repository at this point in the history
  • Loading branch information
codeskyblue committed Mar 8, 2021
1 parent feb83e0 commit c500ca2
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
10 changes: 9 additions & 1 deletion DEVELOP.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ Clone code to local
git clone --depth 5 https://github.com/alibaba/tidevice
```

## Certificate
[各种安全证书间的关系及相关操作](https://www.jianshu.com/p/96df7de54375)


## Pair
1. Retrieve **Device Public Key** from device
2. Generate **Host Key**

## View DeveloperDiskImage Content
For example

Expand Down Expand Up @@ -36,4 +44,4 @@ Ref: https://packaging.python.org/guides/publishing-package-distribution-release
- <https://github.com/troybowman/dtxmsg>
- <https://github.com/troybowman/ios_instruments_client>
- Binary of libimobiledevice for Windows <http://docs.quamotion.mobi/docs/imobiledevice/>
- https://pypi.org/project/hexdump/
- https://pypi.org/project/hexdump/
6 changes: 6 additions & 0 deletions examples/get_bundle_id_from_ipa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# coding: utf-8

from tidevice._ipautil import IPAReader

ir = IPAReader("./testExample.ipa")
print(ir.get_bundle_id())
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import sys
import setuptools

if sys.version_info[:2] <= (3, 6):
sys.exit("\n*** tidevice requires Python version 3.7+")
#if sys.version_info[:2] <= (3, 6):
# sys.exit("\n*** tidevice requires Python version 3.7+")

setuptools.setup(
setup_requires=['pbr'], pbr=True, python_requires=">=3.7")
setup_requires=['pbr'], pbr=True, python_requires=">=3.6")
9 changes: 9 additions & 0 deletions tidevice/_ipautil.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#

import re
import sys
import tempfile
import shutil
import typing
import zipfile
from typing import Union
Expand Down Expand Up @@ -50,6 +53,12 @@ def get_mobileprovision(self) -> dict:
def get_infoplist(self) -> dict:
finfo = self.get_infoplist_zipinfo()
with self.open(finfo, 'r') as fp:
if sys.version_info[:2] <= (3, 6):
# for compatiable with py3.6
with tempfile.TemporaryFile() as tmpf:
shutil.copyfileobj(fp, tmpf)
tmpf.seek(0)
return bplist.load(tmpf)
return bplist.load(fp)

def get_bundle_id(self) -> str:
Expand Down

0 comments on commit c500ca2

Please sign in to comment.