From 83ccc88d040661167879414ce4f7e4428633751d Mon Sep 17 00:00:00 2001 From: CyberLeo Date: Thu, 14 Jan 2021 12:41:28 -0600 Subject: [PATCH] databases/py-MySQLdb: resurrect dead port --- cdn/ports/databases/py-MySQLdb/Makefile | 44 +++++++++++++++++++ cdn/ports/databases/py-MySQLdb/distinfo | 2 + .../databases/py-MySQLdb/files/patch-_mysql.c | 24 ++++++++++ cdn/ports/databases/py-MySQLdb/pkg-descr | 17 +++++++ 4 files changed, 87 insertions(+) create mode 100644 cdn/ports/databases/py-MySQLdb/Makefile create mode 100644 cdn/ports/databases/py-MySQLdb/distinfo create mode 100644 cdn/ports/databases/py-MySQLdb/files/patch-_mysql.c create mode 100644 cdn/ports/databases/py-MySQLdb/pkg-descr diff --git a/cdn/ports/databases/py-MySQLdb/Makefile b/cdn/ports/databases/py-MySQLdb/Makefile new file mode 100644 index 0000000..3149f0a --- /dev/null +++ b/cdn/ports/databases/py-MySQLdb/Makefile @@ -0,0 +1,44 @@ +# Created by: Maxim Sobolev +# $FreeBSD$ + +PORTNAME= MySQLdb +PORTVERSION= 1.2.5 +PORTREVISION= 2 +DISTVERSIONPREFIX= ${PORTNAME}- +CATEGORIES= databases python +PKGNAMEPREFIX= ${PYTHON_PKGNAMEPREFIX} + +MAINTAINER= python@FreeBSD.org +COMMENT= Access a MySQL database through Python + +LICENSE= GPLv2 +LICENSE_FILE= ${WRKSRC}/GPL-2.0 + +USES= compiler:c11 mysql python:2.7 +USE_PYTHON= autoplist distutils +USE_GITHUB= yes +GH_ACCOUNT= farcepest +GH_PROJECT= ${PORTNAME}1 + +CONFLICTS= ${PYTHON_PKGNAMEPREFIX}-MySQLdb5[0-9]-[0-9]* \ + ${PYTHON_PKGNAMEPREFIX}-mysqlclient-[0-9]* + +PORTDOCS= * +DOCSDIR= ${PREFIX}/share/doc/${PKGNAMEPREFIX}${PORTNAME} + +OPTIONS_DEFINE= DOCS MYSQLCLIENT_R +OPTIONS_DEFAULT= MYSQLCLIENT_R +MYSQLCLIENT_R_DESC= Use libmysqlclient_r (thread safe) + +pre-configure-MYSQLCLIENT_R-on: + ${REINPLACE_CMD} -e '/threadsafe = / s|True|False|' ${WRKSRC}/site.cfg + +post-install: + ${STRIP_CMD} ${STAGEDIR}${PYTHON_SITELIBDIR}/_mysql.so + +post-install-DOCS-on: + @${MKDIR} ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/README.md ${STAGEDIR}${DOCSDIR} + ${INSTALL_DATA} ${WRKSRC}/doc/* ${STAGEDIR}${DOCSDIR} + +.include diff --git a/cdn/ports/databases/py-MySQLdb/distinfo b/cdn/ports/databases/py-MySQLdb/distinfo new file mode 100644 index 0000000..5724868 --- /dev/null +++ b/cdn/ports/databases/py-MySQLdb/distinfo @@ -0,0 +1,2 @@ +SHA256 (farcepest-MySQLdb1-MySQLdb-1.2.5_GH0.tar.gz) = 905dd8be887ff596641ace5411fed17cfd08dd33699ea627d3fb44f8a922c2f0 +SIZE (farcepest-MySQLdb1-MySQLdb-1.2.5_GH0.tar.gz) = 81209 diff --git a/cdn/ports/databases/py-MySQLdb/files/patch-_mysql.c b/cdn/ports/databases/py-MySQLdb/files/patch-_mysql.c new file mode 100644 index 0000000..4eedeb3 --- /dev/null +++ b/cdn/ports/databases/py-MySQLdb/files/patch-_mysql.c @@ -0,0 +1,24 @@ +--- _mysql.c.orig 2014-01-02 19:15:03 UTC ++++ _mysql.c +@@ -124,6 +124,10 @@ static int _mysql_server_init_done = 0; + #define HAVE_MYSQL_OPT_TIMEOUTS 1 + #endif + ++#if MYSQL_VERSION_ID >= 50500 ++#define HAVE_OPENSSL 1 ++#endif ++ + PyObject * + _mysql_Exception(_mysql_ConnectionObject *c) + { +@@ -2002,7 +2006,9 @@ _mysql_ConnectionObject_ping( + int r, reconnect = -1; + if (!PyArg_ParseTuple(args, "|I", &reconnect)) return NULL; + check_connection(self); +- if ( reconnect != -1 ) self->connection.reconnect = reconnect; ++ if (reconnect != -1) { ++ mysql_options(&self->connection, MYSQL_OPT_RECONNECT, &reconnect); ++ } + Py_BEGIN_ALLOW_THREADS + r = mysql_ping(&(self->connection)); + Py_END_ALLOW_THREADS diff --git a/cdn/ports/databases/py-MySQLdb/pkg-descr b/cdn/ports/databases/py-MySQLdb/pkg-descr new file mode 100644 index 0000000..7c92b44 --- /dev/null +++ b/cdn/ports/databases/py-MySQLdb/pkg-descr @@ -0,0 +1,17 @@ +Python interface to MySQL + +MySQLdb is an interface to the popular MySQL database server for Python. +The design goals are: + +- Compliance with Python database API version 2.0 +- Thread-safety +- Thread-friendliness (threads will not block each other) +- Compatibility with MySQL-3.22 and later + +This module should be mostly compatible with an older interface +written by Joe Skinner and others. However, the older version is +a) not thread-friendly, b) written for MySQL 3.21, c) apparently +not actively maintained. No code from that version is used in +MySQLdb. MySQLdb is free software. + +WWW: https://github.com/farcepest/MySQLdb1 -- 2.42.0