Add distutils / setuptools installation support for Python libs / scripts.
[third_party/subunit] / setup.py
1 try:
2     # If the user has setuptools / distribute installed, use it
3     from setuptools import setup
4 except ImportError:
5     # Otherwise, fall back to distutils.
6     from distutils.core import setup
7     extra = {}
8 else:
9     extra = {
10         'install_requires': [
11             'testtools',
12         ]
13     }
14
15 try:
16     # Assume we are in a distribution, which has PKG-INFO
17     version_lines = [x for x in open('PKG-INFO').readlines()
18                         if x.startswith('Version:')]
19     version_line = version_lines and version_lines[-1] or 'VERSION = 0.0'
20     VERSION = version_line.split(':')[1].strip()
21  
22 except IOError:
23     # Must be a development checkout, so use the Makefile
24     version_lines = [x for x in open('Makefile').readlines()
25                         if x.startswith('VERSION')]
26     version_line = version_lines and version_lines[-1] or 'VERSION = 0.0'
27     VERSION = version_line.split('=')[1].strip()
28
29
30 setup(
31     name='subunit-python',
32     version=VERSION,
33     description=('Python implementation of subunit test streaming protocol'),
34     long_description=open('README').read(),
35     classifiers=[
36         'Intended Audience :: Developers',
37         'Programming Language :: Python',
38         'Topic :: Software Development :: Testing',
39     ],
40     keywords='python test streaming',
41     author='Robert Collins',
42     author_email='subunit-dev@lists.launchpad.net',
43     url='http://launchpad.net/subunit',
44     packages=['subunit'],
45     package_dir={'subunit': 'python/subunit'},
46     scripts = [
47         'filters/subunit2gtk',
48         'filters/subunit2junitxml',
49         'filters/subunit2pyunit',
50         'filters/subunit-filter',
51         'filters/subunit-ls',
52         'filters/subunit-notify',
53         'filters/subunit-stats',
54         'filters/subunit-tags',
55         'filters/tap2subunit',
56     ],
57     **extra
58 )