-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
114 lines (95 loc) · 4.01 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
106
107
108
109
110
111
112
113
114
"""A setup script for APEL.
This script installs the APEL library, client, parsers and server. This
should be similar to installing the RPMs for apel-lib, apel-client,
apel-parsers, and apel-server, although there may be some differences.
A known difference is the RPM installs pyc and pyo files,
whereas this script does not.
Usage: 'python setup.py install'
Requires setuptools.
"""
from os import remove, path, makedirs
from shutil import copyfile
import sys
from setuptools import setup, find_packages
from apel import __version__
def main():
"""Called when run as script, e.g. 'python setup.py install'."""
if 'install' in sys.argv:
# Create temporary files with deployment names
copyfile('bin/client.py', 'bin/apelclient')
copyfile('bin/parser.py', 'bin/apelparser')
copyfile('bin/dbloader.py', 'bin/apeldbloader')
copyfile('bin/dbunloader.py', 'bin/apeldbunloader')
copyfile('bin/summariser.py', 'bin/apelsummariser')
copyfile('bin/retrieve_dns.py', 'bin/apelauth')
if not path.exists('/var/log/apel'):
makedirs('/var/log/apel')
if not path.exists('/var/run/apel'):
makedirs('/var/run/apel')
# conf_files will later be copied to conf_dir
conf_dir = '/etc/apel/'
conf_files = ['conf/client.cfg',
'conf/summariser.cfg',
'conf/unloader.cfg',
'conf/loader.cfg',
'conf/db.cfg',
'conf/parser.cfg',
'conf/auth.cfg']
# schema_files, update_scripts, accounting_files,
# and message_files will later be copied to data_dir
data_dir = '/usr/share/apel'
schema_files = ['schemas/client.sql',
'schemas/server.sql',
'schemas/server-extra.sql',
'schemas/cloud.sql',
'schemas/storage.sql']
update_scripts = ['scripts/update_schema.sql']
accounting_files = ['scripts/slurm_acc.sh', 'scripts/htcondor_acc.sh']
message_files = ['scripts/msg_status.py']
# log_rotate_files will later be copied to log_rotate_dir
log_rotate_dir = '/etc/logrotate.d'
log_rotate_files = ['scripts/apel-client']
# For 'python setup.py install' to
# work (on Linux SL6), 'python-daemon'
# must be installed or included
# in install_required
setup(name='apel',
version='%i.%i.%i' % __version__,
description=("The APEL project provides grid accounting for EGI."),
author='APEL',
author_email='[email protected]',
url='http://apel.github.io/',
download_url='https://github.com/apel/apel/releases',
license='Apache License, Version 2.0',
install_requires=['MySQL-python', 'iso8601', 'python-ldap', 'dirq'],
extras_require={
'python-daemon': ['python-daemon'],
},
packages=find_packages(exclude=['bin']),
scripts=['bin/apelclient',
'bin/apelparser',
'bin/apeldbloader',
'bin/apeldbunloader',
'bin/apelsummariser',
'bin/apelauth'],
data_files=[(conf_dir, conf_files),
(data_dir, schema_files),
(data_dir, accounting_files),
(data_dir, message_files),
(data_dir, update_scripts),
(log_rotate_dir, log_rotate_files)],
# zip_safe allows setuptools to install the project
# as a zipfile, for maximum performance!
# We have disabled this feature so installing via the setup
# script is similar to installing the RPM apel-ssm
zip_safe=False)
# Remove temporary files with deployment names
if 'install' in sys.argv:
remove('bin/apelclient')
remove('bin/apelparser')
remove('bin/apeldbloader')
remove('bin/apeldbunloader')
remove('bin/apelsummariser')
remove('bin/apelauth')
if __name__ == "__main__":
main()