Skip to content

Commit cbbb04d

Browse files
authored
Merge pull request doronz88#812 from doronz88/bugfix/cli-ignore-import-errors
cli: fix ignoring `ImportError`
2 parents 88ff187 + 2c8c1d2 commit cbbb04d

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

.github/workflows/python-app.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,29 @@ jobs:
4141
python -m pip install -U .
4242
- name: Test show usage
4343
run: |
44-
python -m pymobiledevice3
44+
python -m pymobiledevice3 --help
45+
python -m pymobiledevice3 activation --help
46+
python -m pymobiledevice3 afc --help
47+
python -m pymobiledevice3 amfi --help
48+
python -m pymobiledevice3 apps --help
49+
python -m pymobiledevice3 backup2 --help
50+
python -m pymobiledevice3 bonjour --help
51+
python -m pymobiledevice3 companion --help
52+
python -m pymobiledevice3 crash --help
53+
python -m pymobiledevice3 developer --help
54+
python -m pymobiledevice3 diagnostics --help
55+
python -m pymobiledevice3 lockdown --help
56+
python -m pymobiledevice3 mounter --help
57+
python -m pymobiledevice3 notification --help
58+
python -m pymobiledevice3 pcap --help
59+
python -m pymobiledevice3 power-assertion --help
60+
python -m pymobiledevice3 processes --help
61+
python -m pymobiledevice3 profile --help
62+
python -m pymobiledevice3 provision --help
63+
python -m pymobiledevice3 remote --help
64+
python -m pymobiledevice3 restore --help
65+
python -m pymobiledevice3 springboard --help
66+
python -m pymobiledevice3 syslog --help
67+
python -m pymobiledevice3 usbmux --help
68+
python -m pymobiledevice3 webinspector --help
69+
python -m pymobiledevice3 version --help

pymobiledevice3/__main__.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@
6464
'remote': 'remote',
6565
'restore': 'restore',
6666
'springboard': 'springboard',
67-
'status': 'status',
6867
'syslog': 'syslog',
6968
'usbmux': 'usbmux',
7069
'webinspector': 'webinspector',
@@ -79,10 +78,7 @@ def list_commands(self, ctx):
7978
def get_command(self, ctx, name):
8079
if name not in CLI_GROUPS.keys():
8180
ctx.fail(f'No such command {name!r}.')
82-
try:
83-
mod = __import__(f'pymobiledevice3.cli.{CLI_GROUPS[name]}', None, None, ['cli'])
84-
except ImportError:
85-
return
81+
mod = __import__(f'pymobiledevice3.cli.{CLI_GROUPS[name]}', None, None, ['cli'])
8682
command = mod.cli.get_command(ctx, name)
8783
# Some cli groups have different names than the index
8884
if not command:

pymobiledevice3/remote/core_device_tunnel_service.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
from asyncio import CancelledError, StreamReader, StreamWriter
1515
from collections import namedtuple
1616
from contextlib import asynccontextmanager, suppress
17-
from os import chown, getenv
17+
18+
if sys.platform != 'win32':
19+
from os import chown
20+
21+
from os import getenv
1822
from pathlib import Path
1923
from socket import AF_INET6, create_connection
2024
from ssl import VerifyMode
@@ -33,7 +37,11 @@
3337
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
3438
from cryptography.hazmat.primitives.kdf.hkdf import HKDF
3539
from opack import dumps
36-
from pytun_pmd3 import TunTapDevice
40+
41+
if sys.platform != 'win32':
42+
from pytun_pmd3 import TunTapDevice
43+
else:
44+
TunTapDevice = None
3745
from qh3.asyncio import QuicConnectionProtocol
3846
from qh3.asyncio.client import connect as aioquic_connect
3947
from qh3.asyncio.protocol import QuicStreamHandler

0 commit comments

Comments
 (0)