Mercurial > libervia-backend
comparison twisted/plugins/sat_plugin.py @ 3053:8b36e5c3f28f
misc: don't import memory in launch script:
launch script was importing a method from memory (fixLocalDir), but memory is importing
twisted.internet.reactor which can result to a ReactorAlreadyInstalledError.
This patch fixes it by moving fixLocalDir to tools/config.
The launch script is now using /usr/bin/env.
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 08 Oct 2019 12:10:26 +0200 |
parents | fee60f17ebac |
children | 2180b0f5c1cd |
comparison
equal
deleted
inserted
replaced
3052:60a63723ecea | 3053:8b36e5c3f28f |
---|---|
15 # GNU Affero General Public License for more details. | 15 # GNU Affero General Public License for more details. |
16 | 16 |
17 # You should have received a copy of the GNU Affero General Public License | 17 # You should have received a copy of the GNU Affero General Public License |
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. | 18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 | 19 |
20 from twisted.internet import defer | |
21 if defer.Deferred.debug: | |
22 # if we are in debug mode, we want to use ipdb instead of pdb | |
23 try: | |
24 import ipdb | |
25 import pdb | |
26 pdb.set_trace = ipdb.set_trace | |
27 pdb.post_mortem = ipdb.post_mortem | |
28 except ImportError: | |
29 pass | |
30 | 20 |
31 from zope.interface import implementer | 21 from zope.interface import implementer |
32 from twisted.python import usage | 22 from twisted.python import usage |
33 from twisted.plugin import IPlugin | 23 from twisted.plugin import IPlugin |
34 from twisted.application.service import IServiceMaker | 24 from twisted.application.service import IServiceMaker |
54 | 44 |
55 tapname = C.APP_NAME_FILE | 45 tapname = C.APP_NAME_FILE |
56 description = _("%s XMPP client backend") % C.APP_NAME_FULL | 46 description = _("%s XMPP client backend") % C.APP_NAME_FULL |
57 options = Options | 47 options = Options |
58 | 48 |
49 def setDebugger(self): | |
50 from twisted.internet import defer | |
51 if defer.Deferred.debug: | |
52 # if we are in debug mode, we want to use ipdb instead of pdb | |
53 try: | |
54 import ipdb | |
55 import pdb | |
56 pdb.set_trace = ipdb.set_trace | |
57 pdb.post_mortem = ipdb.post_mortem | |
58 except ImportError: | |
59 pass | |
60 | |
59 def makeService(self, options): | 61 def makeService(self, options): |
60 from twisted.internet import gireactor | 62 from twisted.internet import gireactor |
61 gireactor.install() | 63 gireactor.install() |
64 self.setDebugger() | |
62 # XXX: SAT must be imported after log configuration, because it write stuff to logs | 65 # XXX: SAT must be imported after log configuration, because it write stuff to logs |
63 initialise(options.parent) | 66 initialise(options.parent) |
64 from sat.core.sat_main import SAT | 67 from sat.core.sat_main import SAT |
65 return SAT() | 68 return SAT() |
66 | 69 |