# Copyright (c) 2015, 2016 Florian Wagner
#
# This file is part of GOparser.
#
# GOparser is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License, Version 3,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.

from __future__ import print_function

from setuptools import setup, find_packages, Command
import io
import os

here = os.path.abspath(os.path.dirname(__file__))
description = ('GOparser - A Python Framework for Working with Gene Ontology '
               '(GO) Terms and Annotations')
version = '1.2rc1'

with io.open(os.path.join(here, 'README.rst'), encoding='UTF-8') as fh:
    long_description = fh.read()

install_requires = [
    'future >= 0.15.2, < 1',
    'six >= 1.10.0, < 2',
    'unicodecsv >= 0.14.1, < 1',
]

# do not require installation if built by ReadTheDocs
# (we mock these modules in docs/source/conf.py)
if 'READTHEDOCS' not in os.environ or \
        os.environ['READTHEDOCS'] != 'True':
    install_requires.extend([
        'genometools >= 2.0rc1, < 3',
    ])


class CleanCommand(Command):
    """Removes files generated by setuptools.

    """
    # see https://github.com/trigger/trigger/blob/develop/setup.py
    user_options = []

    def initialize_options(self):
        pass

    def finalize_options(self):
        pass

    def run(self):
        error_msg = 'You must run this command in the package root!'
        assert os.getcwd() == here, error_msg
        os.system('rm -rf ./dist ./build ./*.egg-info ')

setup(
    name='goparser',

    version=version,

    description=description,
    long_description=long_description,

    # homepage
    url='https://github.com/flo-compbio/goparser',

    author='Florian Wagner',
    author_email='florian.wagner@duke.edu',

    license='GPLv3',

    # see https://pypi.python.org/pypi?%3Aaction=list_classifiers
    classifiers=[
        'Development Status :: 3 - Alpha',

        'Intended Audience :: Developers',
        'Intended Audience :: Science/Research',
        'Topic :: Scientific/Engineering :: Bio-Informatics',

        'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',

        'Programming Language :: Python :: 2.7',
    ],

    # What does your project relate to?
    keywords='gene ontology biology bioinformatics',

    # packages=find_packages(exclude=['contrib', 'docs', 'tests*']),
    # packages=['goparser'],
    packages=find_packages(exclude=['docs', 'tests*']),

    install_requires=install_requires,

    # development dependencies
    extras_require={
        'docs': ['sphinx', 'sphinx_rtd_theme']
    },

    # data
    # package_data={
    # },

    # data outside package
    # data_files=[('my_data', ['data/data_file'])],

    # executable scripts
    # entry_points={
    #    'console_scripts': []
    # },

    cmdclass={
        'clean': CleanCommand,
    },
)
