Compare commits

...

2 Commits

Author SHA1 Message Date
Vadim Yanitskiy c69ba9bd3f Make 'pyshark' an optional dependency 2024-04-16 03:04:02 +07:00
Vadim Yanitskiy 5b18cded95 Add setup.py and pyproject.toml 2024-04-16 02:43:21 +07:00
5 changed files with 35 additions and 4 deletions

2
pyproject.toml Normal file
View File

@ -0,0 +1,2 @@
[build-system]
requires = ["setuptools"]

View File

@ -2,4 +2,3 @@ construct
pyserial
crcmod
cmd2
pyshark

View File

@ -46,7 +46,7 @@ class SEDbgMuxDumpApp:
'auto' : (dumpio_auto, 'Automatic dump format detection (by filename)'),
'native' : (DumpIONative, 'Native binary dump format for this package'),
'socat' : (DumpIOSocat, 'ASCII hexdump generated by socat (-x option)'),
'btpcap' : (DumpIOBtPcap, 'PCAP file with Bluetooth RFCOMM packets'),
'btpcap' : (DumpIOBtPcap, 'PCAP file with Bluetooth RFCOMM packets (requires pyshark)'),
}
def __init__(self, argv) -> None:

View File

@ -19,7 +19,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import logging
import pyshark
from . import DumpIO
from . import DumpIOError
@ -38,9 +37,14 @@ class DumpIOBtPcap(DumpIO):
self.timestamp = 0.0 # cached
self.readonly = readonly
try:
from pyshark import FileCapture
except ImportError as e:
raise DumpIOError('pyshark is not installed') from e
log.info('Opening Bluetooth RFCOMM capture %s', fname)
dfilter = 'btrfcomm.channel == %s' % kw.get('chan', '2')
self._pcap = pyshark.FileCapture(fname, display_filter=dfilter)
self._pcap = FileCapture(fname, display_filter=dfilter)
self._find_connect()
def read(self) -> dict:

26
setup.py Normal file
View File

@ -0,0 +1,26 @@
from setuptools import setup
setup(
name='sedbgmux',
version='1.0',
url='https://gitea.osmocom.org/fixeria/sedbgmux',
license='GPLv3',
author='Vadim Yanitskiy',
author_email='fixeria@osmocom.org',
description='DebugMux client for [Sony] Ericsson phones and modems',
packages=['sedbgmux', 'sedbgmux.io', 'sedbgmux.ch'],
install_requires=[
'construct',
'pyserial',
'crcmod',
'cmd2 >= 2.0.0',
],
extras_require={
# sedbgmux-dump.py optionally requires pyshark
'btpcap' : ['pyshark'],
},
scripts=[
'sedbgmux-shell.py',
'sedbgmux-dump.py',
]
)