Project:
CDR-Stats
Code Location:
git://github.com/Star2Billing/cdr-stats.gitmaster
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
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
# # CDR-Stats License # http://www.cdr-stats.org # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this file, # You can obtain one at http://mozilla.org/MPL/2.0/. # # Copyright (C) 2011-2012 Star2Billing S.L. # # The Initial Developer of the Original Code is # Arezqui Belaid <info@star2billing.com> # import os from setuptools import setup, find_packages from setuptools.dist import Distribution import pkg_resources import sys import re from cdr_stats import VERSION add_django_dependency = True try: pkg_resources.get_distribution('Django') add_django_dependency = False except pkg_resources.DistributionNotFound: try: import django if django.VERSION[0] >= 1 and django.VERSION[1] >= 2 and django.VERSION[2] >= 0: add_django_dependency = False except ImportError: pass Distribution({ "setup_requires": add_django_dependency and ['Django >=1.4.0'] or [] }) COMMANDS = {} try: from sphinx.setup_command import BuildDoc COMMANDS['build_sphinx'] = BuildDoc except ImportError: pass try: from sphinx_pypi_upload import UploadDoc COMMANDS['upload_sphinx'] = UploadDoc except ImportError: pass # Compile the list of packages available, because distutils doesn't have # an easy way to do this. packages, data_files, temp_data_files, addons_data_files = [], [], [], [] docs_data_files, resources_data_files = [], [] root_dir = os.path.dirname(__file__) if root_dir: os.chdir(root_dir) def parse_requirements(file_name): requirements = [] for line in open(file_name, 'r').read().split('\n'): if re.match(r'(\s*#)|(\s*$)', line): continue if re.match(r'\s*-e\s+', line): requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*)$', r'\1', line)) elif re.match(r'(\s*git)|(\s*hg)', line): pass else: requirements.append(line) return requirements def parse_dependency_links(file_name, install_flag=False): dependency_links = [] for line in open(file_name, 'r').read().split('\n'): if re.match(r'\s*-e\s+', line): dependency_links.append(re.sub(r'\s*-e\s+', '', line)) if re.match(r'(\s*git)|(\s*hg)', line): if install_flag == True: line_arr = line.split('/') line_arr_length = len(line.split('/')) pck_name = line_arr[line_arr_length - 1].split('.git') if len(pck_name) == 2: os.system('pip install -f %s %s' % (pck_name[0], line)) if len(pck_name) == 1: os.system('pip install -f %s %s' % (pck_name, line)) return dependency_links install_flag=False if sys.argv[1] == "install": install_flag = True setup( name='cdr-stats', version=VERSION.replace(' ', '-'), description='CDR-Stats is a CDR viewer for Asterisk/Freeswitch Call Data Records. It allows you to interrogate your CDR to provide reports and statistics via a simple to use, yet powerful, web interface.', long_description=open('README.rst').read(), author='Belaid Arezqui', author_email='areski@gmail.com', url='http://www.cdr-stats.org/', download_url='https://github.com/Star2Billing/cdr-stats/tarball/master', packages=find_packages(), include_package_data=True, license='MPL 2.0 License', classifiers=[ 'Development Status :: 1 - Beta', 'Environment :: Web Environment', 'Framework :: Django', 'Intended Audience :: Developers, Users', 'License :: OSI Approved :: MPL 2.0 License', 'Operating System :: OS Independent', 'Programming Language :: Python, Javascript, HTML', 'Topic :: Call Analytic Software' ], zip_safe = False, install_requires = parse_requirements('install/conf/requirements.txt'), dependency_links = parse_dependency_links('install/conf/requirements.txt', install_flag), setup_requires = [ "Django >= 1.4.0", "Sphinx >= 0.4.2", ], # devel cmdclass = COMMANDS, )
