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.
This commit is contained in:
Goffi 2019-10-08 12:10:26 +02:00
commit f7aad247c2
5 changed files with 51 additions and 47 deletions

View file

@ -17,16 +17,6 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from twisted.internet import defer
if defer.Deferred.debug:
# if we are in debug mode, we want to use ipdb instead of pdb
try:
import ipdb
import pdb
pdb.set_trace = ipdb.set_trace
pdb.post_mortem = ipdb.post_mortem
except ImportError:
pass
from zope.interface import implementer
from twisted.python import usage
@ -56,9 +46,22 @@ class SatMaker:
description = _("%s XMPP client backend") % C.APP_NAME_FULL
options = Options
def setDebugger(self):
from twisted.internet import defer
if defer.Deferred.debug:
# if we are in debug mode, we want to use ipdb instead of pdb
try:
import ipdb
import pdb
pdb.set_trace = ipdb.set_trace
pdb.post_mortem = ipdb.post_mortem
except ImportError:
pass
def makeService(self, options):
from twisted.internet import gireactor
gireactor.install()
self.setDebugger()
# XXX: SAT must be imported after log configuration, because it write stuff to logs
initialise(options.parent)
from sat.core.sat_main import SAT