import codecs
import os
import re

from setuptools import setup, find_packages

# Extract version
init = open(os.path.join('src', 'transpyler', '__init__.py')).read()
m = re.search(r"__version__ ?= ?'([0-9a-z.]+)'", init)
version = m.group(1)

# Reuse dependencies list
dependencies = {
    'google_translate': ['textblob'],
    'jupyter': ['jupyter', 'jupyter-console', 'ipython'],
    'pygments': ['pygments'],
    'dev': ['manuel', 'pytest', 'pytest-cov']
}
dependencies['dev'] += sum(
    [v for k, v in dependencies.items() if k != 'dev'], []
)

setup(
    # Basic info
    name='transpyler',
    version=version,
    author='Fábio Macêdo Mendes',
    author_email='fabiomacedomendes@gmail.com',
    url='https://github.com/transpyler/transpyler/',
    description='A framework for building localized Python-like languages.',
    long_description=codecs.open('README.rst', 'rb', 'utf8').read(),

    # Classifiers (see https://pypi.python.org/pypi?%3Aaction=list_classifiers)
    classifiers=[
        'Development Status :: 4 - Beta',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: GNU General Public License (GPL)',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
        'Programming Language :: Python :: 3.6',
        'Topic :: Software Development :: Libraries',
    ],

    # Package data
    package_data={
        'transpyler.jupyter': [
            'assets/*.*',
        ],
        'transpyler.turtle': [
            'data/*.*',
        ],
        'transpyler.l10n': [
            '*.po',
            '*.mo',
            '*.pot',
        ],
    },

    # Packages and dependencies
    package_dir={'': 'src'},
    packages=find_packages('src'),
    install_requires=[
        'lazyutils',
        'unidecode',
        'polib',
        'colortools',
        'click',
    ],
    extras_require=dependencies,

    # Other configurations
    zip_safe=False,
    platforms='any',
)
