forked from jookies/jasmin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
88 lines (79 loc) · 3.37 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
import getpass
import grp
import os
import pwd
import sys
from setuptools import setup, find_packages
def parse_requirements(filename):
"""load requirements from a pip requirements file"""
lineiter = (line.strip() for line in open(filename))
return [line for line in lineiter if line and (not line.startswith("#") and not line.startswith('-'))]
# After passing on travis docker-based ci, sudo is no more
# used, ROOT_PATH is a env variable set in .travis.yml to avoid
# installing things system wide.
ROOT_PATH = os.getenv('ROOT_PATH', '/')
# Pre-installation checklist
if "install" in sys.argv:
# 1. Check if jasmin user and group were created
try:
pwd.getpwnam('jasmin')
grp.getgrnam('jasmin')
except KeyError:
print('WARNING: jasmin user or group not found !')
# 2. Check if system folders are created
sysdirs = ['%s/etc/jasmin' % ROOT_PATH,
'%s/etc/jasmin/resource' % ROOT_PATH,
'%s/etc/jasmin/store' % ROOT_PATH,
'%s/var/log/jasmin' % ROOT_PATH, ]
for sysdir in sysdirs:
if not os.path.exists(sysdir):
print('WARNING: %s does not exist !' % sysdir)
# 3. Check for permission to write jasmin.cfg in /etc/jasmin/store
if not os.access('%s/etc/jasmin/store' % ROOT_PATH, os.W_OK):
print('WARNING: %s/etc/jasmin/store must be writeable by the current user (%s)' % (
ROOT_PATH, getpass.getuser()))
# 4. Check if sysdirs are owned by jasmin user
for sysdir in sysdirs[3:]:
if os.path.exists(sysdir) and pwd.getpwuid(os.stat(sysdir).st_uid).pw_name != 'jasmin':
print ('WARNING: %s is not owned by jasmin user !' % sysdir)
# Dynamically calculate the version based on jasmin.RELEASE.
release = __import__('jasmin').get_release()
setup(
name="jasmin",
version=release,
author="Jookies LTD",
author_email="[email protected]",
url="http://www.jasminsms.com",
license="Apache v2.0",
description=('Jasmin is a very complete open source SMS Gateway '
'with many enterprise-class features.'),
long_description=open('README.rst', 'r').read(),
keywords=['jasmin', 'sms', 'messaging', 'smpp', 'smsc', 'smsgateway'],
packages=find_packages(),
scripts=['jasmin/bin/jasmind.py', 'jasmin/bin/interceptord.py', 'jasmin/bin/dlrd.py', 'jasmin/bin/dlrlookupd.py'],
include_package_data=True,
install_requires=parse_requirements('install-requirements'),
tests_require=parse_requirements('test-requirements'),
classifiers=[
'Development Status :: 5 - Production/Stable',
'Framework :: Twisted',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: POSIX',
'Programming Language :: Python :: 2 :: Only',
'Programming Language :: Python :: 2.7',
'Topic :: Software Development :: Libraries :: Python Modules',
'Topic :: System :: Networking',
'Topic :: Communications',
'Topic :: Communications :: Telephony',
],
platforms='POSIX',
data_files=[
('%s/etc/jasmin' % ROOT_PATH, ['misc/config/jasmin.cfg']),
('%s/etc/jasmin/resource' % ROOT_PATH, [
'misc/config/resource/amqp0-8.stripped.rabbitmq.xml',
'misc/config/resource/amqp0-9-1.xml'
],),
('%s/etc/jasmin/store' % ROOT_PATH, []),
],
)