# HG changeset patch # User Goffi # Date 1294188996 -3600 # Node ID fd9b7834d98a674ba77c1242fa21d65a7e86e7bb # Parent 9c6ee3f9ab291a487b02a428cb20a37cc261db3d distutils installation script, draft diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/jp/jp --- a/frontends/src/jp/jp Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/jp/jp Wed Jan 05 01:56:36 2011 +0100 @@ -54,7 +54,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/__init__.py diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/card_game.py --- a/frontends/src/primitivus/card_game.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/card_game.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,10 +20,10 @@ """ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/chat.py --- a/frontends/src/primitivus/chat.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/chat.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,13 +20,13 @@ """ import urwid -from quick_frontend.quick_contact_list import QuickContactList -from quick_frontend.quick_chat import QuickChat from urwid_satext import sat_widgets +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 tools.jid import JID -from card_game import CardGame -from urwid_satext.files_management import FileDialog +from sat.tools.jid import JID class ChatText(urwid.FlowWidget): diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/contact_list.py --- a/frontends/src/primitivus/contact_list.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/contact_list.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,9 +20,9 @@ """ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/gateways.py --- a/frontends/src/primitivus/gateways.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/gateways.py Wed Jan 05 01:56:36 2011 +0100 @@ -21,8 +21,8 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/primitivus Wed Jan 05 01:56:36 2011 +0100 @@ -20,22 +20,22 @@ """ -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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/profile_manager.py --- a/frontends/src/primitivus/profile_manager.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/profile_manager.py Wed Jan 05 01:56:36 2011 +0100 @@ -21,7 +21,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/progress.py --- a/frontends/src/primitivus/progress.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/progress.py Wed Jan 05 01:56:36 2011 +0100 @@ -21,7 +21,7 @@ import urwid from urwid_satext import sat_widgets -from tools.jid import JID +from sat.tools.jid import JID class Progress(urwid.WidgetWrap): diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/primitivus/xmlui.py --- a/frontends/src/primitivus/xmlui.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/primitivus/xmlui.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,8 +20,8 @@ """ import urwid +from urwid_satext import sat_widgets from logging import debug, info, warning, error -from urwid_satext import sat_widgets from xml.dom import minidom class Pairs(urwid.WidgetWrap): diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/quick_frontend/quick_app.py --- a/frontends/src/quick_frontend/quick_app.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/quick_frontend/quick_app.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,8 +20,8 @@ """ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/quick_frontend/quick_card_game.py --- a/frontends/src/quick_frontend/quick_card_game.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/quick_frontend/quick_card_game.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,7 +20,7 @@ """ from logging import debug, info, error -from tools.jid import JID +from sat.tools.jid import JID diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/quick_frontend/quick_chat.py --- a/frontends/src/quick_frontend/quick_chat.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/quick_frontend/quick_chat.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,7 +20,7 @@ """ from logging import debug, info, warning, error -from tools.jid import JID +from sat.tools.jid import JID diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/quick_frontend/quick_chat_list.py --- a/frontends/src/quick_frontend/quick_chat_list.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/quick_frontend/quick_chat_list.py Wed Jan 05 01:56:36 2011 +0100 @@ -19,7 +19,7 @@ along with this program. If not, see . """ -from tools.jid import JID +from sat.tools.jid import JID class QuickChatList(dict): diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/quick_frontend/quick_contact_list.py --- a/frontends/src/quick_frontend/quick_contact_list.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/quick_frontend/quick_contact_list.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,7 +20,7 @@ """ from logging import debug, info, error -from tools.jid import JID +from sat.tools.jid import JID class QuickContactList(): diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/quick_frontend/quick_contact_management.py --- a/frontends/src/quick_frontend/quick_contact_management.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/quick_frontend/quick_contact_management.py Wed Jan 05 01:56:36 2011 +0100 @@ -20,7 +20,7 @@ """ from logging import debug, info, warning, error -from tools.jid import JID +from sat.tools.jid import JID import pdb diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/card_game.py --- a/frontends/src/wix/card_game.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/card_game.py Wed Jan 05 01:56:36 2011 +0100 @@ -25,7 +25,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/chat.py --- a/frontends/src/wix/chat.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/chat.py Wed Jan 05 01:56:36 2011 +0100 @@ -26,7 +26,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/contact_list.py --- a/frontends/src/wix/contact_list.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/contact_list.py Wed Jan 05 01:56:36 2011 +0100 @@ -2,7 +2,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/gateways.py --- a/frontends/src/wix/gateways.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/gateways.py Wed Jan 05 01:56:36 2011 +0100 @@ -25,7 +25,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/main_window.py --- a/frontends/src/wix/main_window.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/main_window.py Wed Jan 05 01:56:36 2011 +0100 @@ -34,7 +34,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/param.py --- a/frontends/src/wix/param.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/param.py Wed Jan 05 01:56:36 2011 +0100 @@ -25,7 +25,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/profile.py --- a/frontends/src/wix/profile.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/profile.py Wed Jan 05 01:56:36 2011 +0100 @@ -22,7 +22,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/profile_manager.py --- a/frontends/src/wix/profile_manager.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/profile_manager.py Wed Jan 05 01:56:36 2011 +0100 @@ -24,7 +24,7 @@ import wx import pdb from logging import debug, info, error -from tools.jid import JID +from sat.tools.jid import JID import pdb diff -r 9c6ee3f9ab29 -r fd9b7834d98a frontends/src/wix/xmlui.py --- a/frontends/src/wix/xmlui.py Tue Jan 04 19:30:27 2011 +0100 +++ b/frontends/src/wix/xmlui.py Wed Jan 05 01:56:36 2011 +0100 @@ -25,7 +25,7 @@ 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 -r 9c6ee3f9ab29 -r fd9b7834d98a setup.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/setup.py Wed Jan 05 01:56:36 2011 +0100 @@ -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 -r 9c6ee3f9ab29 -r fd9b7834d98a src/sat.sh --- a/src/sat.sh Tue Jan 04 19:30:27 2011 +0100 +++ b/src/sat.sh Wed Jan 05 01:56:36 2011 +0100 @@ -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 -r 9c6ee3f9ab29 -r fd9b7834d98a src/sat.tac --- a/src/sat.tac Tue Jan 04 19:30:27 2011 +0100 +++ b/src/sat.tac Wed Jan 05 01:56:36 2011 +0100 @@ -372,7 +372,7 @@ 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