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 | # Windows installer: |
| 4 | # "python setup.py bdist_wininst" |
| 5 | # |
| 6 | # Direct install (all systems): |
| 7 | # "python setup.py install" |
| 8 | # |
| 9 | # For Python 3.x use the corresponding Python executable, |
| 10 | # e.g. "python3 setup.py ..." |
cliechti | ff94563 | 2009-07-25 01:15:00 +0000 | [diff] [blame] | 11 | |
cliechti | 7aaead3 | 2009-07-23 14:02:41 +0000 | [diff] [blame] | 12 | import sys |
| 13 | |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 14 | from distutils.core import setup |
cliechti | 89b4af1 | 2002-02-12 23:24:41 +0000 | [diff] [blame] | 15 | |
cliechti | 9911003 | 2011-08-22 01:15:46 +0000 | [diff] [blame] | 16 | if sys.version_info >= (3, 0): |
| 17 | try: |
| 18 | from distutils.command.build_py import build_py_2to3 as build_py |
| 19 | from distutils.command.build_scripts import build_scripts_2to3 as build_scripts |
| 20 | except ImportError: |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 21 | raise ImportError("build_py_2to3 not found in distutils - it is required for Python 3.x") |
cliechti | 67bbe91 | 2013-10-13 22:24:37 +0000 | [diff] [blame^] | 22 | else: |
| 23 | sys.stderr.write('Detected Python 3, using 2to3\n') |
cliechti | 9911003 | 2011-08-22 01:15:46 +0000 | [diff] [blame] | 24 | else: |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 25 | from distutils.command.build_py import build_py |
cliechti | a3d9de5 | 2010-10-23 22:13:39 +0000 | [diff] [blame] | 26 | from distutils.command.build_scripts import build_scripts |
cliechti | 05e6f79 | 2009-07-30 17:27:48 +0000 | [diff] [blame] | 27 | |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 28 | |
cliechti | f81362e | 2009-07-25 03:44:33 +0000 | [diff] [blame] | 29 | if sys.version < '2.3': |
| 30 | # distutils that old can't cope with the "classifiers" or "download_url" |
| 31 | # keywords and True/False constants and basestring are missing |
cliechti | daf47ba | 2009-07-28 01:28:16 +0000 | [diff] [blame] | 32 | raise ValueError("Sorry Python versions older than 2.3 are no longer" |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 33 | "supported - check http://pyserial.sf.net for older " |
| 34 | "releases or upgrade your Python installation.") |
cliechti | 5600e7c | 2003-11-06 22:17:21 +0000 | [diff] [blame] | 35 | |
cliechti | e428c0b | 2011-08-22 00:10:11 +0000 | [diff] [blame] | 36 | # importing version does not work with Python 3 as files have not yet been |
| 37 | # converted. |
| 38 | #~ import serial |
| 39 | #~ version = serial.VERSION |
| 40 | |
| 41 | import re, os |
| 42 | version = re.search( |
| 43 | "VERSION.*'(.+)'", |
| 44 | open(os.path.join('serial', '__init__.py')).read()).group(1) |
| 45 | |
cliechti | f0c9f51 | 2011-03-18 11:16:15 +0000 | [diff] [blame] | 46 | |
cliechti | 89b4af1 | 2002-02-12 23:24:41 +0000 | [diff] [blame] | 47 | setup( |
cliechti | 67bbe91 | 2013-10-13 22:24:37 +0000 | [diff] [blame^] | 48 | name = "pyserial", |
cliechti | 54f69b6 | 2009-07-21 19:48:41 +0000 | [diff] [blame] | 49 | description = "Python Serial Port Extension", |
cliechti | e428c0b | 2011-08-22 00:10:11 +0000 | [diff] [blame] | 50 | version = version, |
cliechti | 54f69b6 | 2009-07-21 19:48:41 +0000 | [diff] [blame] | 51 | author = "Chris Liechti", |
| 52 | author_email = "cliechti@gmx.net", |
| 53 | url = "http://pyserial.sourceforge.net/", |
cliechti | 0e69a9c | 2011-03-09 15:30:11 +0000 | [diff] [blame] | 54 | packages = ['serial', 'serial.tools', 'serial.urlhandler'], |
cliechti | 54f69b6 | 2009-07-21 19:48:41 +0000 | [diff] [blame] | 55 | license = "Python", |
| 56 | long_description = "Python Serial Port Extension for Win32, Linux, BSD, Jython, IronPython", |
cliechti | 5600e7c | 2003-11-06 22:17:21 +0000 | [diff] [blame] | 57 | classifiers = [ |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 58 | 'Development Status :: 5 - Production/Stable', |
| 59 | 'Intended Audience :: Developers', |
| 60 | 'Intended Audience :: End Users/Desktop', |
| 61 | 'License :: OSI Approved :: Python Software Foundation License', |
| 62 | 'Natural Language :: English', |
| 63 | 'Operating System :: POSIX', |
| 64 | 'Operating System :: Microsoft :: Windows', |
cliechti | ff94563 | 2009-07-25 01:15:00 +0000 | [diff] [blame] | 65 | #~ 'Operating System :: Microsoft :: Windows :: Windows CE', # could work due to new ctypes impl. someone needs to confirm that |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 66 | 'Programming Language :: Python', |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 67 | 'Programming Language :: Python :: 2', |
| 68 | 'Programming Language :: Python :: 2.3', |
| 69 | 'Programming Language :: Python :: 2.4', |
| 70 | 'Programming Language :: Python :: 2.5', |
| 71 | 'Programming Language :: Python :: 2.6', |
cliechti | 07709e4 | 2010-05-21 00:30:09 +0000 | [diff] [blame] | 72 | 'Programming Language :: Python :: 2.7', |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 73 | 'Programming Language :: Python :: 3', |
| 74 | 'Programming Language :: Python :: 3.0', |
| 75 | 'Programming Language :: Python :: 3.1', |
cliechti | 9911003 | 2011-08-22 01:15:46 +0000 | [diff] [blame] | 76 | 'Programming Language :: Python :: 3.2', |
cliechti | 67bbe91 | 2013-10-13 22:24:37 +0000 | [diff] [blame^] | 77 | 'Programming Language :: Python :: 3.3', |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 78 | 'Topic :: Communications', |
| 79 | 'Topic :: Software Development :: Libraries', |
cliechti | ff94563 | 2009-07-25 01:15:00 +0000 | [diff] [blame] | 80 | 'Topic :: Software Development :: Libraries :: Python Modules', |
cliechti | 8db88b6 | 2003-09-10 20:14:53 +0000 | [diff] [blame] | 81 | 'Topic :: Terminals :: Serial', |
| 82 | ], |
cliechti | 54f69b6 | 2009-07-21 19:48:41 +0000 | [diff] [blame] | 83 | platforms = 'any', |
cliechti | a3d9de5 | 2010-10-23 22:13:39 +0000 | [diff] [blame] | 84 | cmdclass = {'build_py': build_py, 'build_scripts': build_scripts}, |
cliechti | 67bbe91 | 2013-10-13 22:24:37 +0000 | [diff] [blame^] | 85 | use_2to3 = sys.version_info >= (3, 0), # for distribute |
cliechti | 1eb947d | 2009-07-25 00:44:23 +0000 | [diff] [blame] | 86 | |
cliechti | 16d7377 | 2011-03-09 15:33:33 +0000 | [diff] [blame] | 87 | scripts = ['serial/tools/miniterm.py'], |
cliechti | 54f69b6 | 2009-07-21 19:48:41 +0000 | [diff] [blame] | 88 | ) |