Date: Sat, 4 Jun 2005 17:12:01 +0200 (CEST) From: Martin Matuska <martin@matuska.org> To: FreeBSD-gnats-submit@FreeBSD.org Subject: ports/81897: Revised [NEW PORT] net/pyaimt 0.5, net/pyicqt 0.6, net/pymsnt 0.9.3 Message-ID: <20050604151201.A99262292B@mail.vx.sk> Resent-Message-ID: <200506041520.j54FK44a059383@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 81897 >Category: ports >Synopsis: Revised [NEW PORT] net/pyaimt 0.5, net/pyicqt 0.6, net/pymsnt 0.9.3 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Sat Jun 04 15:20:01 GMT 2005 >Closed-Date: >Last-Modified: >Originator: Martin Matuska >Release: FreeBSD 5.4-RELEASE i386 >Organization: >Environment: System: FreeBSD 5.4-RELEASE i386 >Description: New ports of python jabber transports AIM, ICQ and MSN, all from the same authors and have similiar structure (that's why there's a master port) Port supersedes ports/81844 >How-To-Repeat: >Fix: # This is a shell archive. Save it in a file, remove anything before # this line, and then unpack it by entering "sh file". Note, it may # create directories; files and directories will be owned by you and # have default permissions. # # This archive contains: # # net/pyaimt # net/pyaimt/Makefile # net/pyicqt # net/pyicqt/Makefile # net/pyicqt/pkg-descr # net/pyicqt/distinfo # net/pyicqt/files # net/pyicqt/files/pkg-install.in # net/pyicqt/files/startup.sh.in # net/pyicqt/files/pkg-deinstall.in # net/pyicqt/files/pkg-message.in # net/pyicqt/pkg-plist # net/pyicqt/pkg-descr.pymsnt # net/pyicqt/pkg-plist.pyaimt # net/pyicqt/pkg-descr.pyaimt # net/pyicqt/pkg-plist.pymsnt # net/pymsnt # net/pymsnt/Makefile # net/pymsnt/files # net/pymsnt/files/patch-src::main.py # net/pymsnt/files/patch-src::xmlconfig.py # echo c - net/pyaimt mkdir -p net/pyaimt > /dev/null 2>&1 echo x - net/pyaimt/Makefile sed 's/^X//' >net/pyaimt/Makefile << 'END-of-net/pyaimt/Makefile' X# Ports collection makefile for: pyaimt X# Date created: Jun 02, 2005 X# Whom: martin@matuska.org X# X# $FreeBSD$ X# X XPORTNAME= pyaimt XPORTVERSION= 0.5 X XMAINTAINER= martin@matuska.org XCOMMENT= AIM Transport for Jabber X XPLIST= ${PKGDIR}/pkg-plist.${PORTNAME} XDESCR= ${PKGDIR}/pkg-descr.${PORTNAME} X XPROCNAME= PyAIMt XDOCFILES= AUTHORS ChangeLog NEWS README COPYING INSTALL X XMASTERDIR= ${.CURDIR}/../pyicqt X X.include "${MASTERDIR}/Makefile" END-of-net/pyaimt/Makefile echo c - net/pyicqt mkdir -p net/pyicqt > /dev/null 2>&1 echo x - net/pyicqt/Makefile sed 's/^X//' >net/pyicqt/Makefile << 'END-of-net/pyicqt/Makefile' X# Ports collection makefile for: pyicqt X# Date created: Jun 02, 2005 X# Whom: Martin Matuska <martin@matuska.org> X# X# $FreeBSD$ X# X XPORTNAME?= pyicqt XPORTVERSION?= 0.6 XCATEGORIES= net python XMASTER_SITES?= http://www.blathersource.org/download.php/${PORTNAME:S/t$/-t/}/ XDISTNAME?= ${PORTNAME:S/t$/-t/}-${PORTVERSION} X XMAINTAINER= martin@matuska.org XCOMMENT?= Python ICQ Transport for Jabber X XRUN_DEPENDS+= ${PYTHON_SITELIBDIR}/twisted:${PORTSDIR}/devel/py-twistedCore X XNO_BUILD= yes XUSE_PYTHON= yes XUSE_REINPLACE= yes XUSE_RC_SUBR= yes X X${PORTNAME:U}_USER?= jabber X${PORTNAME:U}_GROUP?= jabber X${PORTNAME:U}_TOPDIR?= jabber X${PORTNAME:U}_ETCDIR?= jabber X${PORTNAME:U}_RUNDIR?= ${${PORTNAME:U}_TOPDIR}/${PORTNAME} X${PORTNAME:U}_SPOOL?= /var/spool/jabber/${PORTNAME} X# Set to yes for auto UID/GID, else 93 is used for new user/group creation X${PORTNAME:U}_AUTO?= no X XPROCNAME?= PyICQt XDOCFILES?= AUTHORS ChangeLog NEWS README COPYING INSTALL TODO X XPLIST_SUB+= RUNDIR=${${PORTNAME:U}_RUNDIR} TOPDIR=${${PORTNAME:U}_TOPDIR} \ X ETCDIR=${${PORTNAME:U}_ETCDIR} XSUB_LIST+= USER=${${PORTNAME:U}_USER} GROUP=${${PORTNAME:U}_GROUP} \ X RUNDIR=${${PORTNAME:U}_RUNDIR} SPOOLDIR=${${PORTNAME:U}_SPOOL} \ X TOPDIR=${${PORTNAME:U}_TOPDIR} ETCDIR=${${PORTNAME:U}_ETCDIR} \ X AUTO=${${PORTNAME:U}_AUTO} \ X PROCNAME=${PROCNAME} PORTNAME=${PORTNAME} XSUB_FILES+= pkg-deinstall pkg-install pkg-message startup.sh X XPKGINSTALL= ${WRKDIR}/pkg-install XPKGDEINSTALL= ${WRKDIR}/pkg-deinstall XPKGMESSAGE= ${WRKDIR}/pkg-message X X.include <bsd.port.pre.mk> X Xpre-install: X PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL X Xdo-install: X @${MKDIR} ${PREFIX}/${${PORTNAME:U}_RUNDIR} X @cd ${WRKSRC}/src; ${FIND} . -type d ! -path '.' ! -path '*/.svn*' ! -path '*/CVS*'\ X -exec ${MKDIR} ${PREFIX}/${${PORTNAME:U}_RUNDIR}/{} \; X @cd ${WRKSRC}/src; ${FIND} . -type f -name '*.py' ! -path '*/.svn*' ! -path '*/CVS*' \ X -exec ${INSTALL_DATA} ${WRKSRC}/src/{} ${PREFIX}/${${PORTNAME:U}_RUNDIR}/{} \; X X.if !defined (NOPORTDOCS) X @${MKDIR} ${DOCSDIR} X.for FILE in ${DOCFILES} X ${INSTALL_MAN} ${WRKSRC}/${FILE} ${DOCSDIR}/${FILE} X.endfor X.if(${PORTNAME} == "pyicqt") X ${INSTALL_MAN} ${WRKSRC}/TODO ${DOCSDIR}/${FILE} X.endif X.endif X Xpost-install: X ${INSTALL_SCRIPT} ${WRKDIR}/startup.sh ${PREFIX}/etc/rc.d/${PORTNAME}.sh; \ X ${REINPLACE_CMD} -e "s,<spooldir>.*</spooldir>,<spooldir>${${PORTNAME:U}_SPOOL}</spooldir>," \ X -e "s,<pid>.*</pid>,<pid>${${PORTNAME:U}_SPOOL}/${PROCNAME}.pid</pid>," \ X ${WRKSRC}/config?example.xml X ${MKDIR} ${PREFIX}/etc/${${PORTNAME:U}_ETCDIR} X ${INSTALL_DATA} ${WRKSRC}/config?example.xml ${PREFIX}/etc/${${PORTNAME:U}_ETCDIR}/${PORTNAME}.xml.sample X.if !exists(${PREFIX}/etc/${${PORTNAME:U}_ETCDIR}/${PORTNAME}.xml) X ${INSTALL} -o jabber -g jabber -m 750 ${PREFIX}/etc/${${PORTNAME:U}_ETCDIR}/${PORTNAME}.xml.sample ${PREFIX}/etc/${${PORTNAME:U}_ETCDIR}/${PORTNAME}.xml X.endif X @${CAT} ${PKGMESSAGE} X X.include <bsd.port.post.mk> END-of-net/pyicqt/Makefile echo x - net/pyicqt/pkg-descr sed 's/^X//' >net/pyicqt/pkg-descr << 'END-of-net/pyicqt/pkg-descr' XPyICQ-t is an ICQ transport for Jabber written entirely in Python, and using Xthe Twisted framework. It uses the OSCAR protocol to communicate with AOL's Xservers and should work with any Jabber implementation available. X XWWW: http://pyicq-t.blathersource.org/ END-of-net/pyicqt/pkg-descr echo x - net/pyicqt/distinfo sed 's/^X//' >net/pyicqt/distinfo << 'END-of-net/pyicqt/distinfo' XMD5 (pyicq-t-0.6.tar.gz) = 5c6f8cd598465124d886f1c47f88c809 XMD5 (pyaim-t-0.5.tar.gz) = d5902ac0a6857f5377c4cf2cd1e1d155 XMD5 (PyMSNt-0.9.3.tar.gz) = a98ecc23688e76f7841060e4fb0b7de9 END-of-net/pyicqt/distinfo echo c - net/pyicqt/files mkdir -p net/pyicqt/files > /dev/null 2>&1 echo x - net/pyicqt/files/pkg-install.in sed 's/^X//' >net/pyicqt/files/pkg-install.in << 'END-of-net/pyicqt/files/pkg-install.in' X#!/bin/sh X# $FreeBSD$ X# X Xif [ "$2" != "PRE-INSTALL" ]; then X exit 0 Xfi X XUSER=%%USER%% XGROUP=%%GROUP%% XSPOOLDIR=%%SPOOLDIR%% XAUTO=%%AUTO%% X Xif [ "x${AUTO}" = "xno" ]; then X UID='-u 93' X GID='-g 93' Xfi X Xif ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then X if pw groupadd ${GROUP} ${GID}; then X echo "Added group \"${GROUP}\"." X else X echo "Adding group \"${GROUP}\" failed..." X exit 1 X fi Xfi X Xif ! pw usershow "${USER}" 2>/dev/null 1>&2; then X if pw useradd ${USER} ${UID} -g ${GROUP} -h - \ X -s "/sbin/nologin" -d "/nonexistent" \ X -c "Jabber Daemon"; \ X then X echo "Added user \"${USER}\"." X else X echo "Adding user \"${USER}\" failed..." X exit 1 X fi Xfi X Xmkdir -p -m 750 ${SPOOLDIR} Xchown ${USER}:${GROUP} ${SPOOLDIR} X Xexit 0 END-of-net/pyicqt/files/pkg-install.in echo x - net/pyicqt/files/startup.sh.in sed 's/^X//' >net/pyicqt/files/startup.sh.in << 'END-of-net/pyicqt/files/startup.sh.in' X#!/bin/sh X# X# $FreeBSD$ X# X X# PROVIDE: %%PORTNAME%% X# REQUIRE: DAEMON X# BEFORE: LOGIN X# KEYWORD: FreeBSD shutdown X# Xprefix=%%PREFIX%% X X# Define these %%PORTNAME%%_* variables in one of these files: X# /etc/rc.conf X# /etc/rc.conf.local X# X# DO NOT CHANGE THESE DEFAULT VALUES HERE X# X%%PORTNAME%%_dir=${%%PORTNAME%%_dir-"${prefix}/%%RUNDIR%%"} X%%PORTNAME%%_conf=${%%PORTNAME%%_conf-"${prefix}/etc/jabber/%%PORTNAME%%.xml"} X%%PORTNAME%%_spooldir=${%%PORTNAME%%_spooldir-"%%SPOOLDIR%%"} X%%PORTNAME%%_pid=${%%PORTNAME%%_pid-"${%%PORTNAME%%_spooldir}/%%PROCNAME%%.pid"} X%%PORTNAME%%_enable=${%%PORTNAME%%_enable-"NO"} X%%PORTNAME%%_user=${%%PORTNAME%%_user-"jabber"} X X. %%RC_SUBR%% X Xname="%%PORTNAME%%" Xrcvar=`set_rcvar` Xpidfile="${%%PORTNAME%%_pid}" Xprocname="%%PROCNAME%%" Xcommand="${prefix}/bin/python" Xcommand_args="${%%PORTNAME%%_dir}/main.py -c ${%%PORTNAME%%_conf} -o pid=${pidfile} > /dev/null 2>&1 &" X Xload_rc_config $name Xrun_rc_command "$1" END-of-net/pyicqt/files/startup.sh.in echo x - net/pyicqt/files/pkg-deinstall.in sed 's/^X//' >net/pyicqt/files/pkg-deinstall.in << 'END-of-net/pyicqt/files/pkg-deinstall.in' X#!/bin/sh X# $FreeBSD$ X# X Xif [ "$2" != "POST-DEINSTALL" ]; then X exit 0 Xfi X XUSER=%%USER%% XSPOOLDIR=%%SPOOLDIR%% X Xif pw usershow "${USER}" 2>/dev/null 1>&2; then X echo "To delete Jabber user permanently, use 'pw userdel ${USER}'" Xfi X Xif pw groupshow "${USER}" 2>/dev/null 1>&2; then X echo "To delete Jabber group permanently, use 'pw groupdel ${USER}'" Xfi X Xecho "If you wish to delete data files, remove '%%SPOOLDIR%%' directory." X Xexit 0 END-of-net/pyicqt/files/pkg-deinstall.in echo x - net/pyicqt/files/pkg-message.in sed 's/^X//' >net/pyicqt/files/pkg-message.in << 'END-of-net/pyicqt/files/pkg-message.in' X================================================== XTo invoke %%PROCNAME%% on startup, put the following in X/etc/rc.conf or /etc/rc.conf.local: X X %%PORTNAME%%_enable="YES" X================================================== END-of-net/pyicqt/files/pkg-message.in echo x - net/pyicqt/pkg-plist sed 's/^X//' >net/pyicqt/pkg-plist << 'END-of-net/pyicqt/pkg-plist' X%%RUNDIR%%/webadmin/handler.py X%%RUNDIR%%/webadmin/__init__.py X%%RUNDIR%%/tlib/jabber/jstrports.py X%%RUNDIR%%/tlib/jabber/client.py X%%RUNDIR%%/tlib/jabber/__init__.py X%%RUNDIR%%/tlib/jabber/component.py X%%RUNDIR%%/tlib/jabber/jid.py X%%RUNDIR%%/tlib/countrycodes.py X%%RUNDIR%%/tlib/xmlstream.py X%%RUNDIR%%/tlib/langcodes.py X%%RUNDIR%%/tlib/__init__.py X%%RUNDIR%%/tlib/domish.py X%%RUNDIR%%/tlib/oscar.py X%%RUNDIR%%/tlib/socks5.py X%%RUNDIR%%/tlib/sockserror.py X%%RUNDIR%%/legacy/__init__.py X%%RUNDIR%%/legacy/glue.py X%%RUNDIR%%/legacy/icqt.py X%%RUNDIR%%/config.py X%%RUNDIR%%/stats.py X%%RUNDIR%%/utils.py X%%RUNDIR%%/disco.py X%%RUNDIR%%/session.py X%%RUNDIR%%/xdb.py X%%RUNDIR%%/lang.py X%%RUNDIR%%/register.py X%%RUNDIR%%/jabw.py X%%RUNDIR%%/main.py X%%RUNDIR%%/misciq.py X%%RUNDIR%%/debug.py X%%RUNDIR%%/xmlconfig.py X%%PORTDOCS%%%%DOCSDIR%%/AUTHORS X%%PORTDOCS%%%%DOCSDIR%%/ChangeLog X%%PORTDOCS%%%%DOCSDIR%%/NEWS X%%PORTDOCS%%%%DOCSDIR%%/README X%%PORTDOCS%%%%DOCSDIR%%/COPYING X%%PORTDOCS%%%%DOCSDIR%%/INSTALL X%%PORTDOCS%%%%DOCSDIR%%/TODO X%%PORTDOCS%%@dirrm %%DOCSDIR%% Xetc/%%ETCDIR%%/pyicqt.xml.sample Xetc/rc.d/pyicqt.sh X@dirrm %%RUNDIR%%/webadmin X@dirrm %%RUNDIR%%/tlib/jabber X@dirrm %%RUNDIR%%/tlib X@dirrm %%RUNDIR%%/legacy X@dirrm %%RUNDIR%% X@unexec rmdir %D/%%TOPDIR%% 2>/dev/null || true X@unexec rmdir %D/etc/%%ETCDIR%% 2>/dev/null || true END-of-net/pyicqt/pkg-plist echo x - net/pyicqt/pkg-descr.pymsnt sed 's/^X//' >net/pyicqt/pkg-descr.pymsnt << 'END-of-net/pyicqt/pkg-descr.pymsnt' XThe MSN Transport provides a gateway which allows Jabber users to communicate Xwith their contacts on the MSN Messenger network. X XThe transport must be installed on the Jabber server, and it's operation Xis nearly transparent to the user. They can interact with their MSN contacts Xin the same way as they do with their Jabber contacts. X XPyMSNt is written in Python using the Twisted library for networking. X XWWW: http://msn-transport.jabberstudio.org/ END-of-net/pyicqt/pkg-descr.pymsnt echo x - net/pyicqt/pkg-plist.pyaimt sed 's/^X//' >net/pyicqt/pkg-plist.pyaimt << 'END-of-net/pyicqt/pkg-plist.pyaimt' X%%RUNDIR%%/webadmin/handler.py X%%RUNDIR%%/webadmin/__init__.py X%%RUNDIR%%/tlib/jabber/jstrports.py X%%RUNDIR%%/tlib/jabber/client.py X%%RUNDIR%%/tlib/jabber/__init__.py X%%RUNDIR%%/tlib/jabber/component.py X%%RUNDIR%%/tlib/jabber/jid.py X%%RUNDIR%%/tlib/socks5.py X%%RUNDIR%%/tlib/xmlstream.py X%%RUNDIR%%/tlib/__init__.py X%%RUNDIR%%/tlib/domish.py X%%RUNDIR%%/tlib/oscar.py X%%RUNDIR%%/tlib/sockserror.py X%%RUNDIR%%/legacy/__init__.py X%%RUNDIR%%/legacy/aimt.py X%%RUNDIR%%/legacy/glue.py X%%RUNDIR%%/groupchat.py X%%RUNDIR%%/stats.py X%%RUNDIR%%/utils.py X%%RUNDIR%%/disco.py X%%RUNDIR%%/config.py X%%RUNDIR%%/xdb.py X%%RUNDIR%%/lang.py X%%RUNDIR%%/jabw.py X%%RUNDIR%%/session.py X%%RUNDIR%%/register.py X%%RUNDIR%%/main.py X%%RUNDIR%%/misciq.py X%%RUNDIR%%/debug.py X%%RUNDIR%%/xmlconfig.py X%%RUNDIR%%/exception.py X@dirrm %%RUNDIR%%/tlib/jabber X@dirrm %%RUNDIR%%/tlib X@dirrm %%RUNDIR%%/webadmin X@dirrm %%RUNDIR%%/legacy X@dirrm %%RUNDIR%% Xetc/%%ETCDIR%%/pyaimt.xml.sample Xetc/rc.d/pyaimt.sh X%%PORTDOCS%%%%DOCSDIR%%/AUTHORS X%%PORTDOCS%%%%DOCSDIR%%/ChangeLog X%%PORTDOCS%%%%DOCSDIR%%/NEWS X%%PORTDOCS%%%%DOCSDIR%%/README X%%PORTDOCS%%%%DOCSDIR%%/COPYING X%%PORTDOCS%%%%DOCSDIR%%/INSTALL X%%PORTDOCS%%@dirrm %%DOCSDIR%% X@unexec rmdir %D/%%TOPDIR%% 2>/dev/null || true X@unexec rmdir %D/etc/%%ETCDIR%% 2>/dev/null || true END-of-net/pyicqt/pkg-plist.pyaimt echo x - net/pyicqt/pkg-descr.pyaimt sed 's/^X//' >net/pyicqt/pkg-descr.pyaimt << 'END-of-net/pyicqt/pkg-descr.pyaimt' XPyAIM-t is an AIM transport for Jabber written entirely in Python, and using Xthe Twisted framework. It uses the OSCAR protocol to communicate with AOL's Xservers and should work with any Jabber implementation available. X XWWW: http://pyaim-t.blathersource.org/ END-of-net/pyicqt/pkg-descr.pyaimt echo x - net/pyicqt/pkg-plist.pymsnt sed 's/^X//' >net/pyicqt/pkg-plist.pymsnt << 'END-of-net/pyicqt/pkg-plist.pymsnt' X%%RUNDIR%%/baseproto/__init__.py X%%RUNDIR%%/baseproto/glue.py X%%RUNDIR%%/legacy/__init__.py X%%RUNDIR%%/legacy/glue.py X%%RUNDIR%%/legacy/msnw.py X%%RUNDIR%%/legacy/subscription.py X%%RUNDIR%%/tlib/jabber/__init__.py X%%RUNDIR%%/tlib/jabber/client.py X%%RUNDIR%%/tlib/jabber/component.py X%%RUNDIR%%/tlib/jabber/jid.py X%%RUNDIR%%/tlib/jabber/jstrports.py X%%RUNDIR%%/tlib/__init__.py X%%RUNDIR%%/tlib/domish.py X%%RUNDIR%%/tlib/msn.py X%%RUNDIR%%/tlib/proxy.py X%%RUNDIR%%/tlib/xmlstream.py X%%RUNDIR%%/config.py X%%RUNDIR%%/debug.py X%%RUNDIR%%/disco.py X%%RUNDIR%%/groupchat.py X%%RUNDIR%%/jabw.py X%%RUNDIR%%/lang.py X%%RUNDIR%%/main.py X%%RUNDIR%%/misciq.py X%%RUNDIR%%/register.py X%%RUNDIR%%/session.py X%%RUNDIR%%/utils.py X%%RUNDIR%%/xdb.py X%%RUNDIR%%/xmlconfig.py X@dirrm %%RUNDIR%%/baseproto X@dirrm %%RUNDIR%%/legacy X@dirrm %%RUNDIR%%/tlib/jabber X@dirrm %%RUNDIR%%/tlib X@dirrm %%RUNDIR%% Xetc/%%ETCDIR%%/pymsnt.xml.sample Xetc/rc.d/pymsnt.sh X%%PORTDOCS%%%%DOCSDIR%%/README X%%PORTDOCS%%%%DOCSDIR%%/COPYING X%%PORTDOCS%%%%DOCSDIR%%/TODO X%%PORTDOCS%%@dirrm %%DOCSDIR%% X@unexec rmdir %D/%%TOPDIR%% 2>/dev/null || true X@unexec rmdir %D/etc/%%ETCDIR%% 2>/dev/null || true END-of-net/pyicqt/pkg-plist.pymsnt echo c - net/pymsnt mkdir -p net/pymsnt > /dev/null 2>&1 echo x - net/pymsnt/Makefile sed 's/^X//' >net/pymsnt/Makefile << 'END-of-net/pymsnt/Makefile' X# Ports collection makefile for: pyaimt X# Date created: Jun 02, 2005 X# Whom: martin@matuska.org X# X# $FreeBSD$ X# X XPORTNAME= pymsnt XPORTVERSION= 0.9.3 XCATEGORIES= net python XMASTER_SITES?= http://msn-transport.jabberstudio.org/tarballs/ XDISTNAME?= PyMSNt-${PORTVERSION} X XMAINTAINER= martin@matuska.org XCOMMENT= Python MSN Transport for Jabber X XRUN_DEPENDS+= ${PYTHON_SITELIBDIR}/OpenSSL:${PORTSDIR}/security/py-openssl X XPATCHDIR= ../pymsnt/files X XPLIST= ${PKGDIR}/pkg-plist.${PORTNAME} XDESCR= ${PKGDIR}/pkg-descr.${PORTNAME} X XPROCNAME= PyMSNt XDOCFILES= COPYING README TODO X XMASTERDIR= ${.CURDIR}/../pyicqt X X.include "${MASTERDIR}/Makefile" END-of-net/pymsnt/Makefile echo c - net/pymsnt/files mkdir -p net/pymsnt/files > /dev/null 2>&1 echo x - net/pymsnt/files/patch-src::main.py sed 's/^X//' >net/pymsnt/files/patch-src::main.py << 'END-of-net/pymsnt/files/patch-src::main.py' X--- src/main.py.orig Sun May 8 02:20:04 2005 X+++ src/main.py Sat Jun 4 16:25:19 2005 X@@ -1,6 +1,8 @@ X # Copyright 2004 James Bunton <james@delx.cjb.net> X # Licensed for distribution under the GPL version 2, check COPYING for details X X+import debug X+import getopt X import utils X from twisted.internet import reactor, task X from twisted.internet.defer import Deferred X@@ -20,10 +22,52 @@ X sys.setdefaultencoding("utf-8") X import types X X+if (float(sys.version[:3]) < 2.3): X+ print("You are using version %s of Python, at least 2.3 is required." % (sys.version[:3])) X+ os._exit(0) X+ X+name = "PyMSNt" X+exe = os.path.realpath(sys.executable) X+if (exe.find("python") >= 0): X+ print("Restarting with process name %s..." % (name)) X+ os.execv(exe, [name, sys.argv[0]]+sys.argv[1:]) X+ X # Must load config before everything else X import config X import xmlconfig X-xmlconfig.reloadConfig() X+conffile = "config.xml" X+options = {} X+opts, args = getopt.getopt(sys.argv[1:], "c:o:dDl:h", ["config=", "option=", "debug", "log=", "help"]) X+for o, v in opts: X+ if o in ("-c", "--config"): X+ conffile = v X+ elif o in ("-d", "--debug"): X+ config.debugOn = True X+ elif o in ("-l", "--log"): X+ config.debugLog = v X+ elif o in ("-o", "--option"): X+ var, setting = v.split("=", 2) X+ options[var] = setting X+ elif o in ("-h", "--help"): X+ print "./PyMSNt [options]" X+ print " -h print this help" X+ print " -c <file> read configuration from this file" X+ print " -d print debugging output" X+ print " -l <file> write debugging output to file" X+ print " -o <var>=<setting> set config var to setting" X+ os._exit(0) X+reload(debug) X+xmlconfig.Import(conffile, options) X+ X+def reloadConfig(a, b): X+ # Reload default config and then process conf file X+ reload(config) X+ xmlconfig.Import(conffile, None) X+ X+# Set SIGHUP to reload the config file X+if (os.name == "posix"): X+ import signal X+ signal.signal(signal.SIGHUP, reloadConfig) X X import xdb X import session X@@ -32,7 +76,6 @@ X import register X import misciq X import lang X-import debug X import legacy X X #import gc X@@ -253,17 +296,7 @@ X reactor.callLater(3.0, d.callback, None) X return d X X- X- X-def SIGHUPstuff(*args): X- xmlconfig.reloadConfig() X- debug.reopenFile() X- X- X if(__name__ == "__main__"): X- # Set SIGHUP to reload the config file & close & open debug file X- if(os.name == "posix"): X- signal.signal(signal.SIGHUP, SIGHUPstuff) X X app = App() X reactor.run() END-of-net/pymsnt/files/patch-src::main.py echo x - net/pymsnt/files/patch-src::xmlconfig.py sed 's/^X//' >net/pymsnt/files/patch-src::xmlconfig.py << 'END-of-net/pymsnt/files/patch-src::xmlconfig.py' X--- src/xmlconfig.py.orig Sat Apr 23 08:07:20 2005 X+++ src/xmlconfig.py Sat Jun 4 16:25:53 2005 X@@ -1,50 +1,56 @@ X-# Copyright 2004 James Bunton <james@delx.cjb.net> X+# Copyright 2005 Daniel Henninger <jadestorm@nc.rr.com> X # Licensed for distribution under the GPL version 2, check COPYING for details X X- X-import sys X-import os X- X-import utils X+from tlib.domish import parseText, Element X+import debug X import config X- X+import sys X X def invalidError(text): X print text X print "Exiting..." X sys.exit(1) X X- X-def reloadConfig(): X- # Find out where the config file is X- configFile = "../config.xml" X- if(len(sys.argv) == 2): X- configFile = sys.argv[1] X- X- # Check the file exists X- if(not os.path.isfile(configFile)): X- print "Configuration file not found. You need to create a config.xml file in the PyMSNt directory." X- sys.exit(1) X- X- # Get ourself a DOM X- root = utils.parseFile(configFile) X- X- # Store all the options in config X- for el in root.elements(): X- try: X- tag = el.name X- cdata = str(el) X- if(cdata): X+def importFile(conffile): X+ if (conffile[0] != "/"): X+ conffile = "../"+conffile X+ f = open(conffile) X+ lines = f.readlines() X+ f.close() X+ file = "" X+ for line in lines: X+ file += line X+ X+ document = parseText(file) X+ for child in document.elements(): X+ tag = child.name X+ cdata = child.__str__() X+ debug.log("Reading config option %s = %s" % (tag, cdata)) X+ if (cdata): X # For config options like <ip>127.0.0.1</ip> X+ try: X if(type(getattr(config, tag)) != str): X- invalidError("Tag %s in your configuration file should be a boolean (ie, no cdata)." % (tag)) X+ invalidError("Tag %s in your configuration file should be a string (ie, must have cdata)." % (tag)) X setattr(config, tag, cdata) X+ except AttributeError: X+ debug.log("Ignoring configuration option %s" % (tag)) X- else: X+ else: X- # For config options like <sessionGreeting/> X- if(type(getattr(config, tag)) not in [bool, int]): X- invalidError("Tag %s in your configuration file should be a string (ie, must have cdata)." % (tag)) X+ # For config options like <crossChat/> X+ try: X+ if(type(getattr(config, tag)) != bool): X+ invalidError("Tag %s in your configuration file should be a boolean (ie, no cdata)." % (tag)) X setattr(config, tag, True) X- except AttributeError: X+ except AttributeError: X- print "Tag %s in your configuration file is not a defined tag. Ignoring!" % (tag) X- X+ debug.log("Ignoring configuration option %s" % (tag)) X X+def importOptions(options): X+ for o in options: X+ debug.log("Setting config option %s = %s" % (o, options[o])) X+ setattr(config, o, options[o]) X+ X+def Import(file = None, options = None): X+ debug.log("Config: Created configuration entity") X+ if (file != None): X+ importFile(file) X+ if (options != None): X+ importOptions(options) END-of-net/pymsnt/files/patch-src::xmlconfig.py exit >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050604151201.A99262292B>