From 1f175787f135199b24c2dcdc3549b2020e5525c7 Mon Sep 17 00:00:00 2001 From: Graham Voysey Date: Thu, 23 Nov 2017 13:29:35 -0500 Subject: [PATCH 1/5] Update setup_posix.py resolves #189, #175, #170, #169, etc. --- setup_posix.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/setup_posix.py b/setup_posix.py index 320e9e99..061e8551 100644 --- a/setup_posix.py +++ b/setup_posix.py @@ -9,9 +9,7 @@ # of mysql_config def dequote(s): - if s[0] in "\"'" and s[0] == s[-1]: - s = s[1:-1] - return s + return s.strip("'\"") def mysql_config(what): from os import popen From 920f73d3c15825929165ab382669feb9e2b0c484 Mon Sep 17 00:00:00 2001 From: Graham Voysey Date: Thu, 23 Nov 2017 15:03:13 -0500 Subject: [PATCH 2/5] Update README.md added clarity and common fixes for #169 related macOS issues. --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 60ec4ea5..a83210ba 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ You may need to install the Python and MySQL development headers and libraries l `sudo yum install python-devel mysql-devel` # Red Hat / CentOS -On Windows, there are binary wheel you can install without MySQLConnector/C or MSVC. +On Windows, there are binary wheels you can install without MySQLConnector/C or MSVC. #### Note on Python 3 : if you are using python3 then you need to install python3-dev using the following command : @@ -26,6 +26,23 @@ On Windows, there are binary wheel you can install without MySQLConnector/C or M `sudo yum install python3-devel ` # Red Hat / CentOS `brew install mysql-connector-c` # macOS (Homebrew) +#### Note on macOS +homebrew's `mysql-connector-c` may have incorrect configuration options that cause compilation errors. Under the `#create options` comment on or about line 112 of `/usr/local/bin/mysql_config`: + +changing +``` +# Create options +libs="-L$pkglibdir" +libs="$libs -l " +``` + +to +``` +# Create options +libs="-L$pkglibdir" +libs="$libs -lmysqlclient -lssl -lcrypto" +``` +will resolve these issues. An improper ssl configuration may also create issues; see `brew info openssl` for details. ### Install from PyPI From a56125ed2f95f57f70d95d7c961c94f60ecb7045 Mon Sep 17 00:00:00 2001 From: Graham Voysey Date: Mon, 27 Nov 2017 11:56:10 -0500 Subject: [PATCH 3/5] Update README.md clarity in docs. --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a83210ba..c3e976aa 100644 --- a/README.md +++ b/README.md @@ -26,23 +26,25 @@ On Windows, there are binary wheels you can install without MySQLConnector/C or `sudo yum install python3-devel ` # Red Hat / CentOS `brew install mysql-connector-c` # macOS (Homebrew) -#### Note on macOS -homebrew's `mysql-connector-c` may have incorrect configuration options that cause compilation errors. Under the `#create options` comment on or about line 112 of `/usr/local/bin/mysql_config`: +#### MySQL note +Versions of `mysql`may have incorrect default configuration options that cause compilation errors when `mysqlclient-python` is installed. (As of November 2017, this is known to be true for homebrew's `mysql-connector-c` and `mysql` packages) -changing +Modification of `mysql_config` resolves these issues as follows. +Change ``` +# on macOS, on or about line 112: # Create options libs="-L$pkglibdir" libs="$libs -l " ``` - to ``` # Create options libs="-L$pkglibdir" libs="$libs -lmysqlclient -lssl -lcrypto" ``` -will resolve these issues. An improper ssl configuration may also create issues; see `brew info openssl` for details. + +An improper ssl configuration may also create issues; see, e.g, `brew info openssl` for details on macOS. ### Install from PyPI From e167acb597a361a977a2793a5c3d55d156bd98ce Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Thu, 21 Dec 2017 18:39:19 +0900 Subject: [PATCH 4/5] Update README.md --- README.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c3e976aa..2262e9d5 100644 --- a/README.md +++ b/README.md @@ -13,9 +13,9 @@ I hope this fork is merged back to MySQLdb1 like distribute was merged back to s You may need to install the Python and MySQL development headers and libraries like so: -`sudo apt-get install python-dev libmysqlclient-dev` # Debian / Ubuntu - -`sudo yum install python-devel mysql-devel` # Red Hat / CentOS +* `sudo apt-get install python-dev libmysqlclient-dev` # Debian / Ubuntu +* `sudo yum install python-devel mysql-devel` # Red Hat / CentOS +* `brew install mysql-connector-c` # macOS (Homebrew) (Currently, it has bug. See below) On Windows, there are binary wheels you can install without MySQLConnector/C or MSVC. @@ -25,19 +25,25 @@ On Windows, there are binary wheels you can install without MySQLConnector/C or `sudo yum install python3-devel ` # Red Hat / CentOS -`brew install mysql-connector-c` # macOS (Homebrew) -#### MySQL note -Versions of `mysql`may have incorrect default configuration options that cause compilation errors when `mysqlclient-python` is installed. (As of November 2017, this is known to be true for homebrew's `mysql-connector-c` and `mysql` packages) +#### **Note about bug of MySQL Connector/C on macOS** + +See also: https://bugs.mysql.com/bug.php?id=86971 + +Versions of MySQL Connector/C may have incorrect default configuration options that cause compilation errors when `mysqlclient-python` is installed. (As of November 2017, this is known to be true for homebrew's `mysql-connector-c` and [official package](https://dev.mysql.com/downloads/connector/c/)) Modification of `mysql_config` resolves these issues as follows. + Change + ``` # on macOS, on or about line 112: # Create options libs="-L$pkglibdir" libs="$libs -l " ``` + to + ``` # Create options libs="-L$pkglibdir" From ac41d49d3714799f4668d679dd546811a632f3d0 Mon Sep 17 00:00:00 2001 From: INADA Naoki Date: Thu, 21 Dec 2017 18:40:55 +0900 Subject: [PATCH 5/5] Update setup_posix.py --- setup_posix.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/setup_posix.py b/setup_posix.py index 061e8551..14cffcad 100644 --- a/setup_posix.py +++ b/setup_posix.py @@ -9,7 +9,11 @@ # of mysql_config def dequote(s): - return s.strip("'\"") + if not s: + raise Exception("Wrong MySQL configuration: maybe https://bugs.mysql.com/bug.php?id=86971 ?") + if s[0] in "\"'" and s[0] == s[-1]: + s = s[1:-1] + return s def mysql_config(what): from os import popen