-
Notifications
You must be signed in to change notification settings - Fork 4
/
manage.py
33 lines (26 loc) · 921 Bytes
/
manage.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
#!/usr/bin/env python
# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
import sys, os
from os import path
script_loc = os.path.abspath(os.path.dirname(sys.argv[0]))
# figure out where all the extra libs (rapidsms and contribs) are
libs=[path.join(script_loc, 'lib'), path.join(script_loc, 'apps')] # main 'rapidsms/lib'
try:
for f in os.listdir('contrib'):
pkg = path.join('contrib',f)
if path.isdir(pkg) and \
'lib' in os.listdir(pkg):
libs.append(path.abspath(path.join(pkg,'lib')))
except:
# could be several reasons:
# no 'contrib' dir, 'contrib' not a dir
# 'contrib' not readable, in any case
# ignore and leave 'libs' as just
# 'rapidsms/lib'
pass
# add extra libs to the python sys path
sys.path.extend(libs)
# import manager now that the path is correct
from rapidsms import manager
if __name__ == "__main__":
manager.start(sys.argv)