import os
import re
from setuptools import find_packages, setup


VERSIONFILE = os.path.join('statsd', '_version.py')
VSRE = r'^__version__ = [\'"]([^\'"]*)[\'"]'


def get_version():
    verstrline = open(VERSIONFILE, "rt").read()
    mo = re.search(VSRE, verstrline, re.M)
    if mo:
        return mo.group(1)
    else:
        raise RuntimeError(
            "Unable to find version string in %s." % VERSIONFILE)


setup(
    name='python-statsd',
    version=get_version(),
    description='A simple statsd client.',
    long_description=open('README.rst').read(),
    author='Renato Covarrubias',
    author_email='rnt@rnt.cl',
    url='https://github.com/rnt/python-statsd',
    license='MIT',
    packages=find_packages(),
    include_package_data=True,
    package_data={'': ['README.rst']},
    classifiers=[
        'Development Status :: 5 - Production/Stable',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.5',
        'Programming Language :: Python :: 2.6',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.2',
        'Topic :: Software Development :: Libraries :: Python Modules',
    ]
)
