Skip to content

Commit c8aca8b

Browse files
committed
Add serial library for python
1 parent a32a619 commit c8aca8b

37 files changed

Lines changed: 8648 additions & 0 deletions
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython
2+
3+
Stable:
4+
5+
- Documentation: http://pythonhosted.org/pyserial/
6+
- Download Page: https://pypi.python.org/pypi/pyserial
7+
8+
Latest:
9+
10+
- Documentation: http://pyserial.readthedocs.io/en/latest/
11+
- Project Homepage: https://github.com/pyserial/pyserial
12+
13+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pip
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
Metadata-Version: 2.0
2+
Name: pyserial
3+
Version: 3.5
4+
Summary: Python Serial Port Extension
5+
Home-page: https://github.com/pyserial/pyserial
6+
Author: Chris Liechti
7+
Author-email: cliechti@gmx.net
8+
License: BSD
9+
Platform: any
10+
Classifier: Development Status :: 5 - Production/Stable
11+
Classifier: Intended Audience :: Developers
12+
Classifier: Intended Audience :: End Users/Desktop
13+
Classifier: License :: OSI Approved :: BSD License
14+
Classifier: Natural Language :: English
15+
Classifier: Operating System :: POSIX
16+
Classifier: Operating System :: Microsoft :: Windows
17+
Classifier: Operating System :: MacOS :: MacOS X
18+
Classifier: Programming Language :: Python
19+
Classifier: Programming Language :: Python :: 2
20+
Classifier: Programming Language :: Python :: 2.7
21+
Classifier: Programming Language :: Python :: 3
22+
Classifier: Programming Language :: Python :: 3.4
23+
Classifier: Programming Language :: Python :: 3.5
24+
Classifier: Programming Language :: Python :: 3.6
25+
Classifier: Programming Language :: Python :: 3.7
26+
Classifier: Programming Language :: Python :: 3.8
27+
Classifier: Topic :: Communications
28+
Classifier: Topic :: Software Development :: Libraries
29+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
30+
Classifier: Topic :: Terminals :: Serial
31+
Provides-Extra: cp2110
32+
Provides-Extra: cp2110
33+
Requires-Dist: hidapi; extra == 'cp2110'
34+
35+
Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython
36+
37+
Stable:
38+
39+
- Documentation: http://pythonhosted.org/pyserial/
40+
- Download Page: https://pypi.python.org/pypi/pyserial
41+
42+
Latest:
43+
44+
- Documentation: http://pyserial.readthedocs.io/en/latest/
45+
- Project Homepage: https://github.com/pyserial/pyserial
46+
47+
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
../../../bin/pyserial-miniterm,sha256=0UwHgwt3huaLMpczvRjybFD19c6P04I__JBYtnlDaWM,232
2+
../../../bin/pyserial-ports,sha256=5jP7WO3jIqP-znzukKa7xWQay14rZiUX0wm6tisQ-7M,234
3+
pyserial-3.5.dist-info/DESCRIPTION.rst,sha256=rXXIUFeAsfXq2YS7DGkztGmXez-G7gAwbwdBL8t9KME,320
4+
pyserial-3.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
5+
pyserial-3.5.dist-info/METADATA,sha256=QqirfpTvC3uqfpTNrGXWuSVMYIR29jASDJkAB79HKUM,1650
6+
pyserial-3.5.dist-info/RECORD,,
7+
pyserial-3.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8+
pyserial-3.5.dist-info/WHEEL,sha256=kdsN-5OJAZIiHN-iO4Rhl82KyS0bDWf4uBwMbkNafr8,110
9+
pyserial-3.5.dist-info/entry_points.txt,sha256=-AQ3oVmIn7rtW5Dh0Oup90Hq0qkIlMj79qGmdDIXk9U,112
10+
pyserial-3.5.dist-info/metadata.json,sha256=s5rFXxQKL9QXO3UMXRmYoMXGRQt2lol67rf_64S1v10,1647
11+
pyserial-3.5.dist-info/top_level.txt,sha256=FSjfWHWw-VjPiEqOhttbiP-F8OHn-liixq1wKL2fWOA,7
12+
serial/__init__.py,sha256=XeyJf970Wg6vY-rNoeAdYuHnVJAwJYSuAjj3U3ZZI0Q,3212
13+
serial/__main__.py,sha256=oSpVknDS2Yqn2JdXlDs5Fk0E8ccdiLIJaXvPWUizQj0,45
14+
serial/__pycache__/__init__.cpython-310.pyc,,
15+
serial/__pycache__/__main__.cpython-310.pyc,,
16+
serial/__pycache__/rfc2217.cpython-310.pyc,,
17+
serial/__pycache__/rs485.cpython-310.pyc,,
18+
serial/__pycache__/serialcli.cpython-310.pyc,,
19+
serial/__pycache__/serialjava.cpython-310.pyc,,
20+
serial/__pycache__/serialposix.cpython-310.pyc,,
21+
serial/__pycache__/serialutil.cpython-310.pyc,,
22+
serial/__pycache__/serialwin32.cpython-310.pyc,,
23+
serial/__pycache__/win32.cpython-310.pyc,,
24+
serial/rfc2217.py,sha256=ncG_5Ts42M_Tm_7XN3Q7iE24y-lGcwu2jC3MFSEv6Bc,59700
25+
serial/rs485.py,sha256=9t6yuGcte36gk8G1U6NgboKVGtJUFqtbpAOXj7vYxM0,3305
26+
serial/serialcli.py,sha256=u5QnG90UxttqsGG9nYgkj0GUyb0wIOxzlUgxJ4gCczg,9190
27+
serial/serialjava.py,sha256=AcHLp2D_sAihu7L_wCcg8mtk7etf6zAyB4L_tuthVo8,8480
28+
serial/serialposix.py,sha256=XVb5hRM5HhdmoYR6BOLhICztQXKhUoA7ocgjoUmptvk,35127
29+
serial/serialutil.py,sha256=PIT4x8MZ8WGoXW-Ntb7cT2UlVxRYm9y-7m8tr2WhfAo,21797
30+
serial/serialwin32.py,sha256=F2geqaZQEgxx2xqum4iBMBpA04xHs0uw2gUOP1v7vgA,20284
31+
serial/threaded/__init__.py,sha256=ikXlKYejRlzzCze9kwxR_uABKa1YfuTyqcPjw3VRV1I,9319
32+
serial/threaded/__pycache__/__init__.cpython-310.pyc,,
33+
serial/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
34+
serial/tools/__pycache__/__init__.cpython-310.pyc,,
35+
serial/tools/__pycache__/hexlify_codec.cpython-310.pyc,,
36+
serial/tools/__pycache__/list_ports.cpython-310.pyc,,
37+
serial/tools/__pycache__/list_ports_common.cpython-310.pyc,,
38+
serial/tools/__pycache__/list_ports_linux.cpython-310.pyc,,
39+
serial/tools/__pycache__/list_ports_osx.cpython-310.pyc,,
40+
serial/tools/__pycache__/list_ports_posix.cpython-310.pyc,,
41+
serial/tools/__pycache__/list_ports_windows.cpython-310.pyc,,
42+
serial/tools/__pycache__/miniterm.cpython-310.pyc,,
43+
serial/tools/hexlify_codec.py,sha256=FRJSO8pfjM6AR9_SBqL34e50LVkvlzfFKdmCScGn408,3677
44+
serial/tools/list_ports.py,sha256=eDDoyIhoS3f9D3CVpthqlQUqiR2l-X0VTGGOBjuM4ew,3389
45+
serial/tools/list_ports_common.py,sha256=x5HIghG4NIz-Xf5iX6Gk7xZfdeads2tqCsfyJhh3Ifs,3736
46+
serial/tools/list_ports_linux.py,sha256=UnU1VYP1NJI7J8Zn7gY-A2mbi1lugbFZSVztfX8P1pU,4503
47+
serial/tools/list_ports_osx.py,sha256=eoefMGiuJqC-OCu9aAWqqJX75wGlBzoqZ6kdmMA82LM,11178
48+
serial/tools/list_ports_posix.py,sha256=EYqD5kRbk0f2a5scaRS4tgWGBynkpVH77ja_G6S3UhE,4535
49+
serial/tools/list_ports_windows.py,sha256=U4EzcOAiU66LWoPdMXI2oOM4LCd5vKwO3DgeTT6M3qc,16021
50+
serial/tools/miniterm.py,sha256=fXvkEU9FEyU7HPSNE8bdX2OCgiGYgCee066yF58nots,37840
51+
serial/urlhandler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
52+
serial/urlhandler/__pycache__/__init__.cpython-310.pyc,,
53+
serial/urlhandler/__pycache__/protocol_alt.cpython-310.pyc,,
54+
serial/urlhandler/__pycache__/protocol_cp2110.cpython-310.pyc,,
55+
serial/urlhandler/__pycache__/protocol_hwgrep.cpython-310.pyc,,
56+
serial/urlhandler/__pycache__/protocol_loop.cpython-310.pyc,,
57+
serial/urlhandler/__pycache__/protocol_rfc2217.cpython-310.pyc,,
58+
serial/urlhandler/__pycache__/protocol_socket.cpython-310.pyc,,
59+
serial/urlhandler/__pycache__/protocol_spy.cpython-310.pyc,,
60+
serial/urlhandler/protocol_alt.py,sha256=-kYoCgy9GyMWN6wC8Oew8FL04LjL4Ntx3HHVqSTKGcQ,2033
61+
serial/urlhandler/protocol_cp2110.py,sha256=iULOT4Vdw20P_w2jfSWdt0roUY1Ku8xJVHHYc6d3ImY,8540
62+
serial/urlhandler/protocol_hwgrep.py,sha256=GdKdQ9tExKRHJzsiPcQ9ExmaLa6-A71q52i4jQxmoBk,3159
63+
serial/urlhandler/protocol_loop.py,sha256=5barru_hfwNkayjjBz4w3snBJn0G7C-fG7-QmHaeTWo,10623
64+
serial/urlhandler/protocol_rfc2217.py,sha256=IPO8r3pFN6yEDl1Zv2jgUnfIa0tQ0iY0ZsD8_xhAUeQ,317
65+
serial/urlhandler/protocol_socket.py,sha256=QotaHCPd6t903W_9fa2Lv_5uElq0noir2Ci10a987XM,14299
66+
serial/urlhandler/protocol_spy.py,sha256=FdUaU43-bl1KXTy_S4HhzyGV5hpUsopm8IqTrX2VX-4,9130
67+
serial/win32.py,sha256=lk6rod9mHkqzgchmaqB3ygiTkmAWTNQ00IJ985ZjvTI,11138

source/pyui/lib/python3.10/site-packages/pyserial-3.5.dist-info/REQUESTED

Whitespace-only changes.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Wheel-Version: 1.0
2+
Generator: bdist_wheel (0.30.0)
3+
Root-Is-Purelib: true
4+
Tag: py2-none-any
5+
Tag: py3-none-any
6+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[console_scripts]
2+
pyserial-miniterm = serial.tools.miniterm:main
3+
pyserial-ports = serial.tools.list_ports:main
4+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "Intended Audience :: End Users/Desktop", "License :: OSI Approved :: BSD License", "Natural Language :: English", "Operating System :: POSIX", "Operating System :: Microsoft :: Windows", "Operating System :: MacOS :: MacOS X", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Topic :: Communications", "Topic :: Software Development :: Libraries", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Terminals :: Serial"], "extensions": {"python.commands": {"wrap_console": {"pyserial-miniterm": "serial.tools.miniterm:main", "pyserial-ports": "serial.tools.list_ports:main"}}, "python.details": {"contacts": [{"email": "cliechti@gmx.net", "name": "Chris Liechti", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst"}, "project_urls": {"Home": "https://github.com/pyserial/pyserial"}}, "python.exports": {"console_scripts": {"pyserial-miniterm": "serial.tools.miniterm:main", "pyserial-ports": "serial.tools.list_ports:main"}}}, "extras": ["cp2110"], "generator": "bdist_wheel (0.30.0)", "license": "BSD", "metadata_version": "2.0", "name": "pyserial", "platform": "any", "run_requires": [{"extra": "cp2110", "requires": ["hidapi"]}], "summary": "Python Serial Port Extension", "version": "3.5"}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
serial
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env python
2+
#
3+
# This is a wrapper module for different platform implementations
4+
#
5+
# This file is part of pySerial. https://github.com/pyserial/pyserial
6+
# (C) 2001-2020 Chris Liechti <cliechti@gmx.net>
7+
#
8+
# SPDX-License-Identifier: BSD-3-Clause
9+
10+
from __future__ import absolute_import
11+
12+
import sys
13+
import importlib
14+
15+
from serial.serialutil import *
16+
#~ SerialBase, SerialException, to_bytes, iterbytes
17+
18+
__version__ = '3.5'
19+
20+
VERSION = __version__
21+
22+
# pylint: disable=wrong-import-position
23+
if sys.platform == 'cli':
24+
from serial.serialcli import Serial
25+
else:
26+
import os
27+
# chose an implementation, depending on os
28+
if os.name == 'nt': # sys.platform == 'win32':
29+
from serial.serialwin32 import Serial
30+
elif os.name == 'posix':
31+
from serial.serialposix import Serial, PosixPollSerial, VTIMESerial # noqa
32+
elif os.name == 'java':
33+
from serial.serialjava import Serial
34+
else:
35+
raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))
36+
37+
38+
protocol_handler_packages = [
39+
'serial.urlhandler',
40+
]
41+
42+
43+
def serial_for_url(url, *args, **kwargs):
44+
"""\
45+
Get an instance of the Serial class, depending on port/url. The port is not
46+
opened when the keyword parameter 'do_not_open' is true, by default it
47+
is. All other parameters are directly passed to the __init__ method when
48+
the port is instantiated.
49+
50+
The list of package names that is searched for protocol handlers is kept in
51+
``protocol_handler_packages``.
52+
53+
e.g. we want to support a URL ``foobar://``. A module
54+
``my_handlers.protocol_foobar`` is provided by the user. Then
55+
``protocol_handler_packages.append("my_handlers")`` would extend the search
56+
path so that ``serial_for_url("foobar://"))`` would work.
57+
"""
58+
# check and remove extra parameter to not confuse the Serial class
59+
do_open = not kwargs.pop('do_not_open', False)
60+
# the default is to use the native implementation
61+
klass = Serial
62+
try:
63+
url_lowercase = url.lower()
64+
except AttributeError:
65+
# it's not a string, use default
66+
pass
67+
else:
68+
# if it is an URL, try to import the handler module from the list of possible packages
69+
if '://' in url_lowercase:
70+
protocol = url_lowercase.split('://', 1)[0]
71+
module_name = '.protocol_{}'.format(protocol)
72+
for package_name in protocol_handler_packages:
73+
try:
74+
importlib.import_module(package_name)
75+
handler_module = importlib.import_module(module_name, package_name)
76+
except ImportError:
77+
continue
78+
else:
79+
if hasattr(handler_module, 'serial_class_for_url'):
80+
url, klass = handler_module.serial_class_for_url(url)
81+
else:
82+
klass = handler_module.Serial
83+
break
84+
else:
85+
raise ValueError('invalid URL, protocol {!r} not known'.format(protocol))
86+
# instantiate and open when desired
87+
instance = klass(None, *args, **kwargs)
88+
instance.port = url
89+
if do_open:
90+
instance.open()
91+
return instance

0 commit comments

Comments
 (0)