forked from glue-viz/glue
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
executable file
·121 lines (99 loc) · 3.86 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
#!/usr/bin/env python
from __future__ import print_function
from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand
from distutils.core import Command
import os
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__:
# 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__ += commit_number
try:
import pypandoc
LONG_DESCRIPTION = pypandoc.convert('README.md', 'rst')
except (IOError, ImportError):
with open('README.md') 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]
ginga_viewer = glue.plugins.ginga_viewer:setup
export_d3po = glue.plugins.export_d3po:setup
export_plotly = glue.plugins.export_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
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
[console_scripts]
glue-config = glue.config_gen:main
glue-deps = glue._deps:main
[gui_scripts]
glue = glue.main:main
"""
setup(name='glueviz',
version=__version__,
description='Multidimensional data visualzation across files',
long_description=LONG_DESCRIPTION,
author='Chris Beaumont, Thomas Robitaille',
author_email='glueviz@gmail.com',
url='http://glueviz.org',
install_requires=['numpy', 'pandas', 'astropy', 'matplotlib'],
extras_require={
'general': ['dill', 'h5py', 'scipy', 'scikit-image'],
'astro': ['PyAVM'],
'export': ['plotly']
},
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',
'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']}
)