#!/usr/bin/env python

import os
import re
import sys

from setuptools import setup, find_packages, Extension

import bndl


install_requires = [
    'sortedcontainers',
    'cloudpickle>=0.2.1',
    'cytoolz',
    'numpy',
    'flask',
    'mmh3',
    'scandir',
    'psutil',
    'tblib',
    'marisa_trie',
    'yappi',
]

if sys.version_info < (3, 4):
    install_requires += ['asyncio']

extras_require = dict(
    dev=[
        'cython',
        'pytest',
        'pytest-cov',
        'pylint',
        'flake8',
        'sphinx',
        'sphinx-autobuild',
    ],
)

ext = re.compile(r'\.pyx$')

extensions = [
    Extension(
        '.'.join((root.replace(os.sep, '.'), ext.sub('', f))),
        [os.path.join(root, f)]
    )
    for root, dirs, files in os.walk('bndl')
    for f in files
    if not root.endswith('tests')
    if ext.search(f)
]

try:
    from Cython.Build.Dependencies import cythonize
    extensions = cythonize(extensions, compiler_directives={
        'language_level': 3
    })
except ImportError:
    pass



setup(
    name='bndl',
    version=bndl.__version__,
    url='https://stash.tgho.nl/projects/THCLUSTER/repos/bndl/browse',
    description='Bundle compute resources with BNDL',
    long_description=open('README.md').read(),
    author='Frens Jan Rumph',
    author_email='mail@frensjan.nl',

    packages=(
        find_packages(exclude=["*.tests", "*.tests.*"])
    ),

    include_package_data=True,
    zip_safe=False,

    python_requires='>=3.3',
    install_requires=install_requires,
    extras_require=extras_require,
    ext_modules=extensions,

    entry_points=dict(
        console_scripts=[
            'bndl-compute-shell = bndl.compute.shell:main',
            'bndl-compute-workers = bndl.compute.worker:run_workers',
        ],
    ),

    classifiers=[
        'Development Status :: 3 - Alpha',
        'Intended Audience :: Developers',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 3.4',
        'Programming Language :: Python :: 3.5',
    ],
)

@@ -39,19 +39,8 @@
 t re
-%0Aimport sys
 %0A%0Afr
@@ -110,460 +110,8 @@
 dl%0A%0A
-%0Ainstall_requires = %5B%0A    'sortedcontainers',%0A    'cloudpickle%3E=0.2.1',%0A    'cytoolz',%0A    'numpy',%0A    'flask',%0A    'mmh3',%0A    'scandir',%0A    'psutil',%0A    'tblib',%0A    'marisa_trie',%0A    'yappi',%0A%5D%0A%0Aif sys.version_info %3C (3, 4):%0A    install_requires += %5B'asyncio'%5D%0A%0Aextras_require = dict(%0A    dev=%5B%0A        'cython',%0A        'pytest',%0A        'pytest-cov',%0A        'pylint',%0A        'flake8',%0A        'sphinx',%0A        'sphinx-autobuild',%0A    %5D,%0A)%0A%0A
 ext 
@@ -1022,17 +1022,17 @@
 es='%3E=3.
-3
+4
 ',%0A    i
@@ -1051,59 +1051,461 @@
 res=
-install_requires,%0A    extras_require=extras_require
+%5B%0A        'sortedcontainers',%0A        'cloudpickle%3E=0.2.1',%0A        'cytoolz',%0A        'numpy',%0A        'flask',%0A        'mmh3',%0A        'scandir',%0A        'psutil',%0A        'tblib',%0A        'marisa_trie',%0A        'yappi',%0A    %5D,%0A    extras_require=dict(%0A        dev=%5B%0A            'cython',%0A            'pytest',%0A            'pytest-cov',%0A            'pylint',%0A            'flake8',%0A            'sphinx',%0A            'sphinx-autobuild',%0A        %5D,%0A    )
 ,%0A  

drop python 3.3 support