forked from apache/flagon-distill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
156 lines (135 loc) · 4.31 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
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import setuptools
import io
import os
import sys
if sys.version_info[:2] < (2, 7):
m = "Python 2.7 or later is required for Distill (%d.%d detected)."
raise ImportError(m % sys.version_info[:2])
if sys.argv[-1] == 'setup.py':
print("To install, run 'python setup.py install'\n")
print("To run tests, run 'python setup.py test'\n")
print("To build docs, run 'python setup.py docs'\n")
print("To clean, run 'python setup.py clean'\n")
class CleanCommand(setuptools.Command):
"""
A command class to clean up build artifacts, including log files
python setup.py clean
"""
description = "clean build artifacts"
user_options = []
def initialize_options(self):
"""
Initialize Clean Command
"""
self.cwd = None
def finalize_options(self):
"""
Set Current Working directory for Clean Command
"""
self.cwd = os.getcwd()
def run(self):
"""
Execute Clean Command
"""
assert os.getcwd() == self.cwd, 'Must be in package root: %s' % self.cwd
os.system('rm -rf ./docs/_build ./build ./dist ./*.egg-info')
os.system('rm -rf ./*.log *.xml .coverage *.html')
def read(*filenames, **kwargs):
encoding = kwargs.get('encoding', 'utf-8')
sep = kwargs.get('sep', '\n')
buf = []
for filename in filenames:
with io.open(filename, encoding=encoding) as f:
buf.append(f.read())
return sep.join(buf)
# Get the version string
def get_version():
basedir = os.path.dirname(__file__)
with open(os.path.join(basedir, 'distill/version.py')) as f:
version = {}
exec (f.read(), version)
return version['__version__']
raise RuntimeError('No version info found.')
setup_requires = [
'pip >= 9.0.1',
'setuptools >= 34.0',
'pytest-runner',
]
install_requires = [
'elasticsearch-dsl >= 5.0.0, < 6.0.0',
# 'pandas >= 0.20.2',
'Flask >= 0.12.2',
'celery >= 4.0.2',
]
tests_require = [
'pytest >= 3.0.0',
'pytest-pylint',
'pytest-html',
'pytest-cov',
]
docs_require = [
'Sphinx >= 1.5.2',
'sphinx-rtd-theme >= 0.1.9',
]
extras_require = {
'test' : tests_require,
'doc' : docs_require,
'monitor': [
'flower'
]
}
classifiers = [
'Development Status :: 4 - Beta',
'Intended Audience :: Developers',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: Apache Software License',
'Natural Language :: English',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.5',
'Environment :: Web Environment',
'Framework :: Flask',
'Topic :: Internet :: Log Analysis'
]
setuptools.setup(
name="Distill",
version=get_version(),
url="http://senssoft.incubator.apache.org",
license="Apache Software License 2.0",
author="Michelle Beard",
author_email="[email protected]",
description="An analytical framework for UserALE and TAP.",
long_description=__doc__,
classifiers=classifiers,
keywords="stout userale tap distill",
packages=setuptools.find_packages(exclude=['examples', 'tests']),
include_package_data=True,
zip_safe=False,
cmdclass={
'clean': CleanCommand,
},
setup_requires=setup_requires,
tests_require=tests_require,
install_requires=install_requires,
extras_require=extras_require,
entry_points={
'console_scripts': [
'dev = distill.server:dev_server'
]
}
)