Subversion Repositories pyscrabble

Compare Revisions

Ignore whitespace Rev 26 → Rev 27

/trunk/debian/README.source
File deleted
/trunk/debian/control
2,7 → 2,7
Section: games
Priority: optional
Maintainer: Magnus Holmgren <holmgren@debian.org>
Build-Depends: debhelper (>= 5.0.38), dpatch, python
Build-Depends: debhelper (>= 5.0.38), python
Build-Depends-Indep: python-central (>= 0.5.6), librsvg2-bin, imagemagick
Standards-Version: 3.8.3
Homepage: http://pyscrabble.sourceforge.net
/trunk/debian/changelog
1,3 → 1,11
pyscrabble (1.6.2-5) UNRELEASED; urgency=low
 
* Convert package to source format 3.0 (quilt), meaning renaming the
patches and converting their headers as well as dropping
README.source.
 
-- Magnus Holmgren <holmgren@debian.org> Sun, 24 Apr 2011 23:19:46 +0200
 
pyscrabble (1.6.2-4) unstable; urgency=low
 
* Merge changes from Ubuntu, except for the Replaces added to deal with
/trunk/debian/patches/20_serverlist_timeout.dpatch
File deleted
/trunk/debian/patches/10_installation.dpatch
File deleted
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: debian/patches/00list
===================================================================
--- debian/patches/00list (revision 26)
+++ debian/patches/00list (nonexistent)
@@ -1,3 +0,0 @@
-10_installation
-20_about_close
-20_serverlist_timeout
Index: debian/patches/20_about_close.dpatch
===================================================================
--- debian/patches/20_about_close.dpatch (revision 26)
+++ debian/patches/20_about_close.dpatch (nonexistent)
@@ -1,18 +0,0 @@
-#!/bin/sh /usr/share/dpatch/dpatch-run
-## 20_about_close.dpatch by Magnus Holmgren <magnus@kibibyte.se>
-##
-## All lines beginning with `## DP:' are a description of the patch.
-## DP: Make the Close button in the About dialog work
-
-@DPATCH@
-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/patches/20_about_close.dpatch
Property changes:
Deleted: svn:executable
## -1 +0,0 ##
-*
\ No newline at end of property
Index: debian/patches/installation.patch
===================================================================
--- debian/patches/installation.patch (nonexistent)
+++ debian/patches/installation.patch (revision 27)
@@ -0,0 +1,347 @@
+Author: Magnus Holmgren <holmgren@debian.org>
+Description: Mostly adapt server to run as a daemon
+
+--- pyscrabble-1.6.2.orig/pyscrabble/net/server.py
++++ pyscrabble-1.6.2/pyscrabble/net/server.py
+@@ -46,7 +46,7 @@
+ 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 ):
+--- pyscrabble-1.6.2.orig/pyscrabble/dist.py
++++ pyscrabble-1.6.2/pyscrabble/dist.py
+@@ -1,8 +1,6 @@
+ import glob
+ import os
+ import sys
+-from distutils.command.install_lib import install_lib
+-from distutils.command.install_scripts import install_scripts
+
+ APP_NAME = 'pyscrabble'
+
+@@ -31,50 +29,13 @@
+ 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 = []
+-
+- langs = os.listdir( dir )
+- for lang in langs:
+- d = os.path.join(dir,lang,"LC_MESSAGES")
+- path = os.path.join(d, '%s.mo' % domain)
+- l.append( (d,[path]) )
+-
+- return l
+-
+-def getResourceDirs(dir, ensureLower=True, basePath = None, outdir=None):
+- result = []
+- absolute = os.path.abspath(dir)
+-
+- base = basePath
+- if base is None:
+- base = os.path.dirname(absolute)
+- else:
+- base = os.path.dirname( os.path.abspath(base) )
+-
+- for root, dirs, files in os.walk(absolute):
+- if ensureLower and not os.path.basename(root).islower(): continue
+- if len(files) > 0:
+- f = []
+- d = root[len(base)+1:]
+- if outdir is not None:
+- d = os.path.join(outdir, d)
+- for file in files:
+- f.append( os.path.join(root, file) )
+- result.append( (d, f) )
+- return result
+-
+-def getDataFiles():
+- return getLocaleDirs('resources/locale',APP_NAME) + \
+- [('resources/images', glob.glob('resources/images/*.*')), \
+- ('resources/sounds', glob.glob('resources/sounds/*.*')), \
+- ('config', glob.glob('resources/config/*.cfg')), \
+- ('resources/web', glob.glob('resources/web/*.*'))] + \
+- 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):
+ '''
+@@ -86,45 +47,6 @@
+ os.makedirs(dir)
+
+
+-class InstallScripts(install_scripts):
+- '''
+- install_scripts handler to strip any possible ^M's from files so they will run properly on unix
+- '''
+-
+- def run(self):
+- install_scripts.run(self)
+- for file in self.get_outputs():
+- self.fix(file)
+-
+- def fix(self, path):
+- f = open(path, "rb")
+- data = f.read().replace("\r\n", "\n")
+- f.close()
+- f = open(path, "w")
+- f.write(data)
+- f.close()
+-
+-
+-class InstallLib(install_lib):
+-
+- def generate_template(self):
+- filename = os.path.join(self.build_dir, APP_NAME, '__installed__.py')
+- self.mkpath(os.path.dirname(filename))
+-
+- install = self.distribution.get_command_obj('install')
+- datadir = os.path.join(install.prefix, 'share', APP_NAME)
+-
+- fp = open(filename, 'w')
+- fp.write('# Generated by setup.py do not modify\n')
+- fp.write("RESOURCE_PREFIX = '%s'\n" % datadir)
+- fp.close()
+-
+- return filename
+-
+- def install(self):
+- template = self.generate_template()
+- return install_lib.install(self) + [template]
+-
+ class Resource(object):
+ '''
+ Filesystem resource
+--- pyscrabble-1.6.2.orig/pyscrabble/db.py
++++ pyscrabble-1.6.2/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 @@
+ '''
+ 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)
+--- pyscrabble-1.6.2.orig/pyscrabble/manager.py
++++ pyscrabble-1.6.2/pyscrabble/manager.py
+@@ -36,6 +36,7 @@
+ '''
+ 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 )
+
+--- pyscrabble-1.6.2.orig/server_console.py
++++ pyscrabble-1.6.2/server_console.py
+@@ -76,15 +76,15 @@
+ '''
+ 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)
+--- pyscrabble-1.6.2.orig/setup.py
++++ pyscrabble-1.6.2/setup.py
+@@ -7,20 +7,130 @@
+ HAS_PY2EXE = False
+ import glob
+ import os
+-import pkg_resources
++#import pkg_resources
+ 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
+ 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])
++
++def getLocaleDirs(dir, domain):
++ l = []
++
++ langs = os.listdir( dir )
++ for lang in langs:
++ d = os.path.join(dir,lang,"LC_MESSAGES")
++ path = os.path.join(d, '%s.mo' % domain)
++ l.append( (d,[path]) )
++
++ return l
++
++def getResourceDirs(dir, ensureLower=True, basePath = None, outdir=None):
++ result = []
++ absolute = os.path.abspath(dir)
++
++ base = basePath
++ if base is None:
++ base = os.path.dirname(absolute)
+ else:
+- return item
++ base = os.path.dirname( os.path.abspath(base) )
++
++ for root, dirs, files in os.walk(absolute):
++ if ensureLower and not os.path.basename(root).islower(): continue
++ if len(files) > 0:
++ f = []
++ d = root[len(base)+1:]
++ if outdir is not None:
++ d = os.path.join(outdir, d)
++ for file in files:
++ f.append( os.path.join(root, file) )
++ result.append( (d, f) )
++ return result
++
++def getDataFiles():
++ return getLocaleDirs('resources/locale',dist.APP_NAME) + \
++ [('resources/images', glob.glob('resources/images/*.*')), \
++ ('resources/sounds', glob.glob('resources/sounds/*.*')), \
++ ('config', glob.glob('resources/config/*.cfg')), \
++ ('resources/web', glob.glob('resources/web/*.*'))] + \
++ getResourceDirs('resources/dict', True, 'resources') + \
++ getResourceDirs('resources/letters', True, 'resources')
++
++class InstallScripts(install_scripts):
++ '''
++ install_scripts handler to strip any possible ^Ms from files so they will run properly on unix
++ '''
++
++ def run(self):
++ install_scripts.run(self)
++ for file in self.get_outputs():
++ self.fix(file)
++
++ def fix(self, path):
++ f = open(path, "rb")
++ data = f.read().replace("\r\n", "\n")
++ f.close()
++ f = open(path, "w")
++ f.write(data)
++ f.close()
++
++
++class InstallLib(install_lib):
++
++ def generate_template(self):
++ filename = os.path.join(self.build_dir, dist.APP_NAME, '__installed__.py')
++ self.mkpath(os.path.dirname(filename))
++
++ install = self.distribution.get_command_obj('install')
++ datadir = os.path.join(install.prefix, 'share', 'games', dist.APP_NAME)
++
++ fp = open(filename, 'w')
++ fp.write('# Generated by setup.py do not modify\n')
++ 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
++
++ def install(self):
++ 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/pyscrabble/'), 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):
++ print self.logdir
++ install.finalize_options(self)
+
+ kwargs = {
+ 'name': 'pyscrabble',
+@@ -28,7 +138,7 @@
+ 'author': 'Kevin Conaway',
+ 'author_email': 'kevin.a.conaway@gmail.com',
+ 'url': 'http://pyscrabble.sourceforge.net',
+- 'data_files': dist.getDataFiles(),
++ 'data_files': getDataFiles(),
+ 'packages': ['pyscrabble', 'pyscrabble.command', 'pyscrabble.game', 'pyscrabble.gui', 'pyscrabble.net']
+ }
+
+@@ -77,10 +187,10 @@
+ kwargs['data_files'] += [('.', ['CHANGELOG.txt'])]
+ kwargs['data_files'] += [('.', ['LICENSE.txt'])]
+ #for egg in eggpacks:
+- # kwargs['data_files'] += dist.getResourceDirs(egg.location, ensureLower=False, basePath=None, outdir='extra')
++ # kwargs['data_files'] += 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': Install, 'install_lib': InstallLib, 'install_scripts' : InstallScripts, 'install_data': InstallData}
+
+-setup(**kwargs)
+\ No newline at end of file
++setup(**kwargs)
/debian/patches/installation.patch
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: debian/patches/serverlist_timeout.patch
===================================================================
--- debian/patches/serverlist_timeout.patch (nonexistent)
+++ debian/patches/serverlist_timeout.patch (revision 27)
@@ -0,0 +1,26 @@
+Author: Ron Bentley <rtbentley@gmail.com>
+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)
+
Index: debian/patches/series
===================================================================
--- debian/patches/series (nonexistent)
+++ debian/patches/series (revision 27)
@@ -0,0 +1,3 @@
+installation.patch
+about_close.patch
+serverlist_timeout.patch
Index: debian/patches/about_close.patch
===================================================================
--- debian/patches/about_close.patch (nonexistent)
+++ debian/patches/about_close.patch (revision 27)
@@ -0,0 +1,14 @@
+Author: Magnus Holmgren <holmgren@debian.org>
+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/patches/about_close.patch
Property changes:
Added: svn:executable
## -0,0 +1 ##
+*
\ No newline at end of property
Index: debian/rules
===================================================================
--- debian/rules (revision 26)
+++ debian/rules (revision 27)
@@ -13,13 +13,7 @@
ICON_SIZES=16 22 32 48 64 96
PIXMAP_SIZES=16 32
-include /usr/share/dpatch/dpatch.make
-
-unpatch: clean-patched
-clean: unpatch
- dh_clean
-
-clean-patched: patch-stamp
+clean:
dh_testdir
dh_testroot
rm -f build-stamp
@@ -27,9 +21,10 @@
python setup.py clean -a
find -name '*.pyc' -delete
+ dh_clean
build: build-stamp
-build-stamp: patch-stamp
+build-stamp:
python setup.py build
for size in $(ICON_SIZES); do \
/trunk/debian/source/format
0,0 → 1,0
3.0 (quilt)