-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
134 lines (118 loc) · 4.2 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
"""Setuptools magic to install antiSMASH."""
import glob
import os
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
import subprocess
import sys
def read(fname):
"""Read a file from the current directory."""
return open(os.path.join(os.path.dirname(__file__), fname)).read()
long_description = read('README.md')
install_requires = [
'numpy',
'biopython == 1.78',
'helperlibs',
'jinja2',
'joblib',
'jsonschema',
'markupsafe >= 2.0',
'pysvg-py3',
'bcbio-gff',
'pyScss',
'matplotlib',
'scipy',
'scikit-learn >= 0.19.0',
]
tests_require = [
'pytest >= 3.4.0, < 5', # pytest 5 breaks compatibility with coverage
'coverage',
'pylint == 2.10.2',
'mypy == 0.910', # for consistent type checking
]
def read_version():
"""Read the version fromt he appropriate place in the library."""
for line in open(os.path.join('antismash', 'main.py'), 'r'):
if line.startswith('__version__'):
return line.split('=')[-1].strip().strip('"')
def find_data_files():
"""Setuptools package_data globbing is stupid, so make this work ourselves."""
data_files = []
for pathname in glob.glob("antismash/**/*", recursive=True):
if pathname.endswith('.pyc'):
continue
if pathname.endswith('.py'):
continue
if '__pycache__' in pathname:
continue
if pathname[:-1].endswith('.hmm.h3'):
continue
if pathname.endswith('bgc_seeds.hmm'):
continue
pathname = glob.escape(pathname)
pathname = pathname[10:]
data_files.append(pathname)
if "HARDCODE_ANTISMASH_GIT_VERSION" in os.environ:
version_file = os.path.join('antismash', 'git_hash')
with open(version_file, 'wt') as handle:
try:
git_version = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'],
universal_newlines=True).strip()
changes = subprocess.check_output(['git', 'status', '--porcelain'],
universal_newlines=True).splitlines()
if len(changes) != 0:
git_version += "(changed)"
handle.write(git_version)
except (OSError, subprocess.CalledProcessError):
pass
data_files.append(version_file)
return data_files
class PyTest(TestCommand):
"""Allow running tests via python setup.py test."""
def finalize_options(self):
"""Test command magic."""
TestCommand.finalize_options(self)
self.test_args = []
self.test_suite = True
def run_tests(self):
"""Run tests."""
import pytest
errcode = pytest.main(self.test_args)
sys.exit(errcode)
setup(
name="antismash",
python_requires='>=3.7',
version=read_version(),
packages=find_packages(exclude=["*.tests", "*.tests.*", "tests.*", "tests"]),
package_data={
'antismash': find_data_files(),
},
author='antiSMASH development team',
author_email='[email protected]',
description='The antibiotics and Secondary Metabolites Analysis Shell.',
long_description=long_description,
long_description_content_type='text/markdown',
install_requires=install_requires,
tests_require=tests_require,
entry_points={
'console_scripts': [
'download-antismash-databases=antismash.download_databases:_main',
'antismash=antismash.__main__:entrypoint',
],
},
cmdclass={'test': PyTest},
url='https://github.com/antismash/antismash',
license='GNU Affero General Public License v3 or later (AGPLv3+)',
classifiers=[
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Development Status :: 3 - Alpha',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering :: Bio-Informatics',
'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)',
'Operating System :: OS Independent',
],
extras_require={
'testing': tests_require,
},
)