-
Notifications
You must be signed in to change notification settings - Fork 190
/
setup.py
88 lines (70 loc) · 2.42 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
#!/usr/bin/python
import os
import re
from setuptools import setup
classifiers = [
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
'Intended Audience :: System Administrators',
'Environment :: Console',
'License :: OSI Approved :: Apache Software License',
'Programming Language :: Python :: 2 :: Only',
'Programming Language :: Python :: 2.7',
'Topic :: System :: Systems Administration',
'Topic :: Database',
'Topic :: Text Processing',
'Topic :: Internet',
'Topic :: Utilities',
]
def read_file(*paths):
here = os.path.dirname(os.path.abspath(__file__))
with open(os.path.join(here, *paths)) as f:
return f.read()
src_file = read_file('es2csv_cli.py')
url = 'https://github.com/taraslayshchuk/es2csv'
def get_version():
"""
Pull version from module without loading module first. This was lovingly
collected and adapted from
https://github.com/pypa/virtualenv/blob/12.1.1/setup.py#L67.
"""
version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]",
src_file, re.M)
if version_match:
return version_match.group(1)
raise RuntimeError("Unable to find version string.")
def get_description():
try:
return src_file.split('\n')[2].split(':')[1].strip()
except:
raise RuntimeError("Unable to find description string.")
version = get_version()
with open('README.rst') as file_readme:
readme = file_readme.read()
readme = re.sub(r'.(/docs/[A-Z]+.rst)', r'%s/blob/%s\1' % (url, version), readme)
with open('docs/HISTORY.rst') as history_file:
history = history_file.read()
with open('requirements.txt') as file_requirements:
requirements = file_requirements.read().splitlines()
settings = dict()
settings.update(
name='es2csv',
version=version,
description=get_description(),
long_description='%s\n\n%s' % (readme, history),
author='Taras Layshchuk',
author_email='taraslayshchuk@gmail.com',
license='Apache 2.0',
url=url,
classifiers=classifiers,
python_requires='==2.7.*',
keywords='elasticsearch export kibana es bulk csv',
py_modules=['es2csv', 'es2csv_cli'],
entry_points={
'console_scripts': [
'es2csv = es2csv_cli:main'
]
},
install_requires=requirements,
)
setup(**settings)