1# setup.py for pySerial 2# 3# Direct install (all systems): 4# "python setup.py install" 5# 6# For Python 3.x use the corresponding Python executable, 7# e.g. "python3 setup.py ..." 8# 9# (C) 2001-2020 Chris Liechti <[email protected]> 10# 11# SPDX-License-Identifier: BSD-3-Clause 12import io 13import os 14import re 15 16try: 17 from setuptools import setup 18except ImportError: 19 from distutils.core import setup 20 21 22def read(*names, **kwargs): 23 """Python 2 and Python 3 compatible text file reading. 24 25 Required for single-sourcing the version string. 26 """ 27 with io.open( 28 os.path.join(os.path.dirname(__file__), *names), 29 encoding=kwargs.get("encoding", "utf8") 30 ) as fp: 31 return fp.read() 32 33 34def find_version(*file_paths): 35 """ 36 Search the file for a version string. 37 38 file_path contain string path components. 39 40 Reads the supplied Python module as text without importing it. 41 """ 42 version_file = read(*file_paths) 43 version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", 44 version_file, re.M) 45 if version_match: 46 return version_match.group(1) 47 raise RuntimeError("Unable to find version string.") 48 49 50version = find_version('serial', '__init__.py') 51 52 53setup( 54 name="pyserial", 55 description="Python Serial Port Extension", 56 version=version, 57 author="Chris Liechti", 58 author_email="[email protected]", 59 url="https://github.com/pyserial/pyserial", 60 packages=['serial', 'serial.tools', 'serial.urlhandler', 'serial.threaded'], 61 license="BSD", 62 long_description="""\ 63Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython 64 65Stable: 66 67- Documentation: http://pythonhosted.org/pyserial/ 68- Download Page: https://pypi.python.org/pypi/pyserial 69 70Latest: 71 72- Documentation: http://pyserial.readthedocs.io/en/latest/ 73- Project Homepage: https://github.com/pyserial/pyserial 74""", 75 classifiers=[ 76 'Development Status :: 5 - Production/Stable', 77 'Intended Audience :: Developers', 78 'Intended Audience :: End Users/Desktop', 79 'License :: OSI Approved :: BSD License', 80 'Natural Language :: English', 81 'Operating System :: POSIX', 82 'Operating System :: Microsoft :: Windows', 83 'Operating System :: MacOS :: MacOS X', 84 'Programming Language :: Python', 85 'Programming Language :: Python :: 2', 86 'Programming Language :: Python :: 2.7', 87 'Programming Language :: Python :: 3', 88 'Programming Language :: Python :: 3.4', 89 'Programming Language :: Python :: 3.5', 90 'Programming Language :: Python :: 3.6', 91 'Programming Language :: Python :: 3.7', 92 'Programming Language :: Python :: 3.8', 93 'Topic :: Communications', 94 'Topic :: Software Development :: Libraries', 95 'Topic :: Software Development :: Libraries :: Python Modules', 96 'Topic :: Terminals :: Serial', 97 ], 98 platforms='any', 99 entry_points = { 100 'console_scripts': [ 101 'pyserial-miniterm=serial.tools.miniterm:main', 102 'pyserial-ports=serial.tools.list_ports:main' 103 ], 104 }, 105 extras_require = { 106 'cp2110': ['hidapi'], 107 }, 108) 109