forked from glue-viz/glue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·161 lines (135 loc) · 4.98 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup, find_packages
from distutils.core import Command
import os
import re
import sys
import subprocess
# Generate version.py
with open('glue/version.py') as infile:
exec(infile.read())
# If the version is not stable, we can add a git hash to the __version__
if '.dev' in __version__: # noqa
# Find hash for __githash__ and dev number for __version__ (can't use hash
# as per PEP440)
command_hash = 'git rev-list --max-count=1 --abbrev-commit HEAD'
command_number = 'git rev-list --count HEAD'
try:
commit_hash = subprocess.check_output(
command_hash, shell=True).decode('ascii').strip()
commit_number = subprocess.check_output(
command_number, shell=True).decode('ascii').strip()
except Exception:
pass
else:
# We write the git hash and value so that they gets frozen if installed
with open(os.path.join('glue', '_githash.py'), 'w') as f:
f.write("__githash__ = \"{githash}\"\n".format(
githash=commit_hash))
f.write("__dev_value__ = \"{dev_value}\"\n".format(
dev_value=commit_number))
# We modify __version__ here too for commands such as egg_info
__version__ = re.sub('\.dev[^"]*', '.dev{0}'.format(commit_number),
__version__) # noqa
with open('README.rst') as infile:
LONG_DESCRIPTION = infile.read()
cmdclass = {}
class PyTest(Command):
user_options = [('pytest-args=', 'a', "Arguments to pass to py.test")]
def initialize_options(self):
self.pytest_args = ""
def finalize_options(self):
pass
def run(self):
# import here, cause outside the eggs aren't loaded
import pytest
errno = pytest.main(self.pytest_args + ' glue')
sys.exit(errno)
cmdclass['test'] = PyTest
# Define built-in plugins
entry_points = """
[glue.plugins]
export_d3po = glue.plugins.export_d3po:setup
export_plotly = glue.plugins.exporters.plotly:setup
pv_slicer = glue.plugins.tools.pv_slicer:setup
spectrum_tool = glue.plugins.tools.spectrum_tool:setup
coordinate_helpers = glue.plugins.coordinate_helpers:setup
spectral_cube = glue.plugins.data_factories.spectral_cube:setup
dendro_viewer = glue.plugins.dendro_viewer:setup
image_viewer = glue.viewers.image:setup
scatter_viewer = glue.viewers.scatter:setup
histogram_viewer = glue.viewers.histogram:setup
table_viewer = glue.viewers.table:setup
data_exporters = glue.core.data_exporters:setup
[console_scripts]
glue-config = glue.config_gen:main
glue-deps = glue._deps:main
[gui_scripts]
glue = glue.main:main
"""
# Glue can work with PyQt4, PyQt5, and PySide. We can't add them to
# install_requires because they aren't on PyPI but we can check here that one of
# them is installed.
try:
import PyQt5 # noqa
except:
try:
import PyQt4 # noqa
except:
try:
import PySide # noqa
except:
print("Glue requires PyQt4, PyQt5, or PySide to be installed")
sys.exit(1)
install_requires = ['numpy>=1.9',
'pandas>=0.14',
'astropy>=1.3',
'matplotlib>=1.4',
'qtpy>=1.1',
'setuptools>=1.0',
'ipython>=4.0',
'ipykernel',
'qtconsole',
'dill>=0.2',
'xlrd>=1.0',
'h5py>=2.4']
extras_require = {
'recommended': ['scipy',
'scikit-image',
'plotly'],
'astronomy': ['PyAVM',
'astrodendro',
'spectral-cube']
}
extras_require['all'] = (extras_require['recommended'] +
extras_require['astronomy'])
setup(name='glue-core',
version=__version__,
description='Multidimensional data visualzation across files',
long_description=LONG_DESCRIPTION,
author='Chris Beaumont, Thomas Robitaille',
author_email='[email protected]',
url='http://glueviz.org',
install_requires=install_requires,
extras_require=extras_require,
classifiers=[
'Intended Audience :: Science/Research',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Topic :: Scientific/Engineering :: Visualization',
'License :: OSI Approved :: BSD License'
],
packages=find_packages(),
entry_points=entry_points,
cmdclass=cmdclass,
package_data={'': ['*.png', '*.ui', '*.glu', '*.hdf5', '*.fits',
'*.xlsx', '*.txt']}
)