#!/usr/bin/env python

import os
import re

from setuptools import setup, find_packages, Extension

import bndl


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,

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

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

    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',
    ],
)

@@ -35,16 +35,27 @@
 mport re
+%0Aimport sys
 %0A%0Afrom s
@@ -118,16 +118,466 @@
  bndl%0A%0A%0A
+install_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%0Aextra_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 = re
@@ -1034,16 +1034,17 @@
  pass%0A%0A%0A
+%0A
 setup(%0A 
@@ -1459,31 +1459,30 @@
 False,%0A%0A    
-install
+python
 _requires=%5B%0A
@@ -1483,464 +1483,90 @@
 res=
-%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%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
+'%3E=3.3',%0A    install_requires=install_requires,%0A    extras_require=extras_require,
 %0A   

set python version dependency and add asyncio for python < 3.4