cliechti | a3d9de5 | 2010-10-23 22:13:39 +0000 | [diff] [blame] | 1 | # setup.py for pySerial |
cliechti | ff94563 | 2009-07-25 01:15:00 +0000 | [diff] [blame] | 2 | # |
cliechti | a3d9de5 | 2010-10-23 22:13:39 +0000 | [diff] [blame] | 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 ..." |
Chris Liechti | fbdd8a0 | 2015-08-09 02:37:45 +0200 | [diff] [blame] | 8 | # |
Chris Liechti | 6fa82e1 | 2020-09-21 00:44:45 +0200 | [diff] [blame] | 9 | # (C) 2001-2020 Chris Liechti <cliechti@gmx.net> |
Chris Liechti | fbdd8a0 | 2015-08-09 02:37:45 +0200 | [diff] [blame] | 10 | # |
| 11 | # SPDX-License-Identifier: BSD-3-Clause |
Robert Smallshire | a31f9ac | 2016-06-13 10:19:38 +0200 | [diff] [blame] | 12 | import io |
| 13 | import os |
| 14 | import re |
cliechti | ff94563 | 2009-07-25 01:15:00 +0000 | [diff] [blame] | 15 | |
Steven Michalske | b028b25 | 2015-08-06 22:29:23 -0700 | [diff] [blame] | 16 | try: |
| 17 | from setuptools import setup |
| 18 | except ImportError: |
| 19 | from distutils.core import setup |
cliechti | 5600e7c | 2003-11-06 22:17:21 +0000 | [diff] [blame] | 20 | |
Robert Smallshire | a31f9ac | 2016-06-13 10:19:38 +0200 | [diff] [blame] | 21 | |
| 22 | def 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 | |
| 34 | def 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 | |
| 50 | version = find_version('serial', '__init__.py') |
| 51 | |
cliechti | f0c9f51 | 2011-03-18 11:16:15 +0000 | [diff] [blame] | 52 | |
cliechti | 89b4af1 | 2002-02-12 23:24:41 +0000 | [diff] [blame] | 53 | setup( |
Chris Liechti | 8813f57 | 2016-01-31 23:28:33 +0100 | [diff] [blame] | 54 | name="pyserial", |
| 55 | description="Python Serial Port Extension", |
| 56 | version=version, |
| 57 | author="Chris Liechti", |
| 58 | author_email="cliechti@gmx.net", |
| 59 | url="https://github.com/pyserial/pyserial", |
| 60 | packages=['serial', 'serial.tools', 'serial.urlhandler', 'serial.threaded'], |
Chris Liechti | 9852c30 | 2016-03-18 23:01:49 +0100 | [diff] [blame] | 61 | license="BSD", |
Chris Liechti | bf6d3aa | 2016-04-28 23:49:37 +0200 | [diff] [blame] | 62 | long_description="""\ |
| 63 | Python Serial Port Extension for Win32, OSX, Linux, BSD, Jython, IronPython |
| 64 | |
| 65 | Stable: |
| 66 | |
| 67 | - Documentation: http://pythonhosted.org/pyserial/ |
| 68 | - Download Page: https://pypi.python.org/pypi/pyserial |
| 69 | |
| 70 | Latest: |
| 71 | |
| 72 | - Documentation: http://pyserial.readthedocs.io/en/latest/ |
| 73 | - Project Homepage: https://github.com/pyserial/pyserial |
| 74 | """, |
Chris Liechti | 8813f57 | 2016-01-31 23:28:33 +0100 | [diff] [blame] | 75 | classifiers=[ |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 76 | 'Development Status :: 5 - Production/Stable', |
| 77 | 'Intended Audience :: Developers', |
| 78 | 'Intended Audience :: End Users/Desktop', |
Chris Liechti | 80e2ae2 | 2015-08-04 02:59:50 +0200 | [diff] [blame] | 79 | 'License :: OSI Approved :: BSD License', |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 80 | 'Natural Language :: English', |
| 81 | 'Operating System :: POSIX', |
| 82 | 'Operating System :: Microsoft :: Windows', |
Chris Liechti | 72726d7 | 2015-10-23 22:03:04 +0200 | [diff] [blame] | 83 | 'Operating System :: MacOS :: MacOS X', |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 84 | 'Programming Language :: Python', |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 85 | 'Programming Language :: Python :: 2', |
cliechti | 07709e4 | 2010-05-21 00:30:09 +0000 | [diff] [blame] | 86 | 'Programming Language :: Python :: 2.7', |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 87 | 'Programming Language :: Python :: 3', |
Chris Liechti | 80e2ae2 | 2015-08-04 02:59:50 +0200 | [diff] [blame] | 88 | 'Programming Language :: Python :: 3.4', |
| 89 | 'Programming Language :: Python :: 3.5', |
Chris Liechti | 4f988d4 | 2017-03-20 23:59:40 +0100 | [diff] [blame] | 90 | 'Programming Language :: Python :: 3.6', |
Chris Liechti | 6ae64c1 | 2020-09-21 02:38:31 +0200 | [diff] [blame] | 91 | 'Programming Language :: Python :: 3.7', |
| 92 | 'Programming Language :: Python :: 3.8', |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 93 | 'Topic :: Communications', |
| 94 | 'Topic :: Software Development :: Libraries', |
cliechti | ff94563 | 2009-07-25 01:15:00 +0000 | [diff] [blame] | 95 | 'Topic :: Software Development :: Libraries :: Python Modules', |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 96 | 'Topic :: Terminals :: Serial', |
| 97 | ], |
Chris Liechti | 8813f57 | 2016-01-31 23:28:33 +0100 | [diff] [blame] | 98 | platforms='any', |
Chris Liechti | 6ae64c1 | 2020-09-21 02:38:31 +0200 | [diff] [blame] | 99 | entry_points = { |
| 100 | 'console_scripts': [ |
| 101 | 'pyserial-miniterm=serial.tools.miniterm:main', |
| 102 | 'pyserial-ports=serial.tools.list_ports:main' |
| 103 | ], |
| 104 | }, |
Diego Elio Pettenò | 8b24cbb | 2019-02-08 12:02:34 +0000 | [diff] [blame] | 105 | extras_require = { |
| 106 | 'cp2110': ['hidapi'], |
| 107 | }, |
cliechti | 54f69b6 | 2009-07-21 19:48:41 +0000 | [diff] [blame] | 108 | ) |