debian/0000755000000000000000000000000011741220761007167 5ustar debian/pyscrabble.desktop0000644000000000000000000000037010700023025012674 0ustar [Desktop Entry] Version=1.0 Name=PyScrabble Comment=A classical game of words Comment[de]=Ein klassisches Wörterspiel Comment[sv]=Ett klassiskt ordspel Exec=pyscrabble Icon=pyscrabble Terminal=false Type=Application Categories=Game;BoardGame;GTK; debian/control0000644000000000000000000000661611741220753010604 0ustar Source: pyscrabble Section: games Priority: optional Maintainer: Magnus Holmgren Build-Depends: debhelper (>= 7), python (>= 2.6.6-3~) Build-Depends-Indep: librsvg2-bin, imagemagick Standards-Version: 3.9.3 Homepage: http://pyscrabble.sourceforge.net Vcs-Browser: http://svn.kibibyte.se/pyscrabble Vcs-Svn: http://svn.kibibyte.se/pyscrabble/trunk Package: pyscrabble-common Architecture: all Depends: ${misc:Depends}, ${python:Depends}, python-twisted-core Replaces: pyscrabble-server (<< 1.6.2-2) Description: multiplayer scrabble implementation - common files PyScrabble is an online, multiplayer implementation of the popular word game written in Python and featuring: . * chat and private messaging (online as well as offline) * player rankings and server statistics * use of ENABLE (Enhanced North American Benchmark LExicon) for English word lookup * timed games . This package contains files common to the client and the server. You will need to install pyscrabble to play. . Notice: Scrabble is a registered trademark belonging to Hasbro Inc in the US, and to J.W. Spear & Sons Ltd., a subsidiary of Mattel Inc., throughout the rest of the world. Neither the author, Debian, nor this game are affiliated with the Scrabble Crossword Game, Hasbro, Spear & Sons or Mattel in any fashion. Package: pyscrabble Architecture: all Depends: pyscrabble-common (= ${source:Version}), ${misc:Depends}, ${python:Depends}, python-pygame, python-gtk2 Suggests: pyscrabble-server Description: multiplayer scrabble implementation written in Python - client part PyScrabble is an online, multiplayer implementation of the popular word game written in Python and featuring: . * chat and private messaging (online as well as offline) * player rankings and server statistics * use of ENABLE (Enhanced North American Benchmark LExicon) for English word lookup * timed games . The following languages are supported: . * English * Finnish * French * German * Serbian . This package contains the client program. . Notice: Scrabble is a registered trademark belonging to Hasbro Inc in the US, and to J.W. Spear & Sons Ltd., a subsidiary of Mattel Inc., throughout the rest of the world. Neither the author, Debian, nor this game are affiliated with the Scrabble Crossword Game, Hasbro, Spear & Sons or Mattel in any fashion. Package: pyscrabble-server Architecture: all Depends: pyscrabble-common (= ${source:Version}), ${misc:Depends}, ${python:Depends}, python-zodb, python-nevow, adduser, lsb-base (>= 3.0-6) Suggests: pyscrabble Priority: extra Description: scrabble implementation written in Python - server part PyScrabble is an online, multiplayer implementation of the popular word game written in Python and featuring: . * chat and private messaging (online as well as offline) * player rankings and server statistics * use of ENABLE (Enhanced North American Benchmark LExicon) for English word lookup * timed games . This package contains the server. You do not need to install this package if you only plan to connect to existing PyScrabble servers. . Notice: Scrabble is a registered trademark belonging to Hasbro Inc in the US, and to J.W. Spear & Sons Ltd., a subsidiary of Mattel Inc., throughout the rest of the world. Neither the author, Debian, nor this game are affiliated with the Scrabble Crossword Game, Hasbro, Spear & Sons or Mattel in any fashion. debian/pyscrabble.links0000644000000000000000000000011211557075412012357 0ustar usr/share/games/pyscrabble/python/pyscrabble-main.py usr/games/pyscrabble debian/pyscrabble-server.links0000644000000000000000000000011711557075412013670 0ustar usr/share/games/pyscrabble/python/server_console.py usr/sbin/pyscrabble-server debian/rules0000755000000000000000000000514211736141026010251 0ustar #!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 DESTDIR=$(CURDIR)/debian/tmp ICON_SIZES=16 22 32 48 64 96 PIXMAP_SIZES=16 32 clean: dh_testdir dh_testroot rm -f build-stamp rm -f pyscrabble-*.png pyscrabble-*.xpm python setup.py clean -a find -name '*.pyc' -delete dh_clean build: build-indep build-arch: build-indep: build-stamp build-stamp: python setup.py build for size in $(ICON_SIZES); do \ rsvg-convert -h $$size -w $$size -o pyscrabble-$$size.png debian/pyscrabble.svg; \ done for size in $(PIXMAP_SIZES); do \ convert pyscrabble-$$size.png pyscrabble-$${size}x$${size}.xpm; \ done touch "$@" install: build dh_testdir dh_testroot dh_prep python setup.py install --no-compile --root=$(DESTDIR) \ --install-layout=deb \ --install-scripts=/usr/share/games/pyscrabble/python \ --install-lib=/usr/share/games/pyscrabble/python \ --confdir=/etc/pyscrabble \ --logdir=/var/log/pyscrabble \ --dbdir=/var/lib/pyscrabble install -m755 -d $(DESTDIR)/usr/sbin install -m755 -d $(DESTDIR)/usr/share/pixmaps install -m644 pyscrabble-*.xpm $(DESTDIR)/usr/share/pixmaps install -m755 -d $(DESTDIR)/usr/share/icons/hicolor/scalable/apps gzip < debian/pyscrabble.svg > $(DESTDIR)/usr/share/icons/hicolor/scalable/apps/pyscrabble.svgz for size in $(ICON_SIZES); do \ install -m755 -d $(DESTDIR)/usr/share/icons/hicolor/$${size}x$${size}/apps; \ install -m644 pyscrabble-$$size.png \ $(DESTDIR)/usr/share/icons/hicolor/$${size}x$${size}/apps/pyscrabble.png; \ done install -d -m755 $(DESTDIR)/usr/share/applications/ install -m644 debian/pyscrabble.desktop $(DESTDIR)/usr/share/applications/ # Build architecture-dependent files here. binary-arch: # We have nothing to do by default. # Build architecture-independent files here. binary-indep: build install dh_testdir dh_testroot dh_install --sourcedir=debian/tmp dh_link dh_python2 /usr/share/games/pyscrabble/python dh_installchangelogs CHANGELOG.txt dh_installdocs dh_installexamples dh_installman dh_installinit -r dh_installmenu dh_strip dh_compress dh_fixperms dh_installdeb dh_shlibdeps dh_gencontrol dh_md5sums dh_builddeb binary: binary-indep binary-arch .PHONY: build build-indep build-arch clean binary-indep binary-arch binary install configure debian/watch0000644000000000000000000000011310700023025010177 0ustar version=3 http://sf.net/pyscrabble/pyscrabble-(.*)-src.zip debian uupdate debian/pyscrabble-common.install0000644000000000000000000000135011557075412014200 0ustar usr/share/games/pyscrabble/python/pyscrabble/__*__.py usr/share/games/pyscrabble/python/pyscrabble/audit.py usr/share/games/pyscrabble/python/pyscrabble/dist.py usr/share/games/pyscrabble/python/pyscrabble/manager.py usr/share/games/pyscrabble/python/pyscrabble/util.py usr/share/games/pyscrabble/python/pyscrabble/serialize.py usr/share/games/pyscrabble/python/pyscrabble/constants.py usr/share/games/pyscrabble/python/pyscrabble/lookup.py usr/share/games/pyscrabble/python/pyscrabble/exceptions.py usr/share/games/pyscrabble/python/pyscrabble/game usr/share/games/pyscrabble/python/pyscrabble/command usr/share/games/pyscrabble/python/pyscrabble/net/__init__.py usr/share/games/pyscrabble/python/*.egg-info usr/share/games/pyscrabble/letters debian/changelog0000644000000000000000000001253011741220753011043 0ustar pyscrabble (1.6.2-9) unstable; urgency=low * Switch to rsvg-convert for making PNG icons (Closes: #666634). * Bump Standards-Version to 3.9.3. -- Magnus Holmgren Wed, 11 Apr 2012 08:17:00 +0200 pyscrabble (1.6.2-8) unstable; urgency=low * typeerrors.patch: Fix two cases of attempting to pass floats to functions expecting ints: - In the motion-notify-event callback of the chatboxes, which should change the cursor into a hand when over a URL (LP: #923363). - In the button-press-event callback of the buttons making up the board, which should produce an arrow to allow tiles to be placed by typing letters. -- Magnus Holmgren Sun, 29 Jan 2012 21:02:09 +0100 pyscrabble (1.6.2-7) unstable; urgency=low * max-players.patch: Before denying a player from joining a game because the maximum number of players has been reach, check whether the player is rejoining a game he or she is already part of (Closes: #633838). Thanks to Christian von Kietzell. * Add build-indep and build-arch targets. -- Magnus Holmgren Fri, 11 Nov 2011 08:46:33 +0100 pyscrabble (1.6.2-6) unstable; urgency=low * Move Python modules and scripts to /usr/share/games/pyscrabble/python and put symlinks in /usr/games and /usr/sbin. * installation.patch: Reduce the size by moving back code that was unnecessarily moved from dist.py to setup.py. -- Magnus Holmgren Wed, 04 May 2011 19:58:45 +0200 pyscrabble (1.6.2-5) unstable; urgency=low * Convert package to source format 3.0 (quilt), meaning renaming the patches and converting their headers as well as dropping README.source. * Convert to using dh_python2 (Closes: #616983). * Run setup.py with --install-layout=deb to get filesystem layout right. * Bump Debhelper compat level to 7. * pyscrabble-server.README.Debian: Clarify that pyscrabble-server is not intended to be run from the command line directly (Closes: #611833). * hosts.patch: Improve the code for adding new entries to the Additional Hosts list: * Fix C&P bug that caused the Game port to be validated twice but the Web port not at all. * Pre-fill the default port numbers to help the user (Closes: #566666). * Don't destroy the dialog until the entered values have been extracted. * Increase Standards-Version to 3.9.2 without changes needed. -- Magnus Holmgren Mon, 25 Apr 2011 21:58:25 +0200 pyscrabble (1.6.2-4) unstable; urgency=low * Merge changes from Ubuntu, except for the Replaces added to deal with the typo in in 1.6.2-3ubuntu3, which should be gone by now. * Move pyscrabble-server from /usr/games to /usr/sbin (Closes: #506811). * debian/rules: Drop the call to dh_desktop. * Upgrade to Standards-Version 3.8.3. + Add debian/README.source. * debian/rules: Rearrange targets. -- Magnus Holmgren Tue, 22 Sep 2009 09:15:42 +0200 pyscrabble (1.6.2-3ubuntu4) jaunty; urgency=low * debian/pyscrabble-common.install: resolve typographic error (LP: #362080) -- Brian Murray Thu, 16 Apr 2009 15:18:46 -0700 pyscrabble (1.6.2-3ubuntu3) jaunty; urgency=low * debian/rules: pass --prefix=/usr to setup.py install, without which the package tries to install to /usr/local under python2.6. -- Steve Langasek Tue, 14 Apr 2009 13:01:54 +0000 pyscrabble (1.6.2-3ubuntu2) jaunty; urgency=low * Revert the previous change; python2.4-zodb no longer exists, and depending on python2.4-zodb never gave correct results anyway because we were depending on python instead of python2.4 for the interpreter. * debian/pyscrabble-{common,server}.install: installation now to python dist-packages directory, instead of site-packages. (This will require a fix for bug 350016 in python2.6 before it can be built.) -- Steve Langasek Mon, 13 Apr 2009 07:08:06 +0000 pyscrabble (1.6.2-3ubuntu1) intrepid; urgency=low * Modify dependency python-zodb to python2.4-zodb in debian/control for the python-zodb -> python2.4-zodb transition (LP: #262713) -- Riccardo Coccioli Fri, 29 Aug 2008 18:11:03 +0200 pyscrabble (1.6.2-3) unstable; urgency=low * Acknowledge NMU (Closes: #471077). * New maintainer email address. * Remove XS- from Vcs field names. * Bump Standards-Version to 3.7.3. No changes necessary. * Lower connection timeout when checking servers to avoid extremely long delays (Closes: #473598). Thanks to Ron Bentley. -- Magnus Holmgren Thu, 01 May 2008 23:35:04 +0200 pyscrabble (1.6.2-2.1) unstable; urgency=low * Non-maintainer upload to solve release goal. * Add LSB dependency header to init.d scripts (Closes: #471077). -- Petter Reinholdtsen Sun, 30 Mar 2008 15:18:15 +0200 pyscrabble (1.6.2-2) unstable; urgency=low * Move /usr/share/games/pyscrabble/letters from pyscrabble-server to pyscrabble-common (Closes: #446571). * Add lsb-base dependency to pyscrabble-server. * Lower pyscrabble-server priority to "extra". -- Magnus Holmgren Sun, 14 Oct 2007 10:30:15 +0200 pyscrabble (1.6.2-1) unstable; urgency=low * Initial release (Closes: #416137). -- Magnus Holmgren Wed, 03 Oct 2007 17:11:14 +0200 debian/compat0000644000000000000000000000000211555126607010374 0ustar 7 debian/pyscrabble-server.postinst0000644000000000000000000000046310700023025014415 0ustar #!/bin/sh set -e if [ "$1" = "configure" ]; then adduser --quiet --system --home /var/lib/pyscrabble --no-create-home \ --gecos "PyScrabble server" pyscrabble install -d -opyscrabble -m2750 /var/lib/pyscrabble install -d -opyscrabble -gadm -m2750 /var/log/pyscrabble fi #DEBHELPER# debian/pyscrabble.menu0000644000000000000000000000046210700023025012171 0ustar ?package(pyscrabble):\ needs="X11"\ section="Games/Board"\ title="PyScrabble"\ longtitle="A classic word game"\ command="/usr/games/pyscrabble"\ icon16x16="/usr/share/pixmaps/pyscrabble-16x16.xpm"\ icon32x32="/usr/share/pixmaps/pyscrabble-32x32.xpm" debian/pyscrabble-server.init0000644000000000000000000000537311255771737013534 0ustar #!/bin/sh ### BEGIN INIT INFO # Provides: pyscrabble-server # Required-Start: $local_fs $remote_fs # Required-Stop: $local_fs $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: PyScrabble server # Description: Controls the PyScrabble server ### END INIT INFO set -e PATH=/sbin:/bin:/usr/bin DESC="PyScrabble server" NAME=python NAME2=pyscrabble-server DAEMON=/usr/sbin/pyscrabble-server PIDFILE=/var/run/$NAME2.pid SCRIPTNAME=/etc/init.d/$NAME2 # Gracefully exit if the package has been removed. test -x $DAEMON || exit 0 . /lib/lsb/init-functions USER="pyscrabble" # Read config file if it is present. if [ -r /etc/default/$NAME2 ]; then . /etc/default/$NAME2 fi d_running() { start-stop-daemon --stop --quiet --pidfile $PIDFILE \ --name $NAME --test > /dev/null } # # Function that starts the daemon/service. # d_start() { start-stop-daemon --start --oknodo --quiet --pidfile $PIDFILE --name $NAME \ --background --make-pidfile --chuid "$USER" --startas $DAEMON } # # Function that stops the daemon/service. # d_stop() { start-stop-daemon --stop --oknodo --quiet --pidfile $PIDFILE --name $NAME rm -f $PIDFILE } case "$1" in start) log_daemon_msg "Starting $DESC" "$NAME2" if d_running; then log_progress_msg "already running" else d_start; fi log_end_msg 0 ;; stop) log_daemon_msg "Stopping $DESC" "$NAME2" if ! d_running; then log_progress_msg "not running" else d_stop fi log_end_msg 0 ;; #reload) # # If the daemon can reload its configuration without # restarting (for example, when it is sent a SIGHUP), # then implement that here. # # If the daemon responds to changes in its config file # directly anyway, make this an "exit 0". # # echo -n "Reloading $DESC configuration..." # d_reload # echo "done." #;; restart|force-reload) # # If the "reload" option is implemented, move the "force-reload" # option to the "reload" entry above. If not, "force-reload" is # just the same as "restart". # log_daemon_msg "Restarting $DESC" "$NAME2" d_stop # One second might not be time enough for a daemon to stop, # if this happens, d_start will fail (and dpkg will break if # the package is being upgraded). Change the timeout if needed # be, or change d_stop to have start-stop-daemon use --retry. # Notice that using --retry slows down the shutdown process somewhat. sleep 1 d_start log_end_msg 0 ;; status) d_running || status="not " log_action_msg "Status of $DESC:" "${status}running" ;; *) # echo "Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}" >&2 echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0 debian/source/0000755000000000000000000000000011741220761010467 5ustar debian/source/format0000644000000000000000000000001411555112005011667 0ustar 3.0 (quilt) debian/pyscrabble-server.postrm0000644000000000000000000000032710700023025014055 0ustar #!/bin/sh set -e if [ "$1" = "purge" ]; then rm -rf /var/lib/pyscrabble rm -rf /var/log/pyscrabble if which deluser > /dev/null; then deluser --quiet --system pyscrabble fi fi #DEBHELPER# debian/pyscrabble-server.install0000644000000000000000000000055011557075412014217 0ustar usr/share/games/pyscrabble/python/server_console.py usr/share/games/pyscrabble/python/pyscrabble/db.py usr/share/games/pyscrabble/python/pyscrabble/net/server.py usr/share/games/pyscrabble/python/pyscrabble/net/site.py usr/share/games/pyscrabble/python/pyscrabble/net/interfaces.py usr/share/games/pyscrabble/web usr/share/games/pyscrabble/dict etc/pyscrabble debian/patches/0000755000000000000000000000000011741220761010616 5ustar debian/patches/typeerrors.patch0000644000000000000000000000165111711322712014054 0ustar --- a/pyscrabble/gtkutil.py +++ b/pyscrabble/gtkutil.py @@ -550,7 +550,7 @@ class TaggableTextView(gtk.TextView): @param event: ''' - x,y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, event.x, event.y) + x,y = widget.window_to_buffer_coords(gtk.TEXT_WINDOW_TEXT, int(event.x), int(event.y)) iter = widget.get_iter_at_location(x,y) tags = iter.get_tags() --- a/pyscrabble/gui/pieces.py +++ b/pyscrabble/gui/pieces.py @@ -379,7 +379,7 @@ class GameTile(gtk.Button, Tile): if arrow is not None: box = gtk.HBox(False, 0) arrow.set_size_request(10,10) - arrow.set_padding(0.0, 0.0) + arrow.set_padding(0, 0) box.pack_start(arrow, False, False, 0) self.add(box) self.key_press_handler = self.connect("key-press-event", self.keyPress_cb, self.direction) debian/patches/max-players.patch0000644000000000000000000000327511657151715014120 0ustar From: Christian von Kietzell Bug-Debian: http://bugs.debian.org/633838 Forwarded: no Description: Check whether an existing player is rejoining _before_ checking whether the maximum of players has been reached. --- pyscrabble-1.6.2/pyscrabble/net/server.py 2011-07-14 19:32:42.000000000 +0200 +++ pyscrabble-fixed/pyscrabble/net/server.py 2011-07-14 19:35:50.000000000 +0200 @@ -936,21 +936,21 @@ client.denyJoinGame(command) return - if (game.getNumberOfPlayers() == constants.MAX_PLAYERS): - command.setData( ServerMessage([GAME_FULL]) ) - command.setCommand( constants.GAME_JOIN_DENIED ) - client.denyJoinGame(command) - return - p = self.clients[client].clone() - if (game.isPaused() and not game.hasPlayer(p)): - command.setData( ServerMessage([CANNOT_JOIN_STARTED]) ) - command.setCommand( constants.GAME_JOIN_DENIED ) - client.denyJoinGame(command) - return - if not game.hasPlayer( p ): + if (game.getNumberOfPlayers() == constants.MAX_PLAYERS): + command.setData( ServerMessage([GAME_FULL]) ) + command.setCommand( constants.GAME_JOIN_DENIED ) + client.denyJoinGame(command) + return + + if (game.isPaused()): + command.setData( ServerMessage([CANNOT_JOIN_STARTED]) ) + command.setCommand( constants.GAME_JOIN_DENIED ) + client.denyJoinGame(command) + return + game.addPlayer( p ) else: game.removePending( p ) debian/patches/hosts.patch0000644000000000000000000000326011555350206013001 0ustar Author: Magnus Holmgren Description: Improve the code for adding new entries to the Additional Hosts list - Fix C&P bug that caused the Game port to be validated twice but the Web port not at all. - Pre-fill the default ports. - Don't destroy the dialog until the entered values have been extracted. --- a/pyscrabble/gui/options.py +++ b/pyscrabble/gui/options.py @@ -830,10 +830,12 @@ class OptionWindow(gtk.Window): s = _("Game port") gport = gtkutil.EntryWithLabel(label="%s: " % s, visibility=True) + gport.set_text("9999") dialog.vbox.pack_start( gport ) s = _("Web port") wport = gtkutil.EntryWithLabel(label="%s: " % s, visibility=True) + wport.set_text("8888") dialog.vbox.pack_start( wport ) s = _("Location") @@ -866,13 +868,11 @@ class OptionWindow(gtk.Window): try: int(gport.get_text()) - int(gport.get_text()) + int(wport.get_text()) except: self.error(util.ErrorMessage(_('Port must be a number'))) return - dialog.destroy() - o = manager.OptionManager(section=HOSTS_SECTION) data = o.get_default_option(OPTION_HOSTS, '') data = '%s%s:%s:%s:%s/' % (data, host.get_text(), gport.get_text(), wport.get_text(), location.get_text()) @@ -882,4 +882,5 @@ class OptionWindow(gtk.Window): model.clear() for host,gport,wport,location in util.getAdditionalHosts(): model.append( (host,location) ) - \ No newline at end of file + + dialog.destroy() debian/patches/serverlist_timeout.patch0000644000000000000000000000160611555112005015604 0ustar Author: Ron Bentley Bug-Debian: http://bugs.debian.org/473598 Description: Lower connection timeout when building server list to avoid hanging for a long time when one or more servers are unresponsive. --- pyscrabble-1.6.2~/pyscrabble/gui/register.py 2008-04-20 23:14:07.000000000 -0400 +++ pyscrabble-1.6.2/pyscrabble/gui/register.py 2008-04-20 23:18:25.000000000 -0400 @@ -62,6 +62,9 @@ return self.serverList.clear() + + defTimeout = socket.getdefaulttimeout() + socket.setdefaulttimeout(6) for host,g_port,w_port,location in self.servers: @@ -73,6 +76,8 @@ numUsers="N/A" self.serverList.append( (host,location, numUsers) ) + + socket.setdefaulttimeout(defTimeout) self.toolBar.set_sensitive(True) debian/patches/series0000644000000000000000000000015511711322712012030 0ustar installation.patch about_close.patch serverlist_timeout.patch hosts.patch max-players.patch typeerrors.patch debian/patches/installation.patch0000755000000000000000000001644611560311761014356 0ustar Author: Magnus Holmgren Description: Mostly adapt server to run as a daemon --- a/pyscrabble/net/server.py +++ b/pyscrabble/net/server.py @@ -46,7 +46,7 @@ class ScrabbleServerFactory(protocol.Ser self.db = db.DB() self.maxUsersLoggedIn = 0 self.startDate = util.Time(seconds=time.time(), dispDate=True) - self.rankings = rank.Rankings( resources["config"][constants.RANK_CONFIG] ) + self.rankings = rank.Rankings( resources["serverconfig"][constants.RANK_CONFIG] ) dir = resources["resources"][constants.DICT_DIR].path for lang in os.listdir( dir ): --- a/pyscrabble/dist.py +++ b/pyscrabble/dist.py @@ -3,6 +3,8 @@ import os import sys from distutils.command.install_lib import install_lib from distutils.command.install_scripts import install_scripts +from distutils.command.install_data import install_data +from distutils.command.install import install APP_NAME = 'pyscrabble' @@ -31,8 +33,6 @@ except ImportError: RESOURCE_PREFIX = 'resources' CONFIG_DIR = get_app_data_dir() -if not os.path.exists(CONFIG_DIR): - CONFIG_DIR = os.path.join(RESOURCE_PREFIX, 'config') def getLocaleDirs(dir, domain): l = [] @@ -76,6 +76,13 @@ def getDataFiles(): getResourceDirs('resources/dict', True, 'resources') + \ getResourceDirs('resources/letters', True, 'resources') +try: + from __installed__ import SERVER_LOG_DIR, SERVER_DB_DIR, SERVER_CONFIG_DIR +except ImportError: + SERVER_CONFIG_DIR = os.path.join(RESOURCE_PREFIX, 'config') + SERVER_DB_DIR = CONFIG_DIR + SERVER_LOG_DIR = CONFIG_DIR + def ensure_config_dir(dir): ''' Ensure config directory exists @@ -112,11 +119,14 @@ class InstallLib(install_lib): self.mkpath(os.path.dirname(filename)) install = self.distribution.get_command_obj('install') - datadir = os.path.join(install.prefix, 'share', APP_NAME) + datadir = os.path.join(install.prefix, 'share', 'games', APP_NAME) fp = open(filename, 'w') fp.write('# Generated by setup.py do not modify\n') - fp.write("RESOURCE_PREFIX = '%s'\n" % datadir) + fp.write("RESOURCE_PREFIX = %r\n" % datadir) + fp.write("SERVER_CONFIG_DIR = %r\n" % install.confdir) + fp.write("SERVER_DB_DIR = %r\n" % install.dbdir) + fp.write("SERVER_LOG_DIR = %r\n" % install.logdir) fp.close() return filename @@ -125,6 +135,35 @@ class InstallLib(install_lib): template = self.generate_template() return install_lib.install(self) + [template] +class InstallData(install_data): + def fix_path(self, item): + install = self.distribution.get_command_obj('install') + if type(item) in (list, tuple): + if 'config' in item[0]: + return (item[0].replace('config', install.confdir), item[1]) + else: + return (item[0].replace('resources', 'share/games/'+APP_NAME), item[1]) + else: + return item + + def finalize_options(self): + self.data_files = [ self.fix_path(f) for f in self.data_files ] + install_data.finalize_options(self) + +class Install(install): + user_options = install.user_options + [ ('logdir=', None, "log directory"), + ('dbdir=', None, "database directory"), + ('confdir=', None, "configuration directory") ] + + def initialize_options(self): + self.logdir = None + self.dbdir = None + self.confdir = None + install.initialize_options(self) + + def finalize_options(self): + install.finalize_options(self) + class Resource(object): ''' Filesystem resource @@ -180,4 +219,4 @@ class Resource(object): @param value: ''' self.data[item] = value - \ No newline at end of file + --- a/pyscrabble/db.py +++ b/pyscrabble/db.py @@ -1,5 +1,4 @@ from pyscrabble import constants -from pyscrabble import manager from ZODB import FileStorage, DB as _DB import transaction @@ -12,8 +11,10 @@ class DB(object): ''' Initialize the connection to the DB ''' - r = manager.ResourceManager() - path = r["config"][constants.DB_LOCATION] + import os + from pyscrabble import dist + + path = os.path.join(dist.SERVER_DB_DIR, constants.DB_LOCATION) storage = FileStorage.FileStorage(path) db = _DB(storage) --- a/pyscrabble/manager.py +++ b/pyscrabble/manager.py @@ -36,6 +36,7 @@ class ResourceManager(object): ''' self.loaded = True + self["serverconfig"] = dist.Resource( dist.SERVER_CONFIG_DIR ) self["config"] = dist.Resource( dist.CONFIG_DIR ) self["resources"] = dist.Resource( dist.RESOURCE_PREFIX ) --- a/server_console.py +++ b/server_console.py @@ -76,15 +76,15 @@ class ServerConsole(object): ''' Configure the server ''' - dist.ensure_config_dir(dist.CONFIG_DIR) + dist.ensure_config_dir(dist.SERVER_CONFIG_DIR) resources = manager.ResourceManager() logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(name)s %(levelname)s %(message)s', - filename=resources["config"][constants.LOG_FILE], - filemode='w') + filename=os.path.join(dist.SERVER_LOG_DIR, constants.LOG_FILE), + filemode='a') - config = resources["config"][constants.SERVER_CONSOLE_CONFIG] + config = resources["serverconfig"][constants.SERVER_CONSOLE_CONFIG] if not os.path.exists(config): raise IOError, "%s must exist in %s" % (constants.SERVER_CONSOLE_CONFIG, resources["config"].path) --- a/setup.py +++ b/setup.py @@ -7,21 +7,12 @@ except ImportError: HAS_PY2EXE = False import glob import os -import pkg_resources +#import pkg_resources import sys from pyscrabble.constants import VERSION from pyscrabble import util from pyscrabble import dist -def fix_path(item): - if type(item) in (list, tuple): - if 'config' in item[0]: - return (item[0].replace('config', dist.get_app_data_dir()), item[1]) - else: - return (item[0].replace('resources/', 'share/pyscrabble/'), item[1]) - else: - return item - kwargs = { 'name': 'pyscrabble', 'version': VERSION, @@ -80,7 +71,7 @@ if HAS_PY2EXE and 'py2exe' in sys.argv: # kwargs['data_files'] += dist.getResourceDirs(egg.location, ensureLower=False, basePath=None, outdir='extra') else: kwargs['scripts'] = ['pyscrabble-main.py', 'server_console.py', 'db_upgrade.py'] - kwargs['data_files'] = [fix_path(x) for x in kwargs['data_files']] - kwargs['cmdclass'] = {'install_lib': dist.InstallLib, 'install_scripts' : dist.InstallScripts} + # kwargs['data_files'] = [fix_path(x) for x in kwargs['data_files']] + kwargs['cmdclass'] = {'install': dist.Install, 'install_lib': dist.InstallLib, 'install_scripts' : dist.InstallScripts, 'install_data': dist.InstallData} -setup(**kwargs) \ No newline at end of file +setup(**kwargs) debian/patches/about_close.patch0000755000000000000000000000116611555112005014137 0ustar Author: Magnus Holmgren Description: Make the Close button in the About dialog work diff -urNad trunk~/pyscrabble/gtkutil.py trunk/pyscrabble/gtkutil.py --- trunk~/pyscrabble/gtkutil.py 2006-12-05 15:49:00.000000000 +0100 +++ trunk/pyscrabble/gtkutil.py 2007-10-03 16:30:51.000000000 +0200 @@ -73,6 +73,7 @@ dialog.set_translator_credits(_('translator-credits')) gtk.about_dialog_set_url_hook(util.showUrl, data=constants.ONLINE_SITE) dialog.set_version(constants.VERSION) + dialog.connect("response", lambda d, r: d.destroy()) dialog.show() def getSelectedItem(view, col): debian/copyright0000644000000000000000000000231310700023025011105 0ustar This package was debianized by Magnus Holmgren on 2006-09-20. It was downloaded from Upstream Author: Kevin Conaway Copyright: Copyright © 2005-2007 Kevin Conaway License: This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA On Debian systems, the complete text of the GNU General Public License can be found in `/usr/share/common-licenses/GPL'. The Debian packaging is © 2007, Magnus Holmgren and is licensed under the GPL, see above. debian/pyscrabble.install0000644000000000000000000000056511557075412012721 0ustar usr/share/games/pyscrabble/python/pyscrabble-main.py usr/share/games/pyscrabble/python/pyscrabble/gui usr/share/games/pyscrabble/python/pyscrabble/net/client.py usr/share/games/pyscrabble/python/pyscrabble/gtk*.py usr/share/icons usr/share/pixmaps usr/share/applications usr/share/games/pyscrabble/sounds usr/share/games/pyscrabble/images usr/share/games/pyscrabble/locale debian/pyscrabble-server.default0000644000000000000000000000043210700023025014152 0ustar # This file will be sourced by /etc/init.d/pyscrabble-server # The user the server will run as. You'll have to make sure that the # user exists yourself. #USER=pyscrabble # You can change the name of the PID file that the init script uses. #PIDFILE=/var/run/pyscrabble-server.pid debian/pyscrabble-server.README.Debian0000644000000000000000000000222511555261203014661 0ustar pyscrabble for Debian --------------------- My assumption is that most users don't need or want to run their own server. Therefore the PyScrabble server is in a separate package that installs it as a system daemon. By default the server runs under a dedicated user account, created on installation. It should not be run directly from the command line, only with the help of the init script. The original code is modified so that instead of ~/.config/pyscrabble/, the server reads its configuration from files in /etc/pyscrabble/, stores its database in /var/lib/pyscrabble, and logs to /var/log/pyscrabble/pyscrabble.log. The log is not automatically rotated, because the server can't currently be told to reopen the log, and restarting it kills all client sessions and ongoing games. For the same reason, the server is not restarted when upgraded. The administrator should notify the users and restart the server at the earliest opportunity. After starting the server for the first time, you should immediately register a user account, as the first user is automatically made administrator. -- Magnus Holmgren , Mon, 25 Apr 2011 14:00:03 +0200 debian/pyscrabble.svg0000644000000000000000000003054310700023025012027 0ustar