d392231054f8155205ca2a9a95a38711171372eb
[releng-anteater.git] / setup.py
1 # -*- coding: utf-8 -*-
2 from __future__ import absolute_import
3 import re
4 import sys
5 from setuptools.command.test import test as TestCommand
6 from setuptools import setup, find_packages
7
8 REQUIRES = [
9     'docopt',
10 ]
11
12
13 class PyTest(TestCommand):
14     def finalize_options(self):
15         TestCommand.finalize_options(self)
16         self.test_args = []
17         self.test_suite = True
18
19     def run_tests(self):
20         import pytest
21         errcode = pytest.main(self.test_args)
22         sys.exit(errcode)
23
24
25 def find_version(fname):
26     '''Attempts to find the version number in the file names fname.
27     Raises RuntimeError if not found.
28     '''
29     version = ''
30     with open(fname, 'r') as fp:
31         reg = re.compile(r'__version__ = [\'"]([^\'"]*)[\'"]')
32         for line in fp:
33             m = reg.match(line)
34             if m:
35                 version = m.group(1)
36                 break
37     if not version:
38         raise RuntimeError('Cannot find version information')
39     return version
40
41 __version__ = find_version("anteater/main.py")
42
43
44 def read(fname):
45     with open(fname) as fp:
46         content = fp.read()
47     return content
48
49 setup(
50     name='anteater',
51     version="0.1",
52     description='anteater',
53     long_description=read("README.md"),
54     author='Luke Hinds',
55     author_email='lhinds@redhat.com',
56     url='https://gerrit.opnfv.org/gerrit/gitweb?p=releng-anteater.git',
57     install_requires=REQUIRES,
58     license=read("LICENSE"),
59     zip_safe=False,
60     keywords='anteater',
61     classifiers=[
62         'Development Status :: 2 - Pre-Alpha',
63         'Intended Audience :: Developers',
64         'License :: OSI Approved :: Apache Software License',
65         'Natural Language :: English',
66         "Programming Language :: Python :: 2",
67         'Programming Language :: Python :: 2.7',
68         "Programming Language :: Python :: 3",
69         'Programming Language :: Python :: 3.4',
70         'Programming Language :: Python :: Implementation :: CPython',
71         'Programming Language :: Python :: Implementation :: PyPy'
72     ],
73     packages=find_packages(),
74     py_modules=["anteater"],
75     entry_points={
76         'console_scripts': [
77             "anteater = anteater.main:main"
78         ]
79     },
80     tests_require=['pytest'],
81     cmdclass={'test': PyTest}
82 )