from __future__ import absolute_import, division, print_function

import io
import os
import sys
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand


import structmap

here = os.path.abspath(os.path.dirname(__file__))

def read(*filenames, **kwargs):
    encoding = kwargs.get('encoding', 'utf-8')
    sep = kwargs.get('sep', '\n')
    buf = []
    for filename in filenames:
        with io.open(filename, encoding=encoding) as f:
            buf.append(f.read())
    return sep.join(buf)

LONG_DESCRIPTION = read('README.txt', 'CHANGES.txt')

class PyTest(TestCommand):
    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        import pytest
        errcode = pytest.main(self.test_args)
        sys.exit(errcode)

setup(
    name='structmap',
    version=structmap.__version__,
    url='',
    license='Apache Software License',
    author='Andrew Guy',
    tests_require=['pytest'],
    install_requires=['Biopython>=1.66',
                      'DendroPy>=4.0.3',
                      'NumPy',
                      'SciPy'
                     ],
    cmdclass={'test': PyTest},
    author_email='andrewguy@burnet.edu.au',
    description='A simple package for mapping data onto protein PDB structures',
    long_description=LONG_DESCRIPTION,
    packages=['structmap'],
    include_package_data=True,
    platforms='any',
    test_suite='tests.test_structmap',
    classifiers=[
        'Programming Language :: Python',
        'Development Status :: 2 - Pre-Alpha',
        'Natural Language :: English',
        'Intended Audience :: Science/Research',
        'License :: OSI Approved :: Apache Software License',
        'Operating System :: OS Independent',
        'Topic :: Scientific/Engineering :: Bio-Informatics',
        ],
    extras_require={
        'testing': ['pytest'],
    }
)

@@ -195,25 +195,190 @@
 nd%0A%0A
-%0Aimport structmap
+# Version is defined in structmap/__init__.py%0A__version__ = %22Undefined%22%0Afor line in open('structmap/__init__.py'):%0A    if (line.startswith('__version__')):%0A        exec(line.strip())
 %0A%0Ahe
@@ -1079,18 +1079,8 @@
 ion=
-structmap.
 __ve
@@ -1104,47 +1104,8 @@
 '',%0A
-    license='Apache Software License',%0A
     
@@ -1151,24 +1151,54 @@
 %5B'pytest'%5D,%0A
+    setup_requires=%5B'numpy'%5D,%0A
     install_
@@ -1294,12 +1294,12 @@
    '
-NumP
+nump
 y',%0A
@@ -1325,12 +1325,12 @@
    '
-SciP
+scip
 y'%0A 
@@ -1901,23 +1901,11 @@
  :: 
-Apache Software
+MIT
  Lic

update setup with requirements and license