Index: python/py-mysql/files/patch-site.cfg.diff
===================================================================
--- python/py-mysql/files/patch-site.cfg.diff	(revision 0)
+++ python/py-mysql/files/patch-site.cfg.diff	(working copy)
@@ -0,0 +1,11 @@
+--- a/site.cfg	2011-12-12 12:05:40.000000000 -0800
++++ b/site.cfg	2011-12-12 12:14:01.000000000 -0800
+@@ -10,7 +10,7 @@
+ # The path to mysql_config.
+ # Only use this if mysql_config is not on your PATH, or you have some weird
+ # setup that requires it.
+-#mysql_config = /usr/local/bin/mysql_config
++mysql_config = @PREFIX@/bin/mysql_config@MYSQL_SUFFIX@
+ 
+ # The Windows registry key for MySQL.
+ # This has to be set for Windows builds to work.
Index: python/py-mysql/files/patch-_mysql.c.diff
===================================================================
--- python/py-mysql/files/patch-_mysql.c.diff	(revision 87917)
+++ python/py-mysql/files/patch-_mysql.c.diff	(working copy)
@@ -1,23 +0,0 @@
---- _mysql.c.orig	2007-02-27 18:35:56.000000000 -0800
-+++ _mysql.c	2007-11-25 21:54:09.000000000 -0800
-@@ -34,9 +34,6 @@
- #else
- #include "my_config.h"
- #endif
--#ifndef uint
--#define uint unsigned int
--#endif
- #include "mysql.h"
- #include "mysqld_error.h"
- #include "errmsg.h"
-@@ -481,8 +478,8 @@
- #endif
- 	char *host = NULL, *user = NULL, *passwd = NULL,
- 		*db = NULL, *unix_socket = NULL;
--	uint port = MYSQL_PORT;
--	uint client_flag = 0;
-+	unsigned int port = MYSQL_PORT;
-+	unsigned int client_flag = 0;
- 	static char *kwlist[] = { "host", "user", "passwd", "db", "port",
- 				  "unix_socket", "conv",
- 				  "connect_timeout", "compress",
Index: python/py-mysql/files/patch-setup_posix.py.diff
===================================================================
--- python/py-mysql/files/patch-setup_posix.py.diff	(revision 87917)
+++ python/py-mysql/files/patch-setup_posix.py.diff	(working copy)
@@ -1,11 +0,0 @@
---- setup_posix.py.orig	2007-05-06 12:30:17.000000000 -0700
-+++ setup_posix.py	2007-05-06 12:31:30.000000000 -0700
-@@ -23,7 +23,7 @@
-         if ret/256 > 1:
-             raise EnvironmentError, "%s not found" % mysql_config.path
-     return data
--mysql_config.path = "mysql_config"
-+mysql_config.path = "mysql_config5"
- 
- def get_config():
-     import os, sys
Index: python/py-mysql/Portfile
===================================================================
--- python/py-mysql/Portfile	(revision 87917)
+++ python/py-mysql/Portfile	(working copy)
@@ -1,39 +1,65 @@
+# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
 # $Id$
 
-PortSystem 1.0
-PortGroup python24 1.0
+PortSystem          1.0
+PortGroup           python 1.0
 
 name				py-mysql
-version				1.2.2
+version             1.2.3
 categories			python devel databases
-maintainers			wilcoxd.com:rwilcox
 description			Python interface to mysql
 long_description 	A package containing a Python module that allows you to \
-					connect to MySQL databases
-platforms			darwin
+                    connect to MySQL databases
 homepage 			http://sourceforge.net/projects/mysql-python/
 master_sites		sourceforge:mysql-python
+platforms			darwin
+license             GPL
+maintainers			wilcoxd.com:rwilcox openmaintainer
+
 distname			MySQL-python-${version}
-checksums			md5 532268f02870bea18c1d465e88afff30
-patchfiles			patch-_mysql.c.diff
 
-depends_lib-append	port:py24-distribute
+checksums           rmd160  e394e7bf08127068795aeebfbaea7dc3b2127c86 \
+                    sha256  7de66fbbf923634e7c965aeaefa74642ba75ae20ee1cefcefc3009595b7a7e6e
 
+patch.pre_args      -p1
+patchfiles          patch-site.cfg.diff
+
+python.versions     24 25 26 27
+python.default_version 27
+
+pre-fetch {
+    if {![variant_isset mysql4] && ![variant_isset mysql5]} {
+        return -code error "you must select either mysql4 or mysql5"
+    }
+}
+
+if {$subport != $name} {
+    depends_lib-append	port:py${python.version}-distribute
+    post-patch {
+    reinplace "s|@PREFIX@|${prefix}|g" \
+        ${worksrcpath}/site.cfg
+    reinplace "s|@MYSQL_SUFFIX@|${mysql_suffix}|g" \
+        ${worksrcpath}/site.cfg
+    }
+    post-destroot {
+        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${subport}
+        xinstall -m 644 -W ${worksrcpath} \
+            HISTORY README \
+            ${destroot}${prefix}/share/doc/${subport}
+    }
+    livecheck.type      none
+}
+
 variant mysql4 conflicts mysql5 description {Build with MySQL 4} {
-	depends_lib-append	port:mysql4
+depends_lib-append	port:mysql4
 }
 
 variant mysql5 conflicts mysql4 description {Build with MySQL 5} {
-	patchfiles-append	patch-setup_posix.py.diff
-	depends_lib-append	path:bin/mysql_config5:mysql5
+depends_lib-append	path:bin/mysql_config5:mysql5
 }
 
+set mysql_suffix    {}
 if {![variant_isset mysql4]} {
-	default_variants +mysql5
+set mysql_suffix 5
+default_variants +mysql5
 }
-
-pre-fetch {
-	if {![variant_isset mysql4] && ![variant_isset mysql5]} {
-		return -code error "you must select either mysql4 or mysql5"
-	}
-}
