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