-
Notifications
You must be signed in to change notification settings - Fork 6
/
setup.py
100 lines (87 loc) · 3.47 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
from __future__ import print_function
try:
# use setuptools if we can
from setuptools import setup
using_setuptools = True
except ImportError:
from distutils.core import setup
using_setuptools = False
import glob
import os
import sys
import shutil
with open("rt_eqcorrscan/__init__.py", "r") as init_file:
version_line = [line for line in init_file
if '__version__' in line][0]
VERSION = version_line.split()[-1].split("'")[1]
long_description = '''
Real-time EQcorrscan: Real-time wrappers for EQcorrscan's earthquake detection
methods.
'''
# Scripts need to have a `main` function
scriptfiles = [
f for f in glob.glob(os.path.join("rt_eqcorrscan", "console_scripts", "*"))
if os.path.isfile(f) and os.path.split(f)[-1] != "__init__.py"]
scriptnames = [os.path.split(f)[-1].rstrip(".py").replace("_", "-")
for f in scriptfiles]
console_entry_points = [
f"rteqcorrscan-{name}=rt_eqcorrscan.console_scripts."
f"{name.replace('-', '_')}:main" for name in scriptnames]
def setup_package():
# Figure out whether to add ``*_requires = ['numpy']``.
build_requires = []
try:
import numpy
except ImportError:
build_requires = ['numpy>=1.6, <2.0']
install_requires = [
'numpy>=1.12', 'matplotlib>=1.3.0', 'scipy>=0.18', 'LatLon',
'bottleneck', 'bokeh', 'obspy>=1.0.3', 'h5py', 'eqcorrscan>=0.3.0',
'obsplus']
setup_args = {
'name': 'RT-EQcorrscan',
'version': VERSION,
'description': 'RT-EQcorrscan - Real-time matched-filter detection',
'long_description': long_description,
'url': 'https://github.com/calum-chamberlain/EQcorrscan',
'author': 'Calum Chamberlain',
'author_email': '[email protected]',
'license': 'LGPL',
'classifiers': [
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'Topic :: Scientific/Engineering',
'License :: OSI Approved :: GNU Library or Lesser General Public '
'License (LGPL)',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
],
'keywords': 'real-time earthquake correlation detection match-filter',
'entry_points': {'console_scripts': console_entry_points},
'install_requires': install_requires,
'setup_requires': ['pytest-runner'],
'tests_require': ['pytest>=2.0.0', 'pytest-cov', 'pytest-pep8',
'pytest-xdist', 'pytest-rerunfailures',
'obspy>=1.1.0'],
}
if using_setuptools:
setup_args['setup_requires'] = build_requires
setup_args['install_requires'] = install_requires
if len(sys.argv) >= 2 and (
'--help' in sys.argv[1:] or
sys.argv[1] in ('--help-commands', 'egg_info', '--version',
'clean')):
# For these actions, NumPy is not required.
pass
else:
setup_args['packages'] = [
'rt_eqcorrscan', 'rt_eqcorrscan.config', 'rt_eqcorrscan.database',
'rt_eqcorrscan.event_trigger', 'rt_eqcorrscan.plotting',
'rt_eqcorrscan.reactor', 'rt_eqcorrscan.streaming',
'rt_eqcorrscan.streaming.clients', 'rt_eqcorrscan.console_scripts']
if os.path.isdir("build"):
shutil.rmtree("build")
setup(**setup_args)
if __name__ == '__main__':
setup_package()