Skip to content

Commit

Permalink
Merge pull request #455 from justinlampley/IncludePyserialBundledWind…
Browse files Browse the repository at this point in the history
…owsPython

Include pyserial module in the bundled python for Windows
  • Loading branch information
jurgelenas authored Dec 18, 2022
2 parents 6767fbf + ac2b8d5 commit bc8e149
Show file tree
Hide file tree
Showing 46 changed files with 8,656 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dependencies/windows_amd64/portablepy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ cp "$($destination)python.exe" "$($destination)$($pythonMajorVersion).exe"
Invoke-WebRequest -OutFile "$($destination)get-pip.py" "https://bootstrap.pypa.io/get-pip.py"
& "$($destination)python.exe" "$($destination)get-pip.py"

"Installing pyserial"
& "$($destination)python.exe" -m pip install pyserial


"Cleaning up"
Remove-Item -Path "$($package)" -Confirm:$false -Force
Remove-Item -Path "$($destination)get-pip.py" -Confirm:$false -Force
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
../../Scripts/pip.exe,sha256=RwSP0Qw1WzYrRyiFj33pkAR-zWD9qWeImVsMgK-aSA8,108451
../../Scripts/pip3.10.exe,sha256=RwSP0Qw1WzYrRyiFj33pkAR-zWD9qWeImVsMgK-aSA8,108451
../../Scripts/pip3.exe,sha256=RwSP0Qw1WzYrRyiFj33pkAR-zWD9qWeImVsMgK-aSA8,108451
../../Scripts/pip.exe,sha256=NGJ2cMtvSTPEJr45svh2fuHqXkvm-coBUSdJgVRKuZU,108451
../../Scripts/pip3.10.exe,sha256=NGJ2cMtvSTPEJr45svh2fuHqXkvm-coBUSdJgVRKuZU,108451
../../Scripts/pip3.exe,sha256=NGJ2cMtvSTPEJr45svh2fuHqXkvm-coBUSdJgVRKuZU,108451
pip-22.3.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pip-22.3.1.dist-info/LICENSE.txt,sha256=Y0MApmnUmurmWxLGxIySTFGkzfPR_whtw0VtyLyqIQQ,1093
pip-22.3.1.dist-info/METADATA,sha256=a9COYc5qzklDgbGlrKYkypMXon4A6IDgpeUTWLr7zzY,4072
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython

Stable:

- Documentation: http://pythonhosted.org/pyserial/
- Download Page: https://pypi.python.org/pypi/pyserial

Latest:

- Documentation: http://pyserial.readthedocs.io/en/latest/
- Project Homepage: https://github.com/pyserial/pyserial


Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
Metadata-Version: 2.0
Name: pyserial
Version: 3.5
Summary: Python Serial Port Extension
Home-page: https://github.com/pyserial/pyserial
Author: Chris Liechti
Author-email: [email protected]
License: BSD
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: BSD License
Classifier: Natural Language :: English
Classifier: Operating System :: POSIX
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Communications
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Terminals :: Serial
Provides-Extra: cp2110
Provides-Extra: cp2110
Requires-Dist: hidapi; extra == 'cp2110'

Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython

Stable:

- Documentation: http://pythonhosted.org/pyserial/
- Download Page: https://pypi.python.org/pypi/pyserial

Latest:

- Documentation: http://pyserial.readthedocs.io/en/latest/
- Project Homepage: https://github.com/pyserial/pyserial


Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
../../Scripts/pyserial-miniterm.exe,sha256=AkD7vCt4y6zfo8amSiWU_PKRuD6CFmdxslX51wbeSII,108450
../../Scripts/pyserial-ports.exe,sha256=DiIEEmXbmAbeh-Qj3I3uO7ZQ3Y_AiKRVdnNiKW2BQZw,108452
pyserial-3.5.dist-info/DESCRIPTION.rst,sha256=rXXIUFeAsfXq2YS7DGkztGmXez-G7gAwbwdBL8t9KME,320
pyserial-3.5.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
pyserial-3.5.dist-info/METADATA,sha256=QqirfpTvC3uqfpTNrGXWuSVMYIR29jASDJkAB79HKUM,1650
pyserial-3.5.dist-info/RECORD,,
pyserial-3.5.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
pyserial-3.5.dist-info/WHEEL,sha256=kdsN-5OJAZIiHN-iO4Rhl82KyS0bDWf4uBwMbkNafr8,110
pyserial-3.5.dist-info/entry_points.txt,sha256=-AQ3oVmIn7rtW5Dh0Oup90Hq0qkIlMj79qGmdDIXk9U,112
pyserial-3.5.dist-info/metadata.json,sha256=s5rFXxQKL9QXO3UMXRmYoMXGRQt2lol67rf_64S1v10,1647
pyserial-3.5.dist-info/top_level.txt,sha256=FSjfWHWw-VjPiEqOhttbiP-F8OHn-liixq1wKL2fWOA,7
serial/__init__.py,sha256=XeyJf970Wg6vY-rNoeAdYuHnVJAwJYSuAjj3U3ZZI0Q,3212
serial/__main__.py,sha256=oSpVknDS2Yqn2JdXlDs5Fk0E8ccdiLIJaXvPWUizQj0,45
serial/__pycache__/__init__.cpython-310.pyc,,
serial/__pycache__/__main__.cpython-310.pyc,,
serial/__pycache__/rfc2217.cpython-310.pyc,,
serial/__pycache__/rs485.cpython-310.pyc,,
serial/__pycache__/serialcli.cpython-310.pyc,,
serial/__pycache__/serialjava.cpython-310.pyc,,
serial/__pycache__/serialposix.cpython-310.pyc,,
serial/__pycache__/serialutil.cpython-310.pyc,,
serial/__pycache__/serialwin32.cpython-310.pyc,,
serial/__pycache__/win32.cpython-310.pyc,,
serial/rfc2217.py,sha256=ncG_5Ts42M_Tm_7XN3Q7iE24y-lGcwu2jC3MFSEv6Bc,59700
serial/rs485.py,sha256=9t6yuGcte36gk8G1U6NgboKVGtJUFqtbpAOXj7vYxM0,3305
serial/serialcli.py,sha256=u5QnG90UxttqsGG9nYgkj0GUyb0wIOxzlUgxJ4gCczg,9190
serial/serialjava.py,sha256=AcHLp2D_sAihu7L_wCcg8mtk7etf6zAyB4L_tuthVo8,8480
serial/serialposix.py,sha256=XVb5hRM5HhdmoYR6BOLhICztQXKhUoA7ocgjoUmptvk,35127
serial/serialutil.py,sha256=PIT4x8MZ8WGoXW-Ntb7cT2UlVxRYm9y-7m8tr2WhfAo,21797
serial/serialwin32.py,sha256=F2geqaZQEgxx2xqum4iBMBpA04xHs0uw2gUOP1v7vgA,20284
serial/threaded/__init__.py,sha256=ikXlKYejRlzzCze9kwxR_uABKa1YfuTyqcPjw3VRV1I,9319
serial/threaded/__pycache__/__init__.cpython-310.pyc,,
serial/tools/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
serial/tools/__pycache__/__init__.cpython-310.pyc,,
serial/tools/__pycache__/hexlify_codec.cpython-310.pyc,,
serial/tools/__pycache__/list_ports.cpython-310.pyc,,
serial/tools/__pycache__/list_ports_common.cpython-310.pyc,,
serial/tools/__pycache__/list_ports_linux.cpython-310.pyc,,
serial/tools/__pycache__/list_ports_osx.cpython-310.pyc,,
serial/tools/__pycache__/list_ports_posix.cpython-310.pyc,,
serial/tools/__pycache__/list_ports_windows.cpython-310.pyc,,
serial/tools/__pycache__/miniterm.cpython-310.pyc,,
serial/tools/hexlify_codec.py,sha256=FRJSO8pfjM6AR9_SBqL34e50LVkvlzfFKdmCScGn408,3677
serial/tools/list_ports.py,sha256=eDDoyIhoS3f9D3CVpthqlQUqiR2l-X0VTGGOBjuM4ew,3389
serial/tools/list_ports_common.py,sha256=x5HIghG4NIz-Xf5iX6Gk7xZfdeads2tqCsfyJhh3Ifs,3736
serial/tools/list_ports_linux.py,sha256=UnU1VYP1NJI7J8Zn7gY-A2mbi1lugbFZSVztfX8P1pU,4503
serial/tools/list_ports_osx.py,sha256=eoefMGiuJqC-OCu9aAWqqJX75wGlBzoqZ6kdmMA82LM,11178
serial/tools/list_ports_posix.py,sha256=EYqD5kRbk0f2a5scaRS4tgWGBynkpVH77ja_G6S3UhE,4535
serial/tools/list_ports_windows.py,sha256=U4EzcOAiU66LWoPdMXI2oOM4LCd5vKwO3DgeTT6M3qc,16021
serial/tools/miniterm.py,sha256=fXvkEU9FEyU7HPSNE8bdX2OCgiGYgCee066yF58nots,37840
serial/urlhandler/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
serial/urlhandler/__pycache__/__init__.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_alt.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_cp2110.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_hwgrep.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_loop.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_rfc2217.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_socket.cpython-310.pyc,,
serial/urlhandler/__pycache__/protocol_spy.cpython-310.pyc,,
serial/urlhandler/protocol_alt.py,sha256=-kYoCgy9GyMWN6wC8Oew8FL04LjL4Ntx3HHVqSTKGcQ,2033
serial/urlhandler/protocol_cp2110.py,sha256=iULOT4Vdw20P_w2jfSWdt0roUY1Ku8xJVHHYc6d3ImY,8540
serial/urlhandler/protocol_hwgrep.py,sha256=GdKdQ9tExKRHJzsiPcQ9ExmaLa6-A71q52i4jQxmoBk,3159
serial/urlhandler/protocol_loop.py,sha256=5barru_hfwNkayjjBz4w3snBJn0G7C-fG7-QmHaeTWo,10623
serial/urlhandler/protocol_rfc2217.py,sha256=IPO8r3pFN6yEDl1Zv2jgUnfIa0tQ0iY0ZsD8_xhAUeQ,317
serial/urlhandler/protocol_socket.py,sha256=QotaHCPd6t903W_9fa2Lv_5uElq0noir2Ci10a987XM,14299
serial/urlhandler/protocol_spy.py,sha256=FdUaU43-bl1KXTy_S4HhzyGV5hpUsopm8IqTrX2VX-4,9130
serial/win32.py,sha256=lk6rod9mHkqzgchmaqB3ygiTkmAWTNQ00IJ985ZjvTI,11138
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.30.0)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[console_scripts]
pyserial-miniterm = serial.tools.miniterm:main
pyserial-ports = serial.tools.list_ports:main

Original file line number Diff line number Diff line change
@@ -0,0 +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": "[email protected]", "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"}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
serial
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
#!/usr/bin/env python
#
# This is a wrapper module for different platform implementations
#
# This file is part of pySerial. https://github.com/pyserial/pyserial
# (C) 2001-2020 Chris Liechti <[email protected]>
#
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import absolute_import

import sys
import importlib

from serial.serialutil import *
#~ SerialBase, SerialException, to_bytes, iterbytes

__version__ = '3.5'

VERSION = __version__

# pylint: disable=wrong-import-position
if sys.platform == 'cli':
from serial.serialcli import Serial
else:
import os
# chose an implementation, depending on os
if os.name == 'nt': # sys.platform == 'win32':
from serial.serialwin32 import Serial
elif os.name == 'posix':
from serial.serialposix import Serial, PosixPollSerial, VTIMESerial # noqa
elif os.name == 'java':
from serial.serialjava import Serial
else:
raise ImportError("Sorry: no implementation for your platform ('{}') available".format(os.name))


protocol_handler_packages = [
'serial.urlhandler',
]


def serial_for_url(url, *args, **kwargs):
"""\
Get an instance of the Serial class, depending on port/url. The port is not
opened when the keyword parameter 'do_not_open' is true, by default it
is. All other parameters are directly passed to the __init__ method when
the port is instantiated.
The list of package names that is searched for protocol handlers is kept in
``protocol_handler_packages``.
e.g. we want to support a URL ``foobar://``. A module
``my_handlers.protocol_foobar`` is provided by the user. Then
``protocol_handler_packages.append("my_handlers")`` would extend the search
path so that ``serial_for_url("foobar://"))`` would work.
"""
# check and remove extra parameter to not confuse the Serial class
do_open = not kwargs.pop('do_not_open', False)
# the default is to use the native implementation
klass = Serial
try:
url_lowercase = url.lower()
except AttributeError:
# it's not a string, use default
pass
else:
# if it is an URL, try to import the handler module from the list of possible packages
if '://' in url_lowercase:
protocol = url_lowercase.split('://', 1)[0]
module_name = '.protocol_{}'.format(protocol)
for package_name in protocol_handler_packages:
try:
importlib.import_module(package_name)
handler_module = importlib.import_module(module_name, package_name)
except ImportError:
continue
else:
if hasattr(handler_module, 'serial_class_for_url'):
url, klass = handler_module.serial_class_for_url(url)
else:
klass = handler_module.Serial
break
else:
raise ValueError('invalid URL, protocol {!r} not known'.format(protocol))
# instantiate and open when desired
instance = klass(None, *args, **kwargs)
instance.port = url
if do_open:
instance.open()
return instance
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
from .tools import miniterm

miniterm.main()
Loading

0 comments on commit bc8e149

Please sign in to comment.