[mythtv-commits] Ticket #13502: Support python-PyMySQL as alternative MySQL connector for python bindings
MythTV
noreply at mythtv.org
Thu Nov 7 00:09:10 UTC 2019
#13502: Support python-PyMySQL as alternative MySQL connector for python bindings
-----------------------------------+----------------------------
Reporter: Gary Buhrmaster | Owner: Raymond Wagner
Type: Patch - Feature | Status: new
Priority: minor | Milestone: needs_triage
Component: Bindings - Python | Version: Master Head
Severity: medium | Keywords:
Ticket locked: 0 |
-----------------------------------+----------------------------
Support python-PyMySQL as an alternative implementation for the MythTV
python database connector.
The pure python PyMySQL implementation is (asserted to be) functionally
equivalent to the MySQLdb implementation for high level calls, and has
advantages for installation on certain platforms and distributions where
building support modules with C dependencies can be more complicated.
The particular motivator for this patch in this case, is that the
maintainer for the python-mysql connector has indicated they do not have
the resources to build python-mysql for EPEL8 at this time, so are
recommending using this pure python implementation.
Only lightly tested.
Note: This patch hits an area that is also touched by the python3 patches,
so depending on which patch set gets applied first there will likely be
patch failures due to the diff context overlap, and some minor
adjustment(s) may be needed, but as the code itself is quite contained, it
should be a trivial conflict fix for the committer if the patch is
accepted.
Thank you for your consideration.
Proposed patch:
{{{
diff --git a/mythtv/bindings/python/MythTV/_conn_mysqldb.py
b/mythtv/bindings/python/MythTV/_conn_mysqldb.py
index 676d147a62..38fcf98d04 100644
--- a/mythtv/bindings/python/MythTV/_conn_mysqldb.py
+++ b/mythtv/bindings/python/MythTV/_conn_mysqldb.py
@@ -5,6 +5,11 @@ from weakref import ref
import sys
import warnings
+try:
+ import pymysql
+ pymysql.install_as_MySQLdb()
+except ImportError:
+ pass
with warnings.catch_warnings():
warnings.simplefilter('ignore')
import MySQLdb, MySQLdb.cursors
diff --git a/mythtv/configure b/mythtv/configure
index b9de822bc3..f257963255 100755
--- a/mythtv/configure
+++ b/mythtv/configure
@@ -6989,7 +6989,7 @@ fi
if enabled bindings_python; then
is_python3 && python=python2
check_python || disable_bindings_python "Python 2.6"
- check_py_lib MySQLdb || disable_bindings_python "MySQLdb"
+ check_py_lib pymysql || { check_py_lib MySQLdb ||
disable_bindings_python "MySQLdb" ; }
check_py_lib lxml || disable_bindings_python "lxml"
check_py_lib urlgrabber || disable_bindings_python "urlgrabber"
fi
}}}
--
Ticket URL: <https://code.mythtv.org/trac/ticket/13502>
MythTV <http://www.mythtv.org>
MythTV Media Center
More information about the mythtv-commits
mailing list