1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 """
18 This module provides access to the singleton application and a L{boot}
19 function which initializes the global application execution
20 environment.
21
22 @var application: the Elisa application
23 @type application: L{elisa.core.application.Application}
24 @var booted: has execution environment been initialized by calling L{boot}?
25 @type booted: bool
26 """
27
28 __maintainer__ = 'Philippe Normand <philippe@fluendo.com>'
29
30 import sys
31
32 application = None
33
35 """
36 Set the L{application} singleton's value. Overrides previous value.
37
38 @param app: the new singleton's value
39 @type app: L{Application}
40 """
41 global application
42 application = app
43
44 booted = False
45 from_test = False
46
48 """
49 Initializes the global application execution. Can't be called more
50 than once.
51
52 - install Twisted's glib2reactor
53 - initialize the logging framework
54 - clean namespace regarding pygst import
55
56 """
57 global booted
58 global from_test
59 log_to_file = False
60
61 if not booted:
62
63 if not from_test:
64 try:
65
66 from twisted.internet import glib2reactor
67 glib2reactor.install()
68 except AssertionError:
69 pass
70
71 from elisa.core import log
72
73 if 'gst' in sys.modules:
74 del sys.modules['gst']
75
76 import pygst
77 pygst.require('0.10')
78
79 if '-l' in sys.argv:
80 log_to_file = True
81
82 log.init(log_to_file)
83 log.logTwisted()
84
85 booted = True
86