-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
105 lines (97 loc) · 3.22 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
from setuptools import setup, find_packages
import os
import re
import tempfile
def read_version():
source_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'cedexis/radar/__init__.py')
with open(source_path) as fp:
source = fp.read()
major_match = re.search('__sampler_major_version__\s*=\s*(\d+)', source)
minor_match = re.search('__sampler_minor_version__\s*=\s*(\d+)', source)
micro_match = re.search('__sampler_micro_version__\s*=\s*(\d+)', source)
suffix_match = re.search('__version_suffix__\s*=\s*[\'"]([-\w\d]+)[\'"]', source)
suffix = ''
if not suffix_match is None:
suffix = suffix_match.group(1)
return '{}.{}.{}{}'.format(
major_match.group(1),
minor_match.group(1),
micro_match.group(1),
suffix,
)
def read_file(file_path):
"""
Read a file relative to the directory containing this file
"""
root_dir = os.path.dirname(os.path.abspath(__file__))
file_path = os.path.join(root_dir, file_path)
with open(file_path) as fp:
content = fp.read()
try:
return content.decode('utf-8').strip()
except AttributeError:
return content.strip()
long_description = '\n\n'.join([
read_file('README.rst'),
read_file('CHANGES.rst'),
])
#temp_file_handle, temp_file_path = tempfile.mkstemp(suffix='.rst')
#with open(temp_file_path, 'w') as fp:
# fp.write(long_description)
#print('PyPI documentation written to: {}'.format(temp_file_path))
# See http://docs.python.org/3.3/distutils/apiref.html#module-distutils.core
# for help with setup keyword arguments
setup_kwargs = {
# http://www.python.org/dev/peps/pep-0423/#use-a-single-name
'name': 'cedexis.radar',
'version': read_version(),
'description': 'Cedexis Radar client library',
'long_description': long_description,
'classifiers': [
'Development Status :: 3 - Alpha',
'Environment :: Console',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: IronPython',
'Topic :: Internet',
'Topic :: Internet :: WWW/HTTP',
'Topic :: Software Development :: Libraries :: Python Modules',
],
'keywords': [
'cedexis',
'radar',
'internet',
'dns',
'cdn',
'cloud',
'load balancing',
'availability',
'rtt',
'mobile',
],
'url': 'https://github.com/cedexis/cedexis.radar',
'author': 'Jacob Wan',
'author_email': '[email protected]',
'license': 'MIT',
'packages': find_packages(),
'namespace_packages': [
'cedexis',
],
'tests_require': [
'nose'
],
'test_suite': 'nose.collector',
'entry_points': {
'console_scripts': [
'cedexis-radar-cli=cedexis.radar.cli:main',
],
},
'zip_safe': True,
}
setup(**setup_kwargs)