1#!/usr/bin/env python
2# -*- coding: UTF-8 -*-
3"""Setup for PyPI usage."""
4
5import glob
6import os.path as op
7import sys
8
9from setuptools import setup
10from setuptools.command.test import test as testCommand
11from setup_helper import SetupHelper
12
13import versioneer
14
15
16class PyTest(testCommand):
17    """Allow testing to be run from setuptools."""
18
19    def initialize_options(self):
20        testCommand.initialize_options(self)
21        self.test_args = []
22
23    def finalize_options(self):
24        testCommand.finalize_options(self)
25        self.test_args += ["--cov", "goatools", "tests"]
26
27    def run_tests(self):
28        # pylint:disable=import-outside-toplevel
29        import pytest
30
31        errno = pytest.main(self.test_args)
32        sys.exit(errno)
33
34
35NAME = "goatools"
36CLASSIFIERS = [
37    "Development Status :: 4 - Beta",
38    "Intended Audience :: Science/Research",
39    "License :: OSI Approved :: BSD License",
40    "Programming Language :: Python",
41    "Programming Language :: Python :: 2",
42    "Programming Language :: Python :: 3",
43    "Topic :: Scientific/Engineering :: Bio-Informatics",
44]
45
46PACKAGES = [
47    NAME,
48    NAME + ".godag",
49    NAME + ".gosubdag",
50    NAME + ".gosubdag.plot",
51    NAME + ".gosubdag.rpt",
52    NAME + ".test_data",
53    NAME + ".test_data.sections",
54    NAME + ".test_data.cli",
55    NAME + ".cli",
56    NAME + ".rpt",
57    NAME + ".anno",
58    NAME + ".anno.init",
59    NAME + ".anno.extensions",
60    NAME + ".goea",
61    NAME + ".grouper",
62    NAME + ".parsers",
63    NAME + ".semsim",
64    NAME + ".semsim.termwise",
65]
66
67# Use the helper
68HLPR = SetupHelper(initfile="goatools/__init__.py", readmefile="README.md")
69
70SETUP_DIR = op.abspath(op.dirname(__file__))
71REQUIREMENTS = [
72    x.strip() for x in open(op.join(SETUP_DIR, "requirements.txt")).readlines()
73]
74
75setup(
76    name=NAME,
77    version=versioneer.get_version(),
78    author=HLPR.author,
79    author_email=HLPR.email,
80    license=HLPR.license,
81    long_description=HLPR.long_description,
82    long_description_content_type="text/markdown",
83    cmdclass=versioneer.get_cmdclass(),
84    packages=PACKAGES,
85    include_package_data=True,
86    package_data={"goatools.test_data.nbt_3102": ["*.*"]},
87    scripts=glob.glob("scripts/*.py"),
88    classifiers=CLASSIFIERS,
89    url="http://github.com/tanghaibao/goatools",
90    description="Python scripts to find enrichment of GO terms",
91    install_requires=REQUIREMENTS,
92    tests_require=["pytest", "pytest-cov", "nose"],
93)
94