#!/usr/bin/env python

"""
Flask-Collect
-------------

Setup module.

"""
import re
import sys

from os import path

from setuptools import setup, find_packages


def _read(fname):
    try:
        return open(path.join(path.dirname(__file__), fname)).read()
    except IOError:
        return ''

_meta = _read('flask_collect/__init__.py')
_license = re.search(r'^__license__\s*=\s*"(.*)"', _meta, re.M).group(1)
_version = re.search(r'^__version__\s*=\s*"(.*)"', _meta, re.M).group(1)

needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)

install_requires = [
    l for l in _read('requirements.txt').split('\n')
    if l and not l.startswith('#')]

tests_requires = [
    l for l in _read('requirements-test.txt').split('\n')
    if l and not l.startswith('#')]


META_DATA = dict(
    name='Flask-Collect',
    version=_version,
    license=_license,
    description=_read('DESCRIPTION'),
    long_description=_read('README.rst'),
    platforms=('Any'),
    keywords="flask static deploy".split(),

    author='Kirill Klenov',
    author_email='horneds@gmail.com',
    url=' http://github.com/klen/Flask-Collect',
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Natural Language :: English',
        'Natural Language :: Russian',
        'Operating System :: OS Independent',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'Topic :: Utilities',
    ],
    packages=find_packages(),
    include_package_data=True,
    install_requires=install_requires,
    setup_requires=[
        'pytest-runner',
    ] if needs_pytest else [],
    tests_require=tests_requires,
)


if __name__ == "__main__":
    setup(**META_DATA)
