From f84644990bf4ff1743e82db23c1d8562523ac3c5 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 22 Aug 2009 17:36:44 +0300 Subject: [PATCH 1/6] Debian packaging, step #1 * add setup.py for python distutils use * add packaging/debian/* Not ready yet, but at least seems to behave sanely --- packaging/debian/changelog | 5 +++++ packaging/debian/compat | 1 + packaging/debian/control | 24 ++++++++++++++++++++ packaging/debian/copyright | 7 ++++++ packaging/debian/links | 1 + packaging/debian/pyversions | 1 + packaging/debian/rules | 45 +++++++++++++++++++++++++++++++++++++ setup.py | 17 ++++++++++++++ 8 files changed, 101 insertions(+) create mode 100644 packaging/debian/changelog create mode 100644 packaging/debian/compat create mode 100644 packaging/debian/control create mode 100644 packaging/debian/copyright create mode 100644 packaging/debian/links create mode 100644 packaging/debian/pyversions create mode 100755 packaging/debian/rules create mode 100644 setup.py diff --git a/packaging/debian/changelog b/packaging/debian/changelog new file mode 100644 index 00000000..994884c6 --- /dev/null +++ b/packaging/debian/changelog @@ -0,0 +1,5 @@ +free-poker-tools (0.10.99) unstable; urgency=low + + * Initial packaging release. + + -- Mika Bostrom Thu, 20 Aug 2009 06:30:53 +0300 diff --git a/packaging/debian/compat b/packaging/debian/compat new file mode 100644 index 00000000..7f8f011e --- /dev/null +++ b/packaging/debian/compat @@ -0,0 +1 @@ +7 diff --git a/packaging/debian/control b/packaging/debian/control new file mode 100644 index 00000000..f557711a --- /dev/null +++ b/packaging/debian/control @@ -0,0 +1,24 @@ +Source: free-poker-tools +Maintainer: Mika Bostrom +Section: games +Priority: optional +Build-Depends: python, dpkg-dev, python-support +Standards-Version: 3.8.0 + +Package: python-fpdb +Architecture: any +Section: games +Priority: optional +Depends: ${python:Depends}, python-gtk2, python-matplotlib, + python-support, mysql-server | postgresql | python-pysqlite2, + python-psycopg2 | python-mysqldb +Suggests: wine +Description: free poker database with HUD + FPDB is a statistics tool for online poker. It supports most sites + and several games. Most prominent feature is its heads-up display + (HUD) which shows statistical details for players in real time. + . + Due to the fact that most online poker clients are Windows-only, + you may need to install wine. + . + FPDB is under heavy development. diff --git a/packaging/debian/copyright b/packaging/debian/copyright new file mode 100644 index 00000000..8796c11a --- /dev/null +++ b/packaging/debian/copyright @@ -0,0 +1,7 @@ +This package was debianised by Mika Bostrom + +Upstream authors: ... + +License: AGPL + +Copyright (C) 2008- The FPDB developers diff --git a/packaging/debian/links b/packaging/debian/links new file mode 100644 index 00000000..5a4601a7 --- /dev/null +++ b/packaging/debian/links @@ -0,0 +1 @@ +/usr/share/pyshared/fpdb/fpdb.py /usr/bin/fpdb diff --git a/packaging/debian/pyversions b/packaging/debian/pyversions new file mode 100644 index 00000000..8b253bc3 --- /dev/null +++ b/packaging/debian/pyversions @@ -0,0 +1 @@ +2.4- diff --git a/packaging/debian/rules b/packaging/debian/rules new file mode 100755 index 00000000..2ae2c776 --- /dev/null +++ b/packaging/debian/rules @@ -0,0 +1,45 @@ +#!/usr/bin/make -f +# -*- makefile -*- + +PACKAGE := python-fpdb + +build: build-stamp +build-stamp: + dh_testdir + python setup.py build + touch $@ + +clean: + dh_testdir + dh_testroot + python setup.py clean + rm -rf build + dh_clean build-stamp + +install: build + dh_testdir + dh_testroot + dh_prep || dh_clean -k + dh_installdirs + # + python setup.py install --root=debian/$(PACKAGE) --prefix=/usr --no-compile + +binary-indep: build install + dh_testdir + dh_testroot + dh_installchangelogs + dh_installdocs + dh_link + dh_compress + dh_fixperms + dh_pysupport + dh_installdeb + dh_gencontrol + dh_md5sums + dh_builddeb + +binary-arch: build install + +binary: binary-indep binary-arch +.PHONY: build clean binary-indep binary-arch binary install + diff --git a/setup.py b/setup.py new file mode 100644 index 00000000..668693cf --- /dev/null +++ b/setup.py @@ -0,0 +1,17 @@ +# setup.py +# Python packaging for fpdb + +from distutils.core import setup + +setup(name = 'fpdb', + description = 'Free Poker Database', + version = '0.10.999', + author = 'FPDB team', + author_email = 'fpdb-main@lists.sourceforge.net', + packages = ['fpdb'], + package_dir = { 'fpdb' : 'pyfpdb' }, + data_files = [ + ('/usr/share/doc/python-fpdb', + ['docs/readme.txt', 'docs/release-notes.txt', + 'docs/tabledesign.html', 'THANKS.txt'])] +) From ae0612370d229b886c212d390b47ea79dd65c67d Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 22 Aug 2009 22:47:27 +0300 Subject: [PATCH 2/6] Packaging fixes * It seems that fpdb gets installed into /usr/share/python-support/ while many other packages end up in .../pyshared; fixed the symlink target * Fixed mail address in changelog, which now is the correct one * Added postinst script to make fpdb.py executable again. This hack is needed because dh_fixperms didn't allow to ignore the script's permissions and the file is located in .../fpdb/ along with all the other fpdb modules * Told package manager to create /usr/bin/fpdb symlink pointing to fpdb.py so we now have an application named "fpdb" in the system --- packaging/debian/changelog | 2 +- packaging/debian/links | 2 +- packaging/debian/python-fpdb.postinst | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 packaging/debian/python-fpdb.postinst diff --git a/packaging/debian/changelog b/packaging/debian/changelog index 994884c6..84ecbce5 100644 --- a/packaging/debian/changelog +++ b/packaging/debian/changelog @@ -2,4 +2,4 @@ free-poker-tools (0.10.99) unstable; urgency=low * Initial packaging release. - -- Mika Bostrom Thu, 20 Aug 2009 06:30:53 +0300 + -- Mika Bostrom Thu, 20 Aug 2009 06:30:53 +0300 diff --git a/packaging/debian/links b/packaging/debian/links index 5a4601a7..01d1c490 100644 --- a/packaging/debian/links +++ b/packaging/debian/links @@ -1 +1 @@ -/usr/share/pyshared/fpdb/fpdb.py /usr/bin/fpdb +/usr/share/python-support/python-fpdb/fpdb/fpdb.py /usr/bin/fpdb diff --git a/packaging/debian/python-fpdb.postinst b/packaging/debian/python-fpdb.postinst new file mode 100644 index 00000000..1f618958 --- /dev/null +++ b/packaging/debian/python-fpdb.postinst @@ -0,0 +1,5 @@ +#!/bin/sh + +# When installed into .../fpdb/ the script gets mode 644 +# Note: "dh_fixperms -Xfpdb.py" did not work, hence this hack +chmod 755 /usr/bin/fpdb From d43954bc5f22b26b6dadb64ea01011d81f4133ca Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 22 Aug 2009 23:05:18 +0300 Subject: [PATCH 3/6] Clean up debian/control Drop unneeded and already covered dependencies. Change package priority from optional to extra, which makes more sense. --- packaging/debian/control | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packaging/debian/control b/packaging/debian/control index f557711a..93660791 100644 --- a/packaging/debian/control +++ b/packaging/debian/control @@ -1,14 +1,14 @@ Source: free-poker-tools Maintainer: Mika Bostrom Section: games -Priority: optional -Build-Depends: python, dpkg-dev, python-support +Priority: extra +Build-Depends: debhelper, python-support Standards-Version: 3.8.0 Package: python-fpdb Architecture: any Section: games -Priority: optional +Priority: extra Depends: ${python:Depends}, python-gtk2, python-matplotlib, python-support, mysql-server | postgresql | python-pysqlite2, python-psycopg2 | python-mysqldb From f4e6de744a877137b1f6ec93dd2581e197660e79 Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sun, 23 Aug 2009 10:18:06 +0300 Subject: [PATCH 4/6] Fix noop() prototype Hud's noop() is called from gtk event handler, which passes additional arguments. We don't care about them but we do want to prevent HUD-error.txt from being flooded with TypeError messages. --- pyfpdb/Hud.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/Hud.py b/pyfpdb/Hud.py index 41154c13..e0e14689 100644 --- a/pyfpdb/Hud.py +++ b/pyfpdb/Hud.py @@ -423,7 +423,7 @@ class Stat_Window: return True return False - def noop(self): # i'm going to try to connect the focus-in and focus-out events here, to see if that fixes any of the focus problems. + def noop(self, *args): # i'm going to try to connect the focus-in and focus-out events here, to see if that fixes any of the focus problems. return True def kill_popup(self, popup): From 84dc9652dfed22acd5d93f31793043d53e6733dd Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 19 Sep 2009 11:10:07 +0300 Subject: [PATCH 5/6] Fix table creation for Postgres PostgreSQL does not have an UNSIGNED specifier in its language. Mysql's "TINYINT UNSIGNED" is postgreSQL's "SMALLINT" which is a bit inconvenient but apart from annoying, not a problem. --- pyfpdb/SQL.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyfpdb/SQL.py b/pyfpdb/SQL.py index c8639fbc..986f9762 100644 --- a/pyfpdb/SQL.py +++ b/pyfpdb/SQL.py @@ -400,7 +400,7 @@ class Sql: endTime timestamp without time zone, buyinChips INT, tourneyName varchar(40), - matrixIdProcessed SMALLINT UNSIGNED DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ + matrixIdProcessed SMALLINT DEFAULT 0, /* Mask use : 1=Positionnal Winnings|2=Match1|4=Match2|...|pow(2,n)=Matchn */ rebuyChips INT DEFAULT 0, addonChips INT DEFAULT 0, rebuyAmount INT DEFAULT 0, From e54c45b7d1b8bbb59526cc7d99e8700e58f81bbb Mon Sep 17 00:00:00 2001 From: Mika Bostrom Date: Sat, 19 Sep 2009 11:44:06 +0300 Subject: [PATCH 6/6] Fix database creation with Postgres * Database.py : fillDefaultData() PostgreSQL has a rather annoying (mis)feature when dealing with boolean data types: raw 1/0 input as integer is not automatically cast to boolean values. Instead, one must use one of several other ways of signifying true/false. http://www.postgresql.org/docs/8.4/static/datatype-boolean.html documents the available and understood formatting. Fix by special-casing PostgreSQL and making all boolean values fed as strings, '1' for true and '0' for false. --- pyfpdb/Database.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyfpdb/Database.py b/pyfpdb/Database.py index f4de8169..53e2a10e 100755 --- a/pyfpdb/Database.py +++ b/pyfpdb/Database.py @@ -1014,6 +1014,8 @@ class Database: c.execute("INSERT INTO Sites (name,currency) VALUES ('PartyPoker', 'USD')") if self.backend == self.SQLITE: c.execute("INSERT INTO TourneyTypes (id, siteId, buyin, fee) VALUES (NULL, 1, 0, 0);") + elif self.backend == self.PGSQL: + c.execute("insert into TourneyTypes values (0,1,0,0,0,'0','0',null,'0','0','0');") else: c.execute("insert into TourneyTypes values (0,1,0,0,0,0,0,null,0,0,0);")