-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathsetup.py
76 lines (63 loc) · 2.05 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
#!/usr/bin/env python
"""Setup file for cassandra-toolbox.
Execute `setup.py install` to install the latest cassandra-toolbox scripts
into your environment. You can also execute `setup.py sdist` or
`setup.py bdist` to generate source and binary distributions.
"""
import glob
from setuptools import find_packages, setup
import warnings
def get_readme():
"""Get the README from the current directory.
**Args:**
None
**Returns:**
str: String is empty if no README file exists.
"""
all_readmes = sorted(glob.glob("README*"))
if len(all_readmes) > 1:
warnings.warn(
"There seems to be more than one README in this directory."
"Choosing the first in lexicographic order."
)
if len(all_readmes) > 0:
return open(all_readmes[0], 'r').read()
warnings.warn("There doesn't seem to be a README in this directory.")
return ""
def parse_requirements(filename):
"""Parse a requirements file .
Parser ignores comments and -r inclusions of other files.
**Args:**
filename (str): Path of the requirements file to be parsed
**Returns:**
list<str>: List of PKG=VERSION strings
"""
reqs = []
with open(filename, 'r') as f:
for line in f:
hash_idx = line.find('#')
if hash_idx >= 0:
line = line[:hash_idx]
line = line.strip()
reqs.append(line)
return reqs
setup(
name="cassandra-toolbox",
version='0.1.5',
author="Knewton Database Team",
author_email="[email protected]",
license="Apache2",
url="https://github.com/Knewton/cassandra-toolbox",
packages=find_packages(),
install_requires=parse_requirements('requirements.txt'),
include_package_data=True,
scripts=[
'cassandra-toolbox/cassandra-stat',
'cassandra-toolbox/cassandra-tracing'
],
description=(
"A suite of tools for Cassandra - A highly scalable distributed "
"NoSQL datastore."
),
long_description="\n" + get_readme()
)