diff --git a/frontends/src/jp/jp b/frontends/src/jp/jp
index 9b6dd2ff..11b4bcc9 100755
--- a/frontends/src/jp/jp
+++ b/frontends/src/jp/jp
@@ -54,7 +54,7 @@ from optparse import OptionParser
import pdb
from tools.jid import JID
import gobject
-from sat_bridge_frontend.DBus import DBusBridgeFrontend,BridgeExceptionNoService
+from sat_frontends.bridge.DBus import DBusBridgeFrontend,BridgeExceptionNoService
import tarfile
try:
from progressbar import ProgressBar, Percentage, Bar, ETA, FileTransferSpeed
diff --git a/frontends/src/primitivus/__init__.py b/frontends/src/primitivus/__init__.py
new file mode 100644
index 00000000..e69de29b
diff --git a/frontends/src/primitivus/card_game.py b/frontends/src/primitivus/card_game.py
index 1555c7fc..a4f564c1 100644
--- a/frontends/src/primitivus/card_game.py
+++ b/frontends/src/primitivus/card_game.py
@@ -20,10 +20,10 @@ along with this program. If not, see .
"""
import urwid
-from tools.games import TarotCard
-from quick_frontend.quick_card_game import QuickCardGame
-from xmlui import XMLUI
from urwid_satext import sat_widgets
+from sat.tools.games import TarotCard
+from sat_frontends.quick_frontend.quick_card_game import QuickCardGame
+from sat_frontends.primitivus.xmlui import XMLUI
class CardDisplayer(urwid.Text):
"""Show a card"""
diff --git a/frontends/src/primitivus/chat.py b/frontends/src/primitivus/chat.py
index ee8b302e..5e450bad 100644
--- a/frontends/src/primitivus/chat.py
+++ b/frontends/src/primitivus/chat.py
@@ -20,13 +20,13 @@ along with this program. If not, see .
"""
import urwid
-from quick_frontend.quick_contact_list import QuickContactList
-from quick_frontend.quick_chat import QuickChat
from urwid_satext import sat_widgets
-import time
-from tools.jid import JID
-from card_game import CardGame
from urwid_satext.files_management import FileDialog
+from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
+from sat_frontends.quick_frontend.quick_chat import QuickChat
+from sat_frontends.primitivus.card_game import CardGame
+import time
+from sat.tools.jid import JID
class ChatText(urwid.FlowWidget):
diff --git a/frontends/src/primitivus/contact_list.py b/frontends/src/primitivus/contact_list.py
index 6ce88ef4..34bc1b34 100644
--- a/frontends/src/primitivus/contact_list.py
+++ b/frontends/src/primitivus/contact_list.py
@@ -20,9 +20,9 @@ along with this program. If not, see .
"""
import urwid
-from quick_frontend.quick_contact_list import QuickContactList
-from tools.jid import JID
from urwid_satext import sat_widgets
+from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
+from sat.tools.jid import JID
class ContactList(urwid.WidgetWrap, QuickContactList):
diff --git a/frontends/src/primitivus/gateways.py b/frontends/src/primitivus/gateways.py
index 2d9e91e2..a9724025 100644
--- a/frontends/src/primitivus/gateways.py
+++ b/frontends/src/primitivus/gateways.py
@@ -21,8 +21,8 @@ along with this program. If not, see .
import urwid
from urwid_satext import sat_widgets
-from tools.jid import JID
-from quick_frontend.quick_gateways import QuickGatewaysManager
+from sat_frontends.quick_frontend.quick_gateways import QuickGatewaysManager
+from sat.tools.jid import JID
class GatewaysManager(urwid.WidgetWrap, QuickGatewaysManager):
diff --git a/frontends/src/primitivus/primitivus b/frontends/src/primitivus/primitivus
index acf14182..b8220d98 100755
--- a/frontends/src/primitivus/primitivus
+++ b/frontends/src/primitivus/primitivus
@@ -20,22 +20,22 @@ along with this program. If not, see .
"""
-from quick_frontend.quick_app import QuickApp
-from quick_frontend.quick_chat_list import QuickChatList
-from quick_frontend.quick_contact_list import QuickContactList
-from quick_frontend.quick_contact_management import QuickContactManagement
import urwid
-from profile_manager import ProfileManager
-from contact_list import ContactList
-from chat import Chat
-from gateways import GatewaysManager
from urwid_satext import sat_widgets
+from sat_frontends.quick_frontend.quick_app import QuickApp
+from sat_frontends.quick_frontend.quick_chat_list import QuickChatList
+from sat_frontends.quick_frontend.quick_contact_list import QuickContactList
+from sat_frontends.quick_frontend.quick_contact_management import QuickContactManagement
+from sat_frontends.primitivus.profile_manager import ProfileManager
+from sat_frontends.primitivus.contact_list import ContactList
+from sat_frontends.primitivus.chat import Chat
+from sat_frontends.primitivus.gateways import GatewaysManager
+from sat_frontends.primitivus.xmlui import XMLUI
+from sat_frontends.primitivus.progress import Progress
import logging
from logging import debug, info, error
import sys, os
-from tools.jid import JID
-from xmlui import XMLUI
-from progress import Progress
+from sat.tools.jid import JID
### logging configuration FIXME: put this elsewhere ###
diff --git a/frontends/src/primitivus/profile_manager.py b/frontends/src/primitivus/profile_manager.py
index 43822e36..b25f7446 100644
--- a/frontends/src/primitivus/profile_manager.py
+++ b/frontends/src/primitivus/profile_manager.py
@@ -21,7 +21,7 @@ along with this program. If not, see .
import urwid
from urwid_satext.sat_widgets import Password,List,InputDialog,ConfirmDialog,Alert,FocusFrame
-from tools.jid import JID
+from sat.tools.jid import JID
class ProfileManager(urwid.WidgetWrap):
diff --git a/frontends/src/primitivus/progress.py b/frontends/src/primitivus/progress.py
index 6bd4a5cd..bf118a87 100644
--- a/frontends/src/primitivus/progress.py
+++ b/frontends/src/primitivus/progress.py
@@ -21,7 +21,7 @@ along with this program. If not, see .
import urwid
from urwid_satext import sat_widgets
-from tools.jid import JID
+from sat.tools.jid import JID
class Progress(urwid.WidgetWrap):
diff --git a/frontends/src/primitivus/xmlui.py b/frontends/src/primitivus/xmlui.py
index 55943468..a4089470 100644
--- a/frontends/src/primitivus/xmlui.py
+++ b/frontends/src/primitivus/xmlui.py
@@ -20,8 +20,8 @@ along with this program. If not, see .
"""
import urwid
-from logging import debug, info, warning, error
from urwid_satext import sat_widgets
+from logging import debug, info, warning, error
from xml.dom import minidom
class Pairs(urwid.WidgetWrap):
diff --git a/frontends/src/quick_frontend/quick_app.py b/frontends/src/quick_frontend/quick_app.py
index a3cdff3e..6bcb77e3 100644
--- a/frontends/src/quick_frontend/quick_app.py
+++ b/frontends/src/quick_frontend/quick_app.py
@@ -20,8 +20,8 @@ along with this program. If not, see .
"""
from logging import debug, info, error
-from tools.jid import JID
-from sat_bridge_frontend.DBus import DBusBridgeFrontend,BridgeExceptionNoService
+from sat.tools.jid import JID
+from sat_frontends.bridge.DBus import DBusBridgeFrontend,BridgeExceptionNoService
from optparse import OptionParser
import pdb
diff --git a/frontends/src/quick_frontend/quick_card_game.py b/frontends/src/quick_frontend/quick_card_game.py
index 21632d2f..a88845dd 100644
--- a/frontends/src/quick_frontend/quick_card_game.py
+++ b/frontends/src/quick_frontend/quick_card_game.py
@@ -20,7 +20,7 @@ along with this program. If not, see .
"""
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
diff --git a/frontends/src/quick_frontend/quick_chat.py b/frontends/src/quick_frontend/quick_chat.py
index d879c922..5713b781 100644
--- a/frontends/src/quick_frontend/quick_chat.py
+++ b/frontends/src/quick_frontend/quick_chat.py
@@ -20,7 +20,7 @@ along with this program. If not, see .
"""
from logging import debug, info, warning, error
-from tools.jid import JID
+from sat.tools.jid import JID
diff --git a/frontends/src/quick_frontend/quick_chat_list.py b/frontends/src/quick_frontend/quick_chat_list.py
index 7aaf38da..02857a68 100644
--- a/frontends/src/quick_frontend/quick_chat_list.py
+++ b/frontends/src/quick_frontend/quick_chat_list.py
@@ -19,7 +19,7 @@ You should have received a copy of the GNU General Public License
along with this program. If not, see .
"""
-from tools.jid import JID
+from sat.tools.jid import JID
class QuickChatList(dict):
diff --git a/frontends/src/quick_frontend/quick_contact_list.py b/frontends/src/quick_frontend/quick_contact_list.py
index 513716da..18f6422b 100644
--- a/frontends/src/quick_frontend/quick_contact_list.py
+++ b/frontends/src/quick_frontend/quick_contact_list.py
@@ -20,7 +20,7 @@ along with this program. If not, see .
"""
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
class QuickContactList():
diff --git a/frontends/src/quick_frontend/quick_contact_management.py b/frontends/src/quick_frontend/quick_contact_management.py
index db91d034..ffd7641d 100644
--- a/frontends/src/quick_frontend/quick_contact_management.py
+++ b/frontends/src/quick_frontend/quick_contact_management.py
@@ -20,7 +20,7 @@ along with this program. If not, see .
"""
from logging import debug, info, warning, error
-from tools.jid import JID
+from sat.tools.jid import JID
import pdb
diff --git a/frontends/src/wix/card_game.py b/frontends/src/wix/card_game.py
index d3dde66f..ea2b74e7 100644
--- a/frontends/src/wix/card_game.py
+++ b/frontends/src/wix/card_game.py
@@ -25,7 +25,7 @@ import wx
import os.path, glob
import pdb
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
from tools.games import TarotCard
from quick_frontend.quick_card_game import QuickCardGame
from xmlui import XMLUI
diff --git a/frontends/src/wix/chat.py b/frontends/src/wix/chat.py
index a7aecab1..c960fb9c 100644
--- a/frontends/src/wix/chat.py
+++ b/frontends/src/wix/chat.py
@@ -26,7 +26,7 @@ import os.path
import time
import pdb
from logging import debug, info, error, warning
-from tools.jid import JID
+from sat.tools.jid import JID
from quick_frontend.quick_chat import QuickChat
from contact_list import ContactList
from card_game import CardPanel
diff --git a/frontends/src/wix/contact_list.py b/frontends/src/wix/contact_list.py
index c6d249f7..ccba36df 100644
--- a/frontends/src/wix/contact_list.py
+++ b/frontends/src/wix/contact_list.py
@@ -2,7 +2,7 @@ import wx
from quick_frontend.quick_contact_list import QuickContactList
from logging import debug, info, error
from cgi import escape
-from tools.jid import JID
+from sat.tools.jid import JID
class Group(unicode):
diff --git a/frontends/src/wix/gateways.py b/frontends/src/wix/gateways.py
index eed64191..020806ed 100644
--- a/frontends/src/wix/gateways.py
+++ b/frontends/src/wix/gateways.py
@@ -25,7 +25,7 @@ import wx
import pdb
from xml.dom import minidom
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
from quick_frontend.quick_gateways import QuickGatewaysManager
class GatewaysManager(wx.Frame,QuickGatewaysManager):
diff --git a/frontends/src/wix/main_window.py b/frontends/src/wix/main_window.py
index 1a852f1c..adfec705 100644
--- a/frontends/src/wix/main_window.py
+++ b/frontends/src/wix/main_window.py
@@ -34,7 +34,7 @@ from profile_manager import ProfileManager
import gobject
import os.path
import pdb
-from tools.jid import JID
+from sat.tools.jid import JID
from logging import debug, info, warning, error
import constants
diff --git a/frontends/src/wix/param.py b/frontends/src/wix/param.py
index 6946645b..49ff74af 100644
--- a/frontends/src/wix/param.py
+++ b/frontends/src/wix/param.py
@@ -25,7 +25,7 @@ import wx
import pdb
from xml.dom import minidom
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
class Param(wx.Frame):
diff --git a/frontends/src/wix/profile.py b/frontends/src/wix/profile.py
index 31af4a7a..a28236ca 100644
--- a/frontends/src/wix/profile.py
+++ b/frontends/src/wix/profile.py
@@ -22,7 +22,7 @@ along with this program. If not, see .
import wx
import pdb
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
class Profile(wx.Frame):
diff --git a/frontends/src/wix/profile_manager.py b/frontends/src/wix/profile_manager.py
index 2589cace..3f906b49 100644
--- a/frontends/src/wix/profile_manager.py
+++ b/frontends/src/wix/profile_manager.py
@@ -24,7 +24,7 @@ along with this program. If not, see .
import wx
import pdb
from logging import debug, info, error
-from tools.jid import JID
+from sat.tools.jid import JID
import pdb
diff --git a/frontends/src/wix/xmlui.py b/frontends/src/wix/xmlui.py
index 5ea72f91..e8afb64d 100644
--- a/frontends/src/wix/xmlui.py
+++ b/frontends/src/wix/xmlui.py
@@ -25,7 +25,7 @@ import wx
import pdb
from xml.dom import minidom
from logging import debug, info, warning, error
-from tools.jid import JID
+from sat.tools.jid import JID
class XMLUI(wx.Frame):
diff --git a/setup.py b/setup.py
new file mode 100644
index 00000000..bd1120c1
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,83 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from distutils.command.install import install
+from distutils.core import setup
+from distutils.file_util import copy_file
+import os,sys,subprocess
+from stat import ST_MODE
+from glob import glob
+
+NAME = 'sat'
+LAUNCH_DAEMON_COMMAND = 'sat'
+
+
+class custom_install(install):
+
+ def custom_auto_options(self):
+ """Change options for twistd in the shell script
+ Mainly change the paths"""
+ sh_buffer = ""
+ run_dir = os.path.dirname(self.sh_script_path)
+ with open(self.sh_script_path,'r') as sh_file:
+ for ori_line in sh_file:
+ if ori_line.startswith('DAEMON='):
+ dest_line = 'DAEMON=""\n' #we want to launch sat as a daemon
+ elif ori_line.startswith('TAP_PATH='):
+ dest_line = 'TAP_PATH="%s/"\n' % run_dir
+ else:
+ dest_line = ori_line
+ sh_buffer += dest_line
+
+ with open(self.sh_script_path,'w') as sh_file:
+ sh_file.write(sh_buffer)
+
+
+ def custom_create_links(self):
+ """Create symbolic links to executables"""
+ #the script which launch the daemon
+ links = [(self.sh_script_path,LAUNCH_DAEMON_COMMAND),]
+ for source,dest in links:
+ dest_name, copied = copy_file(source, os.path.join(self.install_scripts, dest), link='sym')
+ assert (copied)
+ #we change the perm in the same way as in the original install_scripts
+ mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777
+ os.chmod(dest_name, mode)
+
+ def run(self):
+ install.run(self)
+ print ('running post installation stuff')
+ self.sh_script_path = os.path.join(self.install_lib,'sat','sat.sh')
+ self.primitivus_path = os.path.join(self.install_lib,'sat_frontends','primitivus')
+ self.custom_auto_options()
+ self.custom_create_links()
+
+
+
+setup(name=NAME,
+ version='0.1.0',
+ description=u'Salut à Toi multi-frontend XMPP client',
+ long_description=u'Salut à Toi (SàT) is a XMPP client based on a daemon/frontend architecture. You can use it with the desktop frontend (wix - WxPython based), console ui frontend (Primitivus, Urwid based), or command line frontend (jp), and others are coming. ',
+ author='Goffi (Jérôme Poisson)',
+ author_email='goffi@goffi.org',
+ url='http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi',
+ classifiers=['Development Status :: 3 - Alpha',
+ 'Environment :: Console',
+ 'Environment :: X11 Applications :: GTK',
+ 'Framework :: Twisted',
+ 'License :: OSI Approved :: GNU General Public License (GPL)',
+ 'Operating System :: POSIX :: Linux',
+ 'Topic :: Communications :: Chat'],
+ package_dir = {'sat':'src', 'sat_frontends':'frontends/src'},
+ packages=['sat','sat.tools','sat.bridge', 'sat.plugins',
+ 'sat_frontends', 'sat_frontends.bridge', 'sat_frontends.quick_frontend',
+ 'sat_frontends.primitivus'],
+ package_data = {'sat': ['sat.tac','sat.sh']},
+ data_files=[(os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['i18n/fr/LC_MESSAGES/sat.mo']),
+ (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/i18n/fr/LC_MESSAGES/sat_frontend.mo']),
+ (os.path.join(sys.prefix,'share/locale/fr/LC_MESSAGES'), ['frontends/src/jp/i18n/fr/LC_MESSAGES/jp.mo']),
+ ('share/doc/%s' % NAME, ['CHANGELOG', 'COPYING', 'INSTALL', 'README', 'README4TRANSLATORS'])],
+ scripts=['frontends/src/jp/jp', 'frontends/src/primitivus/primitivus'],
+ cmdclass=dict(install=custom_install),
+ )
+
diff --git a/src/sat.sh b/src/sat.sh
index c44ea418..79435d37 100755
--- a/src/sat.sh
+++ b/src/sat.sh
@@ -1,3 +1,16 @@
#!/bin/sh
-twistd -noy sat.tac
+NAME='sat'
+
+PID_FILE="/tmp/$NAME.pid"
+DAEMON="n"
+MAIN_OPTIONS="-${DAEMON}oy"
+TAP_PATH="./"
+TAP_FILE="$NAME.tac"
+
+#Don't change the next line
+AUTO_OPTIONS=""
+ADDITIONAL_OPTIONS="--pidfile $PID_FILE $AUTO_OPTIONS"
+
+echo "autogenere == >" twistd $MAIN_OPTIONS $TAP_PATH$TAP_FILE $ADDITIONAL_OPTIONS
+twistd $MAIN_OPTIONS $TAP_PATH$TAP_FILE $ADDITIONAL_OPTIONS
diff --git a/src/sat.tac b/src/sat.tac
index 3ac41123..6563a965 100644
--- a/src/sat.tac
+++ b/src/sat.tac
@@ -372,7 +372,7 @@ class SAT(service.Service):
plug_lst = [os.path.splitext(plugin)[0] for plugin in map(os.path.basename,glob ("plugins/plugin*.py"))]
for plug in plug_lst:
- plug_path = 'plugins.'+plug
+ plug_path = 'sat.plugins.'+plug
__import__(plug_path)
mod = sys.modules[plug_path]
plug_info = mod.PLUGIN_INFO