forked from grepory/metrilyx-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
78 lines (65 loc) · 2.49 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
import os
import sys
import fnmatch
from setuptools import setup, find_packages
from pprint import pprint
DESCRIPTION = '''
A web based dashboard engine to OpenTSDB that allows for analyzing,
cross cutting and viewing of time series data in a simple manner.
'''
LICENSE = "LICENSE.txt"
SETUP_REQUIRES = ["six>=1.7.3"]
INSTALL_REQUIRES = [ p for p in open('requirements.txt').read().split('\n') if p != '' and not p.startswith('#') ]
def get_version():
fh = open('VERSION')
version = fh.read().strip("\n").strip()
fh.close()
return version
def fileListBuilder(dirPath, regexp='*'):
matches = []
for root, dirnames, filenames in os.walk(dirPath):
for filename in fnmatch.filter(filenames, regexp):
matches.append(os.path.join(root, filename))
return matches
def recursiveFileListBuilder(dirPath, prefix):
mine = {}
for root, dirnames, filenames in os.walk('www'):
if not mine.has_key(root):
mine[root] = []
for filename in fnmatch.filter(filenames, '[!.]*'):
mine[root].append(filename)
out = []
for k, values in mine.items():
out.append((prefix+k, [ k+'/'+val for val in values ]))
return out
DATA_FILES = [
('/etc/init.d', fileListBuilder('etc/init.d')),
('/opt/metrilyx/docs', fileListBuilder('docs')),
('/opt/metrilyx/bin', fileListBuilder('bin')),
('/opt/metrilyx/etc/metrilyx/schemas', fileListBuilder('etc/metrilyx/schemas')),
('/opt/metrilyx/data', [
'data/metrilyx.sqlite3.default']),
('/opt/metrilyx/etc/metrilyx', [
'etc/metrilyx/ess-default-mappings.json',
'etc/metrilyx/metrilyx.conf.sample',
'etc/metrilyx/uwsgi.conf',
'etc/metrilyx/uwsgi_params.conf']),
('/etc/sysconfig', ['etc/sysconfig/metrilyx-cacher']),
('/etc/nginx/conf.d', ['etc/nginx/conf.d/metrilyx.conf'])
]
## Re-create webroot directory structure
DATA_FILES += recursiveFileListBuilder('www', prefix='/opt/metrilyx/')
setup(
name='metrilyx',
version=get_version(),
url='https://github.com/TicketMaster/metrilyx-2.0.git',
description=DESCRIPTION,
long_description=DESCRIPTION,
author='euforia',
author_email='[email protected]',
license=LICENSE,
setup_requires=SETUP_REQUIRES,
install_requires=INSTALL_REQUIRES,
data_files=DATA_FILES,
packages=find_packages()
)