Translated using Weblate.
[gammu.git] / python / gammu / __init__.py
blob166c8335caac83fb0721e118110dec4d34005f31
1 # -*- coding: UTF-8 -*-
2 # vim: expandtab sw=4 ts=4 sts=4:
3 '''
4 Phone communication libary - python wrapper for Gammu library.
5 '''
6 __author__ = 'Michal Čihař'
7 __email__ = 'michal@cihar.com'
8 __license__ = '''
9 Copyright © 2003 - 2010 Michal Čihař
11 This program is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License version 2 as published by
13 the Free Software Foundation.
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 more details.
20 You should have received a copy of the GNU General Public License along with
21 this program; if not, write to the Free Software Foundation, Inc.,
22 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23 '''
25 # Submodules
26 __all__ = [
27 'data',
28 'worker',
29 'smsd',
30 'exception',
33 # Import core library, we need to load it into global namespace
34 # as otherwise libdbi plugins fail to find some symbols
35 import sys
36 if not hasattr(sys,'getdlopenflags'):
37 from gammu._gammu import *
38 else:
39 try:
40 from dl import RTLD_GLOBAL, RTLD_NOW
41 except ImportError:
42 RTLD_GLOBAL = -1
43 RTLD_NOW = -1
44 try:
45 import os
46 osname = os.uname()[0]
47 if osname == 'Linux' or osname == 'SunOS':
48 RTLD_GLOBAL = 0x00100
49 RTLD_NOW = 0x00002
50 elif osname == 'Darwin':
51 RTLD_GLOBAL = 0x8
52 RTLD_NOW = 0x2
53 except:
54 pass
56 if RTLD_GLOBAL != -1 and RTLD_NOW != -1:
57 try:
58 flags = sys.getdlopenflags()
59 sys.setdlopenflags(RTLD_GLOBAL | RTLD_NOW)
60 try:
61 from gammu._gammu import *
62 finally:
63 sys.setdlopenflags(flags)
64 except:
65 from gammu._gammu import *
66 else:
67 from gammu._gammu import *
68 del RTLD_GLOBAL
69 del RTLD_NOW
71 __version__ = 'Gammu %s, python-gammu %s' % (
72 Version()[0],
73 Version()[1]